Jump to content

Need help!


david212

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/208820-need-help/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/208820-need-help/#findComment-1090882
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.