如果时间到了,我编写了一个脚本来将用户的密钥活动状态更改为 0。从那里开始时,我设置start_time
为 time(); 比设置像“60”这样的天数。
根据我目前的执行方式,我如何计算剩余的时间(以天或小时或分钟为单位)。
$user_info['days'] = "60"
`start_time` = 1332219600
function setup() {
mysql_connect('localhost', 'stresser_main', 'ZLLAUkuLIUU');
mysql_select_db('stresser_main');
$query = mysql_query("SELECT * FROM `keys` WHERE `active`='1'");
while ($user_info = mysql_fetch_array($query)) {
$time_ago = strtotime("-" . $user_info['days'] . " day");
$time_ago_other = strtotime("+" . $user_info['days'] . " day");
mysql_query("UPDATE `keys` SET `active`='0' WHERE `start_time` < $time_ago AND `id`='" . $user_info['id'] . "'");
}
}