Zubrag.com
May 23, 2019, 11:37:27 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Time limit script  (Read 6442 times)
maurellis
Newbie
*
Posts: 1


« on: September 05, 2010, 10:07:01 AM »

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?

Logged
churchill
Newbie
*
Posts: 1


« Reply #1 on: March 20, 2012, 03:10:29 PM »

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
Logged
Caffeine_Cadet
Newbie
*
Posts: 13


« Reply #2 on: April 04, 2012, 12:10:44 AM »

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">
Logged
Caffeine_Cadet
Newbie
*
Posts: 13


« Reply #3 on: April 04, 2012, 12:27:10 AM »

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

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.
Logged
Caffeine_Cadet
Newbie
*
Posts: 13


« Reply #4 on: April 04, 2012, 01:20:50 PM »

Next you will need to have the following in your MySQL user table:
Code:
$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.
Code:
$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.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC