Fixed ban lengths

This commit is contained in:
Savetheinternet 2011-01-02 21:34:04 +11:00
parent a3143b5b3d
commit f1f68b0e7e

View File

@ -347,8 +347,8 @@
// 1yr2hrs30mins // 1yr2hrs30mins
// 1y2h30m // 1y2h30m
if(preg_match('/^((\d+)\s?ye?a?r?s?)?\s?+((\d+)\s?we?e?k?s?)?\s?+((\d+)\s?da?y?s?)?((\d+)\s?ho?u?r?s?)?\s?+((\d+)\s?m?i?n?u?t?e?s?)?\s?+((\d+)\s?s?e?c?o?n?d?s?)?$/', $_POST['length'], $m)) { $expire = 0;
$expire = 0; if(preg_match('/^((\d+)\s?ye?a?r?s?)?\s?+((\d+)\s?we?e?k?s?)?\s?+((\d+)\s?da?y?s?)?((\d+)\s?ho?u?r?s?)?\s?+((\d+)?mi?n?u?t?e?s?)?\s?+((\d+)\s?se?c?o?n?d?s?)?$/', $_POST['length'], $m)) {
if(isset($m[2])) { if(isset($m[2])) {
// Years // Years
$expire += $m[2]*60*60*24*7*52; $expire += $m[2]*60*60*24*7*52;
@ -373,6 +373,8 @@
// Seconds // Seconds
$expire += $m[12]; $expire += $m[12];
} }
}
if($expire) {
$query->bindValue(':expires', time()+$expire, PDO::PARAM_INT); $query->bindValue(':expires', time()+$expire, PDO::PARAM_INT);
} else { } else {
// Never expire // Never expire