sjohns Posted May 20, 2007 Share Posted May 20, 2007 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. <? /* * 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</a><br><br>\n"; ?> Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted May 20, 2007 Share Posted May 20, 2007 not sure if it would work, but you could possibly attempt to use jabascript to open the new window... not sure how you would do so though Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.