hamza Posted May 11, 2010 Share Posted May 11, 2010 i am locking an ip to dowload a file and second time wait for 2min to start downloading again using cookie. plz tell me is it a secure and proper way to do this?or any other idea to do this. plus making sure the link provide to u is only for u not for any other user in all over the world. plz tell me how i can possibly do that. this kind of secnario running in hotfile.. my code <?php $ip = $_SERVER['REMOTE_ADDR']; $expire = time() + 120; /* cookie expire 2 min */ $expirey_min = 2 ; if ( !isset($_COOKIE['ip']) ) { setcookie("ip", $ip, $expire); echo '<a href=cookie.php> Download </a>'. $expire; $current_min = date('i', time() ); $expiry_min = $current_min + 2; } else { $expiry_counter = $expiry_min - date('i', time()) ; // echo 'you can again download after '.$expiry_counter.'min'; echo 'Your IP address '.$ip.' is already downloading a file. Please wait until the download is completed '.$expirey_min.'min'; } print '<pre>'; print_r($_COOKIE); ?> Link to comment https://forums.phpfreaks.com/topic/201418-cookie/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.