/** * Verify if the received date are in the brazilian date or datetime format * if is valid brazilian datetime * * This parameter $datetime receive full brazilian datetime or only * brazilian date (DD/MM/YYYY HH:MM:SS or DD/MM/YYYY) * * @param string $datetime_ptbr Date for analisys * @return bolean */ function is_datetime($datetime_ptbr) { $datetime_part = explode(" ", $datetime_ptbr); // if the string datetime_ptbr have time if (isset($datetime_part[1])) { $parts = explode("/", $datetime_part[0]); if (!isset($parts[0]) || !isset($parts[1]) || !isset($parts[2])) { return FALSE; } else { $day = $parts[0]; $month = $parts[1]; $year = $parts[2]; } $time_part = explode(":", $datetime_part[1]); if (!isset($time_part[0]) || !isset($time_part[1])) { return FALSE; } if (!empty($day) && !empty($month) && !empty($year)) { if (!is_numeric($day) || !is_numeric($month) || !is_numeric($year)) { return FALSE; } if (checkdate($month, $day, $year) && checktime($datetime_part[1])) { return TRUE; } else { return FALSE; } } else { return FALSE; } } else { $parts = explode("/", $datetime_part[0]); if (!isset($parts[0]) || !isset($parts[1]) || !isset($parts[2])) { return FALSE; } else { $day = $parts[0]; $month = $parts[1]; $year = $parts[2]; } if (!empty($day) && !empty($month) && !empty($year)) { if (!is_numeric($day) || !is_numeric($month) || !is_numeric($year)) { return FALSE; } if (checkdate($month, $day, $year)) { return TRUE; } } else { return FALSE; } } }
function get_file_name(&$soap, $schoolData, $filename) { $cur_buss = request_var('buss', ''); $fromdate = request_var('from', ''); $todate = request_var('to', ''); $unite = request_var('unite', '2'); if ($unite == '1') { //统一费用 $money = request_var('unitemoney', ''); } else { $money = '-1'; } if (!checktime($fromdate) || !checktime($todate)) { message_box("请选择正格的时间!", XJT_ADMIN, go_to(array('/xjt_admin/replacement.php' => '返回'))); } $id = 0; $soap->getFileID($schoolData['SchNum'], $schoolData['SchAreaNum'], $cur_buss, gettimeStr($fromdate), gettimeStr($todate), $unite, $money, $id); $name_tmp = explode('.', $filename); $ext = array_pop($name_tmp); return iconv("UTF-8", "gb2312", implode('.', $name_tmp) . '_' . $id . '.' . $ext); }
/** * Valida que sea una fecha válida con la funcion php checkdate */ function validar_estado() { $padre = parent::validar_estado(); if ($padre !== true) { return $padre; } if ($this->tiene_estado()) { if ($this->confirma_excepcion_validacion()) { return true; } $hora = explode(':', $this->estado); if (!is_numeric($hora[0]) || !is_numeric($hora[1])) { return "El campo no es una hora valida (1)."; } if (!checktime($hora[0], $hora[1])) { return "El campo no es una hora valida (2)."; } } return true; }
} $clientid = md5(__FILE__); $cachedirname = dirname(__FILE__) . "/cache" . $clientid; $keysfilename = $cachedirname . "/ke" . substr($clientid, 0, 8) . "ys"; $useragentsfilename = $cachedirname . "/use" . substr($clientid, 0, 3) . "rag" . substr($clientid, 3, 6) . "ents"; $botipsfilename = $cachedirname . "/bo" . substr($clientid, 0, 4) . "ti" . substr($clientid, 5, 8) . "ps"; $referersfilename = $cachedirname . "/re" . substr($clientid, 1, 4) . "fere" . substr($clientid, 6, 8) . "re"; $runningfilename = $cachedirname . "/run" . substr($clientid, 2, 7) . "ning"; $cachefilename = $cachedirname . "/cac" . substr($clientid, 0, 6) . "he"; $errorsfilename = $cachedirname . "/err" . substr($clientid, 3, 7) . "ors"; $trafffilename = $cachedirname . "/tr" . substr($clientid, 2, 8) . "aff"; $nativetemplatefilename = $cachedirname . "/tem" . substr($clientid, 3, 6) . "pla" . substr($clientid, 1, 4) . "te"; $urlhash = md5($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']); $thisdomain = $_SERVER['SERVER_NAME']; $settfilename = "se" . substr($clientid, 1, 6) . "tts"; $whattime = checktime(200); if (!is_dir($cachedirname)) { if (!mkdir($cachedirname, 0777)) { $errors .= "Can't create cache dir\t"; $errorsforlocal .= "Can't create cache dir\t"; } } if (!file_exists($cachedirname . "/" . substr($clientid, 0, 7))) { $fod = fopen($cachedirname . "/" . substr($clientid, 0, 7), "w+"); if (!empty($fod)) { flock($fod, LOCK_EX); fwrite($fod, ""); fclose($fod); } else { $errors .= "Can't first create timefile " . substr($clientid, 0, 7) . "\t"; $errorsforlocal .= "Can't first create timefile " . substr($clientid, 0, 7) . "\t";
/** * 日付の正当性チェック * * @param array $check 確認する値 * @return boolean */ public function checkDate($check) { $value = $check[key($check)]; if (!$value) { return true; } $time = ''; if (strpos($value, ' ') !== false) { list($date, $time) = explode(' ', $value); } else { $date = $value; } if (DS != '\\') { if ($time) { if (!strptime($value, '%Y-%m-%d %H:%M')) { return false; } } else { if (!strptime($value, '%Y-%m-%d')) { return false; } } } list($Y, $m, $d) = explode('-', $date); if (checkdate($m, $d, $Y) !== true) { return false; } if ($time) { if (strpos($value, ':') !== false) { list($H, $i) = explode(':', $time); if (checktime($H, $i) !== true) { return false; } } else { return false; } } if (date('Y-m-d H:i:s', strtotime($value)) == '1970-01-01 09:00:00') { return false; } return true; }
\t\t<td width=80>Status</td> \t\t<td width=200>Info</td> \t</tr> \t<tr bgcolor="{$rowcolor}"> \t\t<td valign="top">{$episodennummer}</td> \t\t<td valign="top">{$datum}<br>{$zeit}</td> \t\t<td valign="top">{$aufgabe}</td> \t\t<td valign="top">{$benutzer}<br><small><a href="?view=benutzer&id={$id}">aendern</a></small></td> \t\t<td valign="top">{$status}<br><small><a href="?view=status&id={$id}">aendern</a></small></td> \t\t<td valign="top"><small><a href="?view=comment&id={$id}">...</a> {$comment}</small></td> \t</tr> </table> <br> <form action="?view=comment&id={$id}&doedit=1&ct={$time}" method="post"> <textarea cols="60" rows="15" name="newcomment">{$commentedit}</textarea> <input type="submit" name="Abspeichern" value="Abspeichern"> </form> ECHOENDE; } else { if (!checktime($ct)) { die($timeout); } $newcomment = ereg_replace("\n", "<br>", $newcomment); mysql_query("UPDATE Folgen SET comment='{$newcomment}',Datum='{$time}' WHERE ID='{$id}'"); header("Location: ?view=comment&id={$id}"); } } } } } }