/    Sign up×
Community /Pin to ProfileBookmark

Is this possible?

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.

to post a comment
PHP

13 Comments(s)

Copy linkTweet thisAlerts:
@pyroDec 28.2003 — 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
Copy linkTweet thisAlerts:
@TeachauthorDec 28.2003 — 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.
Copy linkTweet thisAlerts:
@pyroDec 28.2003 — 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.
Copy linkTweet thisAlerts:
@Khalid_AliDec 28.2003 — 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???
Copy linkTweet thisAlerts:
@TeachauthorDec 28.2003 — [i]Originally posted by Khalid Ali [/i]

[B]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??? [/B]
[/QUOTE]


Not really, sorry! ?
Copy linkTweet thisAlerts:
@Khalid_AliDec 29.2003 — [i]Originally posted by Teach [/i]

[B]Not really, sorry! ? [/B][/QUOTE]


no problem..?

I think you need to [url=http://forums.webdeveloper.com/showthread.php?s=&threadid=16096]read this li'l tutorial on how to compose a question for general forums[/url]
Copy linkTweet thisAlerts:
@TeachauthorJan 03.2004 — 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.
    Copy linkTweet thisAlerts:
    @design_dragonJan 03.2004 — 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.
    Copy linkTweet thisAlerts:
    @TeachauthorJan 03.2004 — [i]Originally posted by design.dragon [/i]

    [B]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. [/B]
    [/QUOTE]


    Ahh okay, thanks, how would I go about doing that?
    Copy linkTweet thisAlerts:
    @design_dragonJan 04.2004 — 

    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
    Copy linkTweet thisAlerts:
    @design_dragonJan 04.2004 — Sorry

    Miss-typing in my previous post. Write permissions are of course 666 noy 888
    Copy linkTweet thisAlerts:
    @TeachauthorJan 04.2004 — Wonderful, thanks!

    Much appreciated.

    Presumably however, users could still load whatever the page has been re-named to if they knew the filename?
    Copy linkTweet thisAlerts:
    @design_dragonJan 05.2004 — 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
    ×

    Success!

    Help @Teach spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.19,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...