I am attempting to output the page that is generated from an included PHP script in a new browser window, but have had no success in doing so.
The following generate_url.php script will generate a one time key that will allow a new user to download a file when they log in to my mambo based web site for the first time after registration. This script is included by the login script only if it is the new user's first login; fine so far. The problem is that I need it to pop a new browser window and output the generated page into this window. As written, the script will run, but the output cannot be seen because the login script process will then complete and the user will only see the site home page. Any help in doing this would be greatly appreciated.
<?php
/
generate_url.php
Script for generating URLs that can be accessed one single time.
/** ensure this file is being included by a parent file /
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
/ 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."\n")) )
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'],0,strrpos($SERVER['PHP_SELF'],"/"));
/ Report the one-time URL to the user: /
print "<a href='http://".$_SERVER['HTTP_HOST'].
"$cwd/get_file.php?q=$token'>\n";
print "http://".$_SERVER['HTTP_HOST']."/get_file.php?q=$token[/url]
\n";
?>