Time limit script

Started by maurellis, September 05, 2010, 07:07:01 PM

maurellis

Hi,
I would like to put a restriction of a time-limit for downloads from my website. For example: 24hrs and one can no longer download any files. Perhaps a restriction via email. Any ideas please?

churchill


Hi,
I would like to put a restriction of a time-limit for webpage from my website. For example: 5mins and one can no longer have access to the page unless and he will be directed to another page were he will have to put an access code to view my page again. Any ideas please? looking for a kind respond

Caffeine_Cadet

Well i guess i can take a crack at this.

My suggestion for the refresh function is to use meta data.  It's frowned upon, but it's functional and not all-together deprecated.
Add the following into the head section of your html file that you would like to have a set interval for:

<meta http-equiv="refresh" content="300">

Caffeine_Cadet

i had much more to put here, but the spam blockers are prohibiting me.  :-\

i dont know what i wrote that makes the server think that i put a blue ray conversion in here, but so goes life i guess.

Caffeine_Cadet

Next you will need to have the following in your MySQL user table:

$query = 'CREATE TABLE IF NOT EXISTS users
(
id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,
last_login INTEGER UNSIGNED DEFAULT 0,
PRIMARY KEY (id)
)
ENGINE = MyISAM';
mysql_query($query, $db) or die(mysql_error($db));


Now you will need to check the mysql table to see when they logged on to your site, and see if it is beyond the time constraints.
$query = 'SELECT
id, last_login
FROM
users
WHERE
id = "' . $id . '"';
$result = mysql_query($query, $db) or die(mysql_error($db));

if($row = mysql_fetch_array($result))
{
$lastlog = $row['last_login'];
}

//Compare the integers.
$timenow = time();
$timenow = $timenow - 300;

if ($timenow > $lastlog)
{
header('Location: *.php');
}

*.php should be interpreted as some site that has different permissions, or some page that says:
"You've worn out your welcome.  Please leave."

well theres the code lines i would use.  evidently the explainations that i typed up to explain how the code works is, unfortunately, a violation of some movie rights or something.