Click to See Complete Forum and Search --> : Is this possible?
Teach
12-27-2003, 05:57 PM
Hello there.
Just wondering, I have an application form on my site, which i'd like to have a button on a staff password protected page (htaccess) that this button would "shut" the application and echo a message, and then a reopen button.
Is this possible with PHP and how could i do it?
Many thanks and happy new year.
I'm not sure what you are asking, but if it is what I think you are, JavaScript would probably be a better bet. Take a look at http://www.webdevfaqs.com/javascript.php#showhide
Teach
12-28-2003, 10:31 AM
Hi there and thanks.
I didn't really want to do it with another language...
Basically, to explain further, (Sorry if it wasn't clear) I have an application to become a moderator that is heavily used. I wanted it that if too many applications were received, a staff member could press a button on one of my htaccess secured pages that will "shut" the application, and if it's shut it would echo a polite message, then if it's shut a button to re-enable the application.
Is that poss?
Hope that explains better.
Ah yes, I see. Certainly, that is possible. Are you using a database? Basically, you will want to set something (a DB field, if you are using one) to reflect the status of the application. Then, you can check against this value, and display the appropriate content.
Khalid Ali
12-28-2003, 12:07 PM
Interesting...I am not sure your question is still that clear,however, here is what I can come up with....:)
If by sutting the application you mean to deny accessing the information from a web app then what you can do is wite a little routine (may be in php) that validates that if there is still room to enter any new data,if it is then allow user to enter new info else show a message...
whenever next time this is attempted make sure the is room if not just show message untill some one accesses the page when there is room and they will get to see the code that allows them to enter a record????
make any sense???
Teach
12-28-2003, 05:06 PM
Originally posted by Khalid Ali
Interesting...I am not sure your question is still that clear,however, here is what I can come up with....:)
If by sutting the application you mean to deny accessing the information from a web app then what you can do is wite a little routine (may be in php) that validates that if there is still room to enter any new data,if it is then allow user to enter new info else show a message...
whenever next time this is attempted make sure the is room if not just show message untill some one accesses the page when there is room and they will get to see the code that allows them to enter a record????
make any sense???
Not really, sorry! :confused:
Khalid Ali
12-29-2003, 12:08 AM
Originally posted by Teach
Not really, sorry! :confused:
no problem..:D
I think you need to read this li'l tutorial on how to compose a question for general forums (http://forums.webdeveloper.com/showthread.php?s=&threadid=16096)
Teach
01-03-2004, 12:56 PM
Hi there.
Please accept my apologies if my original question wasn't clear enough, I admit, it was very rushed!
Basically, what I'm trying to achieve (with yet, no luck), is to create some form of button that will "close" a particular page on my website.
I have an application form, located at say /modapp/index.php and I'd like to be able to press a button located somewhere else that will "close" this page, and give a polite notice saying that too many applications have been received and it's closed.
I have a .htaccess'ed folder for staff where I could place this button on a page as it'd be password protected, and also to have that if the application is closed, a button to re-open it.
Do you think this is possible?
I'm using:
- Apache 1.3.27.
- PHP: 4.3.2.
- mod_throttle: 3.1.2.
Furthermore, I'm not using a database.
design.dragon
01-03-2004, 01:15 PM
Not something i've tried, but seems to me easiest way would be to use the rename facility.
Have two files your current index and another one say newindex
use a button to rename index to say oldindex and new index to index.
A second button could reverse this.
Teach
01-03-2004, 03:20 PM
Originally posted by design.dragon
Not something i've tried, but seems to me easiest way would be to use the rename facility.
Have two files your current index and another one say newindex
use a button to rename index to say oldindex and new index to index.
A second button could reverse this.
Ahh okay, thanks, how would I go about doing that?
design.dragon
01-04-2004, 07:54 AM
There are obviously many ways to incorporate the coding in a page. Here is a complete page which works.
-----------
<html>
<head><title>Admin Control Panel</title>
<style type="text/css">
<!--
A:link {text-decoration: none;}
A:visited {text-decoration: none;}
-->
</style>
</head>
<body bgcolor="#ffcc99" link="#FF0000" vlink="#FF0000" alink="#FF0000">
<center>
<p><br>
<blockquote>
<form action=admin.php method=post>
<input type=submit value="Swap Files">
<p><br>
<?php
$filename1 = 'open.php'; // name of page with applications open
$filename2 = 'closed.php'; //name of page to say applications closed
$index='index.php';
if (file_exists($filename1)) {
rename($index, $filename2);
rename($filename1, $index);
} else {
rename($index, $filename1);
rename($filename2, $index);
}
?>
</center>
</body>
</html>
---------------
Set up this page and call it admin.php. the directory it is in must have full 777 permissions. If it is not stored in the same directory as the pages, then you must change the relative paths. It could be put in your password protected directory
You need to have your main index.php page set up and call the second page closed.php. The directory which holds the pages and the pages needs write permissions 888. If you change the name of any of the files make sure you change them in the above coding. There are more sophisticated ways of doing it but the above is simple
design.dragon
01-04-2004, 07:57 AM
Sorry
Miss-typing in my previous post. Write permissions are of course 666 noy 888
Teach
01-04-2004, 10:52 AM
Wonderful, thanks!
Much appreciated.
Presumably however, users could still load whatever the page has been re-named to if they knew the filename?
design.dragon
01-05-2004, 10:41 AM
Yep, thats true, but you could store the pages 'open.php' and 'closed.php' in a password protected directiory if you change the path in the coding.
You would have to change the paths anyway if you stored this admin.php in another directory.
If all 3 are in the same directory, you need only change the path for the index file to your main site address like '/modapp/index.php' as you suggested earlier