Reputation: 13
I'm trying to make a account system using php and SQL. The problem is that my knowledge is limited.
Here is what my sql db looks like right now: https://i.sstatic.net/eqQ3G.png
What I do when someone registers them is using my API:
if ($Action == "Register"){
$usr = mysql_escape_string($_GET['usr']);
$pas = mysql_escape_string($_GET['pas']);
$hwid = mysql_escape_string($_GET['hwid']);
$code = mysql_escape_string($_GET['code']);
$con = mysql_connect($host,$username,$password);
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db($db_name, $con);
mysql_query("UPDATE $table SET username = '$usr', password = '$pas', hwid = '$hwid'
WHERE code = '$code' AND username = '-' AND password = '-'
AND hwid = '-' AND time = '-'");
mysql_close($con);
What I'd like to know is how I can make sure a certain time is over and delete the entire row? For an example: They register and get a week of access, when the week is over, the account gets deleted.
Thank you guys so much for any help.
Upvotes: 1
Views: 224
Reputation: 77
If you want to delete user automatic read about cron job http://www.thesitewizard.com/general/set-cron-job.shtml.
Else you can check user's registration time in index.php, and delete user MySQlL Query
DELET FROM USER_TABLE WHERE time < NOW() - INTERVAL 1 WEEK
Upvotes: 2