on 5/9/01 1:01 PM, Michael Champagne at [EMAIL PROTECTED] wrote:

> I have an area of our site where you can turn off certain 'systems' by
> clicking a button.  This is all done in HTML and it brings up a javascript box
> to verify that this is really what you want to do..  It then does a
> header("location: ...") to redirect to a .php file that locks down the site.
> The problem is that the browser saves this in the history and sometimes will
> do complete this .php file in a URL and the site is locked down by accident.
> Is there a better way to call a certain function of the site rather than doing
> a header("location: ...") redirection?  How does everyone else do this?
> 
> Thanks!
> Mike

I do something like this to move files around between boxes. I have a
webpage that allows a traffic manager to select a date/time to checkout
files from CVS. This date stamp is written to a file, /tmp/doSync.tmp, and a
mail message warning of the impending checkout is sent to the traffic
manager. A cron job checks for the existence of /tmp/doSync.tmp, and if
found a CVS checkout is made to a temp directory /tmp/tempScripts/ using the
metadata from inside the file (date, time, etc).

Another cron script runs rsync to distribute the files where they belong,
and removes the /tmp/doSync.tmp script mailing the results of the rsync
script to the sysadmin.

The page that writes the original file is in PHP, and PHP scripts read the
contents of /tmp/doSync.tmp whenever a traffic manager loads the page to let
him/her know if a checkout is pending or not.

I get around your problem like this, the main page loads a form whose action
is a php script that will place the tmp file, and then redirects back to the
main page. This makes the redirect happen after the fact. I also have a lag
in the cron job to give the traffic manager a chance to intercede after
receiving the mail notification.

Does that make sense?

main.php
  <form action='place_temp.php'>

place_temp.php
  if ($fp=fopen('/tmp/doSync.tmp', 'w')) {
    fwrite($fp,"$cvsDateTime \n");
    fclose($fp);
    chmod("/tmp/tmp/doSync.tmp", 0666);
    $message = "A checkout of HTML/PHP files is scheduled \n";
    $message .= "If this is an error, you may cancel ";
    $message .= "<a href='http://dev.server.com/rm_temp.php'>here.</a>";
    mail("[EMAIL PROTECTED],"Files moving Live!!",$message);
    header("Location: main.php");

    } else {

    header("Location: main.php");
    }

Cron jobs do the rest.


--
Dave Goodrich
Director of Interface Development
Reality Based Learning Company
9521 NE Willows Road, Suite 100
Redmond, WA 98052 
Toll Free 1-877-869-6603 ext. 237
Fax (425) 558-5655 
[EMAIL PROTECTED] 
http://www.rblc.com



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to