I have been dabbling in PHP and messin around with things, I really like it, tho it is a little tricky to understand.
However, I have a piece of script I just can’t wrap my head around.
I know how to do a simple redirect in php, however, how can I make it redirect to the specified page at the bottom of this code? It’s probably pretty easy, but I have no clue, it has been stumping me for days already (literally)
<?php/** generate_url.php** Script for generating URLs that can be accessed one single time.**//* Generate a unique token: */$token = md5(uniqid(rand(),1));/* This file is used for storing tokens. One token per line. */$file = "/tmp/urls.txt";if( !($fd = fopen($file,"a")) ) die("Could not open $file!");if( !(flock($fd,LOCK_EX)) ) die("Could not aquire exclusive lock on $file!");if( !(fwrite($fd,$token." ")) ) die("Could not write to $file!");if( !(flock($fd,LOCK_UN)) ) die("Could not release lock on $file!");if( !(fclose($fd)) ) die("Could not close file pointer for $file!");/* Parse out the current working directory for this script. */$cwd = substr(
SERVER['PHP_SELF'],"/"));/* Report the one-time URL to the user: */print "Use this URL to download the secret file:<br><br> ";print "<a href='http://".
SERVER['HTTP_HOST']. "$cwd/get_file.php?q=$token'> ";print "http://".
Any input would be greatly appreciated, If you have the time to briefly explain why this is, that would be awesome.CG