[Script] Download v1.0 08-21-2012, 02:00 PM
#1
Ok So I coded This phpScript Which Will Generate Special Link For The Visitor And Will Give The Download Link Only If The User Gets 5 Visitors From his/her Link..
How To setup :
1) Create a table in mysql With 4 columns witn name id,ip,code,visit in same order.
2) Change the username,password,host,db,table,website,download link with yours in php file.
3) upload it to your host.
How To setup :
1) Create a table in mysql With 4 columns witn name id,ip,code,visit in same order.
2) Change the username,password,host,db,table,website,download link with yours in php file.
3) upload it to your host.
PHP Code:
<html><head><title>Download v1.0</title><body>
<?php
$id=$_GET['id'];
$user='username';
$pass='password';
$host='host';
$table='visitors';
$db='download';
$connection=mysql_connect($host,$user,$pass) or die('err1');
mysql_select_db($db) or die('err2');
$code=rand();
$ip=$_SERVER['REMOTE_ADDR'];
$add="INSERT INTO $table(code,ip,visit) values('$code','$ip','0')";
mysql_query($add) or die('err3');
echo "<table width='200'><tr><th><p>Your Specail Link</p></th></tr><tr><td><input type='text' size='40' value='yoursite/download.php?id=$code'></td></tr></table>";
if($id!="")
{
$check=mysql_query("SELECT * FROM $table WHERE code='$id'") or die("err4");
$check2=mysql_fetch_row($check) or die("The Link Is Invalid");
if($check2[1]==$ip){echo"You Have Earned ".$check2[3]." visits";
if ($check2[3]==5){echo"<a href='Download link here'> Here is your Dowload link</a>";
mysql_query("DELETE FROM $table WHERE code='$id'");}
else{
$visit=$check2[3] + 1;
mysql_query("UPDATE $table SET visit='$visit' WHERE code='$id'");
}
}
}
mysql_close($connection);
?>
</body></html>
![[Image: fow57.jpg]](http://i.imgur.com/fow57.jpg)
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)