I have a script to give a unique download link. Below: 
The problem is when i refresh the page it generates another link.
i tried header but i want to:
- Show the unique download link
- If refresh page, redirect or
echo 'Only one download per IP!
Something like that. The code is
<?php //connect to the DB $resDB = mysql_connect("sql213.byethost10.com", "user", "pass"); mysql_select_db("Nice try", $resDB); function createKey() { //create a random key $strKey = md5(microtime()); //check to make sure this key isnt already in use $resCheck = mysql_query("SELECT count(*) FROM downloads WHERE downloadkey = '{$strKey}' LIMIT 1"); $arrCheck = mysql_fetch_assoc($resCheck); if ($arrCheck['count(*)']){ //key already in use return createKey(); } else { //key is OK return $strKey; } } //get a unique download key $strKey = createKey(); //insert the download record into the database mysql_query("INSERT INTO downloads (downloadkey, file, expires) VALUES ('{$strKey}', 'fernanfloo-OMG.zip', '".(time()+(60*60*24*7))."')"); ?> <html> <head> <title>Descargar Fernanfloo OMG sonido</title> </head> <h1>By Skyleter</h1> <p>Su link de descarga es:</p> <strong><a href="download.php?key=<?=$strKey;?>">download.php?key=<?=$strKey;?></a></strong> <p>Link caduca en 7 días..</p> </html> PS: header worked but as i said, i want to show the unique download link, and ONLY IF THE USER REFRESH PAGE, redirect. (and everytime redirect to a page)