note 76915 deleted from function.strtotime by bobby
| From: | bobby@php.net | Date: | Mon, 06 Aug 2007 14:28:06 +0000 |
| Subject: | note 76915 deleted from function.strtotime by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-129210@lists.php.net to get a copy of this message | ||
Note Submitter: westmatrix99
----
I needed a script to check the time that users weren't activated so I came up with this.
<?php
$username = $row_rstime['username'];
$sql = "SELECT * FROM tblogin";
$result = mysql_query($sql);
while($row_rstime = mysql_fetch_array($result)){
$activated = $row_rstime['active'];
$when = strtotime($row_rstime['DateJoined']); // currently at "2007-05-24
20:50:53"
if ($activated == 'Y' || time() < ($when+60*60*24*3)) {
echo 'Keep '.$username.'<br>';
}else{
//Get the date and hour, 72 hours ago
$minus = strtotime("-72 hours");
$date = date("Y-m-d H:i:s", $minus);
$query = "DELETE FROM tblogin WHERE active = 'N' AND DateJoined <=
'".$date."'";
$delete = mysql_query($query);
echo 'Deleted '.$username.'<br>';
}
}
?>