本文整理汇总了PHP中writelog函数的典型用法代码示例。如果您正苦于以下问题:PHP writelog函数的具体用法?PHP writelog怎么用?PHP writelog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writelog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: judge
function judge($task)
{
writelog($task);
$path = Config::getInstance()->getVar('path');
$original_cd = getcwd();
chdir($path['task'] . $task['task_name']);
$judge = new Judge($task['task_name'], $task['prob_name'], $task['source_file'], $task['language'], $task['return_url'], $task['public_key']);
try {
$result = $judge->compile();
if ($result == 0) {
$info = $judge->run();
if (!is_array($info)) {
writelog('ERROR: ' . $info);
switch ($info) {
case 'testdata':
case 'checker':
default:
//Run failed
$info = array('fatal' => Judge::RESULT_EXECUTOR_ERROR, 'time' => 0, 'memory' => 0, 'score' => 0.0);
}
}
} else {
//Compile failed
$info = array('fatal' => Judge::RESULT_COMILATION_ERROR, 'time' => 0, 'memory' => 0, 'score' => 0.0);
}
$judge->complete($info);
} catch (Exception $e) {
writelog("Stopped");
}
$judge->clear();
chdir($original_cd);
}
示例2: get_nulagoon_btc_nbt
function get_nulagoon_btc_nbt($search_tolerance, $btc_usd)
{
$url_wall = 'https://bitbucket.org/henry_nu/data/downloads/datetu.json';
$content_wall = file_get_contents($url_wall);
$wall_json = json_decode($content_wall, true);
$url_price = 'https://bitbucket.org/henry_nu/data/downloads/rd.json';
$content_price = file_get_contents($url_price);
$price_json = json_decode($content_price, true);
$ask_total = 0;
$bid_total = 0;
if (!check_value($wall_json["bal"]["NBT"]) && !check_value($price_json["ask"])) {
writelog("nulagoon_btc_nbt", "querry_error", "unresolved");
} else {
$tolerance = $btc_usd * $search_tolerance / 100;
$ask_price = $btc_usd + $tolerance;
$bid_price = $btc_usd - $tolerance;
$ask_value = $wall_json["bal"]["NBT"];
$bid_value = $wall_json["bal"]["BTC"] * $btc_usd;
$wall_price_ask = $price_json["ask"];
$wall_price_bid = $price_json["bid"];
if ($wall_price_ask <= $ask_price) {
$ask_total = $ask_value;
}
if ($wall_price_bid >= $bid_price) {
$bid_total = $bid_value;
}
}
$total = $ask_total + $bid_total;
$orderbook = array('tolerance' => $search_tolerance, 'ask_total' => $ask_total, 'bid_total' => $bid_total, 'total' => $total);
return $orderbook;
}
示例3: logErrorHandler
function logErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
{
writelog('Error No: ' . $errno);
writelog('Error String: ' . $errstr);
writelog('Error File: ' . $errfile);
writelog('Error Line: ' . $errline);
return false;
}
示例4: error
function error($message, $line, $save) //ToDo: $save=1 => error-saving
{
writelog('error', $message.' in Zeile '.$line);
if(!$save)
{
echo $message." in Zeile <b>".$line."</b><br>";
}
}
示例5: creatlink
function creatlink($src, $dest)
{
if (is_link($dest)) {
unlink($dest);
}
if (symlink($src, $dest) === false) {
writelog('Symbol link failed to create from ' . $src . ' to ' . $dest);
}
}
示例6: errorlog
function errorlog($type, $message, $halt = 1)
{
global $_G;
$user = empty($_G['member']['username']) ? '' : $_G['member']['username'] . '<br />';
$user .= $_G['clientip'] . '|' . $_SERVER['REMOTE_ADDR'];
writelog('errorlog', htmlspecialchars(TIMESTAMP . "\t{$type}\t{$user}\t" . str_replace(array("\r", "\n"), array(' ', ' '), trim($message))));
if ($halt) {
exit;
}
}
示例7: getUserHash
function getUserHash($username)
{
$queryStr = "select user_hash from users where user_name = '{$username}'";
$user = $this->query($queryStr);
writelog($queryStr);
if ($user->num_rows > 0) {
$row = $user->fetch_row();
return $row[0];
} else {
return null;
}
}
示例8: checkmailvalid
function checkmailvalid($to, $title, $body)
{
$a = checkuser();
$username = $a[0];
if ($username == "") {
echo '-15';
exit;
}
$time = time();
date_default_timezone_set('Asia/Shanghai');
writelog("[" . date("r", $time) . "][E-mail send to {$to} from {$username}] [Title: {$title}] {$body}\n");
}
示例9: sendBack
private function sendBack($post_result)
{
if ($this->checkStop()) {
throw new Exception('stop');
}
$return_url = $this->return_url;
$public_key = $this->public_key;
writelog('Sending back to ' . $return_url);
writelog($post_result);
$client = new BFL_RemoteAccess_Client($return_url, $public_key, 0);
$client->writeRecord($post_result);
}
示例10: move_file
/**
* Funktion verschriebt Dateien in in eine geparste Ordnerhierarchie
*
* @author Jens Kohl <jens.kohl@gmail.com>
* @param string Dateiname
* @param string Verzeichnisname
* @return string Statusnachricht
*/
function move_file($in_file, $dir)
{
if (preg_match('/(.*?)(S(\\d{1,2})E(\\d{1,2})|(\\d{1,2})x(\\d{1,2})).*?\\.(avi|divx|mkv|mov|wmv)$/i', $in_file, $treffer)) {
//var_dump($treffer);
global $config, $microbloging;
$title = $treffer[1];
$title = preg_replace('/(\\.|-|_)/i', ' ', $title);
$title = ucwords(trim($title));
$season = $treffer[3] ? (int) $treffer[3] : (int) $treffer[5];
$episode = $treffer[4] ? (int) $treffer[4] : (int) $treffer[6];
$extension = $treffer[7];
if (RENAME_DIVX && preg_match('/xvid/i', $in_file)) {
$extension = 'divx';
}
$moved = false;
$filesize = filesize($dir . '/' . $in_file);
foreach ($config->sorter->destination->directory as $thisDest) {
if (disk_free_space($thisDest) < $filesize) {
# Ziellaufwerk zu klein
writelog($thisDest . ' verfügt nicht über genügend Platz für ' . $in_file, WARN);
} else {
# Make the directory
if (!file_exists($thisDest . '/' . $title . '/Season ' . $season)) {
if (!file_exists($thisDest . '/' . $title)) {
mkdir($thisDest . '/' . $title);
}
mkdir($thisDest . '/' . $title . '/Season ' . $season);
}
$new_file = $thisDest . '/' . $title . "/Season " . $season . "/" . sprintf("%02dx%02d", $season, $episode) . " - {$title}.{$extension}";
rename($dir . '/' . $in_file, $new_file);
writelog("{$title} {$season} x {$episode} nach {$thisDest} verschoben.", INFO);
$moved = true;
if (LOGGING) {
// Logfile schreiben
global $SDorHD;
$logfile = $config->sorter->destination->directory[0] . "/moviesorter.log";
if ($extension == 'mkv') {
$SDorHD = ' HD';
}
$logline = '[' . strftime("%Y-%m-%d %H:%M") . "] {$title} ({$season}x{$episode}){$SDorHD}\n";
file_put_contents($logfile, $logline, FILE_APPEND | FILE_TEXT);
}
$microbloging->send($title . ' S' . sprintf('%02d', $season) . 'E' . sprintf('%02d', $episode) . $SDorHD . ' fertig heruntergeladen. #tvdl');
return "Moved {$title} ({$season} x {$episode})\n";
}
if (!$moved) {
writelog('Kein Platz für ' . $in_file . " vorhanden.", FAIL);
}
}
}
}
示例11: w_rlog
function w_rlog($string, $t = 'day')
{
if (is_array($string)) {
$string = json_encode($string);
}
$timestamp = time();
if ($t == 'day') {
$f = date('Ymd', $timestamp);
$filename = DATAPATH . 'log/wlog/' . $f . '.log';
}
$logtime = date('Y/m/d H:i:s', $timestamp);
$record = $logtime . ' - ' . $string . "\n";
writelog($filename, $record, 'ab');
}
示例12: getAllMedias
public function getAllMedias()
{
header('Content-type:text/json');
$page = empty($_POST['page']) ? 0 : intval(trim(strip_tags($_POST['page'])));
$pageSize = empty($_POST['pageSize']) ? 20 : intval(trim(strip_tags($_POST['pageSize'])));
$logStr = "page : " . $_POST['page'] . "\r\n";
$logStr .= "page2 : " . $page . "\r\n";
$logStr .= "pageSize : " . $_POST['pageSize'] . "\r\n";
$logStr .= "pageSize2 : " . $pageSize . "\r\n";
$logStr .= "version : " . $_POST['version'] . "\r\n";
writelog($logStr);
$json = array('medias' => getAllMedias($page, "", "", $pageSize));
echo proverb_encode($json);
}
示例13: rplog
function rplog($data, $redata, $sec, $t = 'day')
{
$timestamp = time();
if ($t == 'day') {
$f = date('Ymd', $timestamp);
$filename = BASEDIRS . 'data/rplogs/rplog' . $f . '.php';
} elseif ($t == 'month') {
$f = date('Ym', $timestamp);
$filename = BASEDIRS . 'data/rplogs/rplog' . $f . '.php';
}
$logtime = date('Y-m-d H:i:s', $timestamp);
$reqdata = $data['commandInfo'] ? json_encode($data['commandInfo']) : 'null';
$redata = $redata ? json_encode($redata) : 'null';
$record = "<?die;?> {$logtime} - {$data['command']} - {$reqdata} - {$sec} - {$redata}\n";
writelog($filename, $record, 'ab');
}
示例14: login
public function login()
{
global $_G;
$validate_error = array();
//数据验证
$validate_error_rules = $this->rules();
if ($validate_error_rules !== true) {
return $validate_error_rules;
}
require_once libfile('function/member');
$input_email = $_POST['email'];
$input_password = $_POST['password'];
$input_rememberme = $_POST['rememberme'];
if (!($_G['member_loginperm'] = logincheck($input_email))) {
$validate_error['password'] = '密码错误次数过多,请 15 分钟后重新登录';
return $validate_error;
}
$result = userlogin($input_email, $input_password, 0, 0, 'email', $_G['clientip']);
if ($result['status'] <= 0) {
$password = preg_replace("/^(.{" . round(strlen($input_password) / 4) . "})(.+?)(.{" . round(strlen($input_password) / 6) . "})\$/s", "\\1***\\3", $input_password);
$errorlog = dhtmlspecialchars(TIMESTAMP . "\t" . ($result['ucresult']['username'] ? $result['ucresult']['username'] : $input_email) . "\t" . $password . "\t" . "Ques #" . intval($_GET['questionid']) . "\t" . $_G['clientip']);
writelog('illegallog', $errorlog);
loginfailed($input_email);
failedip();
if ($_G['member_loginperm'] > 1) {
$loginperm = $_G['member_loginperm'] - 1;
$validate_error['password'] = '密码错误,您还可以尝试 ' . $loginperm . ' 次';
return $validate_error;
} elseif ($_G['member_loginperm'] == -1) {
$validate_error['password'] = '抱歉,您输入的密码有误';
return $validate_error;
} else {
$validate_error['password'] = '密码错误次数过多,请 15 分钟后重新登录';
return $validate_error;
}
} else {
setloginstatus($result['member'], $_GET['rememberme'] ? 2592000 : 0);
//是否记住密码,自动登录
if ($_G['member']['lastip'] && $_G['member']['lastvisit']) {
dsetcookie('lip', $_G['member']['lastip'] . ',' . $_G['member']['lastvisit']);
}
C::t('common_member_status')->update($_G['uid'], array('lastip' => $_G['clientip'], 'port' => $_G['remoteport'], 'lastvisit' => TIMESTAMP, 'lastactivity' => TIMESTAMP));
$ucsynlogin = $this->setting['allowsynlogin'] ? uc_user_synlogin($_G['uid']) : '';
//是否Ucenter同步登录
return true;
}
}
示例15: db_open
function db_open()
{
//$dbase = mysqli_connect (DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME);
$dbconn = mysql_pconnect(DB_SERVER, DB_USER, DB_PASSWORD);
if ($dbconn === FALSE) {
require_once 'mod_file.php';
writelog('error.log', "Connect failed : dbconn === FALSE ( " . mysql_error() . " )");
return null;
}
$dbase = mysql_select_db(DB_NAME);
if ($dbase === FALSE) {
require_once 'mod_file.php';
writelog('error.log', "Select DB failed : dbase === FALSE");
return null;
}
return $dbconn;
}