david212 Posted July 25, 2010 Share Posted July 25, 2010 All the thins i want to do here is: if not cookie = put there download link if cookie = you have already downloaded please try again in 5 days <?php session_start(); ?> <?php if($_SERVER['REQUEST_METHOD'] == 'POST') { if(isset($_POST['user']) && $_POST['user']) { if(isset($_COOKIE[$_POST['user']]) && !empty($_COOKIE[$_POST['user']])) { echo "you have already downloaded please try again in 5 days"; } else { setcookie("email[name]", $_POST['email'], (time()+3600*24)*7); echo "<a href='download.php'>Download Now</a>"; } } } ?> <form name="cfrom" method="post"> <input type="text" name="name" id="name"> <input type="text" name="email" id="email"> <input type="submit" value="submit"> </form> what im doing wrong? Please help! Quote Link to comment Share on other sites More sharing options...
magnetica Posted July 25, 2010 Share Posted July 25, 2010 if not cookie = put there download link if cookie = you have already downloaded please try again in 5 days You shoudln't rely on cookies here, as soon as they reliase they can't download a file because of a cookie (which most amatuerish webbies could do).... They would delete the cookie and download the file Think about maybe storing their email and name in a database or XML file or something where they havn't got access to.. Regards, Magnetica 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.