Jump to content

Recommended Posts

[!--quoteo(post=388650:date=Jun 27 2006, 09:27 PM:name=bigun)--][div class=\'quotetop\']QUOTE(bigun @ Jun 27 2006, 09:27 PM) [snapback]388650[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Or if anyone can tell me how to make a link that will allow someone to download a file, then after it is finished the link will go dead.
[/quote]

In the database have.

users_id
time
date
users_ip
downloaded

dowload

[code]

<?session_start(); //if user session is present and is set as $user_id

//select database

$db=mysql_connect("localhost","name","password" );
mysql_select_db($db);

// query the database if the user is in the database where user_id=$user_id.

$query="select *  from downloads where time=$time and date=$date and
user_ip=$user_ip and user_id=$user_id";

$result=mysql_query($query);

// if the user is not in the database then let them see the link and down load.

if(mysql_num_rows($result)==0)) {

$time=date("his");
$date=date("dmy");
$user_ip=$_SERVER['REMOTE_ADDR']:
?>

<a href="download_result?&user_id=$user_id&time=$time&date=$date&user_ip=$user_ip">download file</a>
<?

//else if the user is in the database echo sorry message.
}else{

echo "sorry you have downloaded already";

}
[/code]

I tried ok.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.