in your user table of the database add the columns ‘access’ and ‘expire’… both VARCHAR(20) both with default of ‘no’
then when a user signs up for access get the users username and put it in $username then run
[php]
$todayDate = date(“Y-m-d”);
$dateOneMonthAdded = strtotime(date(“Y-m-d”, strtotime($todayDate)) . “+1 month”);
$expiredate = date(‘Y-m-d’,$dateOneMonthAdded);
$dbhost = “…”;
$dbuser = “…”;
$dbpass = “…”;
$dbname = “…”;
$dbconnection=mysql_connect($dbhost, $dbuser, $dbpass);
$db_selected=mysql_select_db($dbname, $dbconnection);
$result=mysql_query(“UPDATE users SET access = ‘yes’ AND expire = ‘$expiredate’ WHERE username = ‘$username’”);
[/php]
then on your login page add this
[php]
$todayDate = date(“Y-m-d”);
$dbhost = “…”;
$dbuser = “…”;
$dbpass = “…”;
$dbname = “…”;
$dbconnection=mysql_connect($dbhost, $dbuser, $dbpass);
$db_selected=mysql_select_db($dbname, $dbconnection);
$result=mysql_query(“SELECT * FROM users WHERE user = ‘$user’”);
$row = mysql_fetch_array($result);
$access = $row[‘access’];
$expire = $row[‘expire’];
if($access == “yes”){
if($expire <= $todayDate){
$result=mysql_query(“UPDATE users SET access = ‘no’ AND expire = ‘none’ WHERE username = ‘$username’”);
$granted = “no”;
} else {
$granted = “granted”;
}
} else {
$granted = “no”;
}
[/php]
put granted in a session variable, have the user redirected, do what you want this is just an example of how you can do it.