本文整理汇总了PHP中writeToLog函数的典型用法代码示例。如果您正苦于以下问题:PHP writeToLog函数的具体用法?PHP writeToLog怎么用?PHP writeToLog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writeToLog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printFault
/**
* Print SOAP Fault
*/
function printFault($exception, $client)
{
echo '<h2>Fault</h2>' . "<br>\n";
echo "<b>Code:</b>{$exception->faultcode}<br>\n";
echo "<b>String:</b>{$exception->faultstring}<br>\n";
writeToLog($client);
}
示例2: checkHeaders
function checkHeaders()
{
global $response;
if (!function_exists('getallheaders')) {
function getallheaders()
{
while (@ob_end_flush()) {
}
$headers = '';
foreach ($_SERVER as $name => $value) {
if (substr($name, 0, 5) == 'HTTP_') {
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
}
return $headers;
}
}
foreach (getallheaders() as $name => $value) {
writeToLog("{$name}", "{$value}");
$response[$name] = $value;
if (strcasecmp($name, "Content-type") == 0 and strcasecmp($value, "application/json") == 0) {
return true;
}
}
return false;
//return true;
}
示例3: userLogin
function userLogin($username, $password, $log = true)
{
global $USER, $MSG;
if ($username == "") {
array_push($MSG, getstring('warning.login.noemail'));
return false;
}
if ($password == "") {
array_push($MSG, getstring('warning.login.nopassword'));
return false;
}
$USER = new User($username);
$USER->setUsername($username);
$USER->password = $password;
if ($USER instanceof User) {
if ($USER->validPassword($password)) {
$_SESSION["session_username"] = $USER->getUsername();
setcookie("user", $USER->getUsername(), time() + 60 * 60 * 24 * 30, "/");
setLang($USER->getProp('lang'));
if ($log) {
writeToLog('info', 'login', 'user logged in');
}
return true;
} else {
array_push($MSG, getstring('warning.login.invalid'));
writeToLog('info', 'loginfailure', 'username: ' . $username);
unset($USER);
return false;
}
} else {
return false;
}
}
示例4: printFault
/**
* Print SOAP Fault
*/
function printFault($exception, $client)
{
echo '<h2>Fault</h2>' . "<br>\n";
echo "<b>Code:</b>{$exception->faultcode}<br>\n";
echo "<b>String:</b>{$exception->faultstring}<br>\n";
writeToLog($client);
echo '<h2>Request</h2>' . "\n";
echo '<pre>' . htmlspecialchars($client->__getLastRequest()) . '</pre>';
echo "\n";
}
示例5: _mysql_query
function _mysql_query($query, $db)
{
global $CONFIG;
$start = microtime(true);
$result = mysql_query($query, $db);
if (!$result) {
writeToLog('error', 'database', $query);
}
$CONFIG->mysql_queries_time += microtime(true) - $start;
$CONFIG->mysql_queries_count++;
return $result;
}
示例6: addMedia
function addMedia($data)
{
global $kalturaUploadsUser, $kalturaUploadsPassword;
$tags = $data['tags'];
$tags = json_decode($tags, true);
$userID = $tags['userid'];
$serverVersion = $tags['version'];
writeToLog("tags: {$tags}\n");
writeToLog("userID: {$userID}\n");
writeToLog("serverVersion: {$serverVersion}\n");
//writeToLog(print_r($data, true));
// TODO: read this in from a config file
$link = mysql_connect('localhost', $kalturaUploadsUser, $kalturaUploadsPassword);
//if (!$link) die('Not connected : ' . mysql_error());
if (!$link) {
writeToLog('Not connected : ' . mysql_error());
}
if ("clas_demo_server" == $serverVersion) {
$db = "dev_annotation_tool";
} elseif ("clas_prod_server" == $serverVersion) {
$db = "annotation_tool";
} elseif ("clas_prod2_server" == $serverVersion) {
// TODO: switch name when music finishes using OVAL
$db = "prod_annotation_tool";
// ("clas_demo_server" == $tags)
} else {
}
$db_selected = mysql_select_db($db, $link);
//if (!$db_selected) die ("Can't use $db: " . mysql_error(); writeToLog("\nCan't use $db: " . mysql_error()););
writeToLog("u:{$kalturaUploadsUser} p:{$kalturaUploadsPassword}\n");
if (!$db_selected) {
writeToLog("\nCan't use {$db}: " . mysql_error());
}
// get description, it's not available in notification
$kclient = startKalturaSession();
$result = $kclient->media->get($data['entry_id'], null);
$arrayObj = new ArrayObject($result);
$description = $arrayObj['description'];
$duration = $data['length_in_msecs'] / 1000;
$query = "INSERT INTO media VALUES ('{$data['entry_id']}', '{$userID}', '{$data['name']}', '{$description}', {$duration}, '{$data['thumbnail_url']}', 0, 0, NULL)";
writeToLog("insertIntoDatabase() query: {$query}\n");
$result = mysql_query($query, $link);
//if (!$result) die('Invalid query (insertIntoDatabase): ' . mysql_error(); writeToLog("Invalid query"););
if (!$result) {
writeToLog("Invalid query");
}
mysql_close($link);
}
示例7: setLang
function setLang($lang, $redirect = false)
{
global $USER, $API;
$_SESSION["session_lang"] = $lang;
unset($_SESSION["lang_strings"]);
if ($USER->userid != 0) {
$API->setUserProperty($USER->userid, 'lang', $lang);
}
if ($redirect) {
//redirect back to same page (to avoid the form resubmission popup)
$url = "http" . (!empty($_SERVER["HTTPS"]) ? "s" : "") . "://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
writeToLog('info', 'langchange', 'changed to: ' . $lang);
header('Location: ' . $url);
die;
}
}
示例8: writeToLog
$xml = $xml . "<email>" . $reg_mail . "</email>";
$xml = $xml . "</registration>";
echo $xml;
writeToLog("End RegisterUser.\n{$xml}\n\n");
exit;
} else {
// Build XML for a Failure response.
writeToLog("User registration failed. User already exists. Writting failure XML.");
header("Content-type: text/xml");
$xml = "<?xml version='1.0' standalone='yes'?>";
$xml = $xml . "<registration>";
$xml = $xml . "<result>Failure</result>";
$xml = $xml . "<name>" . $reg_user . "</name>";
$xml = $xml . "<reason>User already exists.</reason>";
$xml = $xml . "</registration>";
echo $xml;
writeToLog("End RegisterUser.\n{$xml}\n\n");
exit;
exit;
}
// End response
} else {
// Key compare failed. Redirect to an error page.
setcookie("message", "Missing API private key.", time() + 300, '/');
header('Location: ../error.php');
}
// End key compare.
}
// End post request
setcookie("message", "You can not make requests using a web browser.", time() + 300, '/');
header('Location: ../error.php');
示例9: printStandardReport
function printStandardReport($type, $cl)
{
global $print_results, $log_format, $messages;
if ($print_results) {
print str_replace('%cur_time', date("H:i:s"), $messages[$type][$cl]);
flush();
}
if ($log_format == "html") {
writeToLog(str_replace('%cur_time', date("H:i:s"), $messages[$type][0]));
} else {
writeToLog(str_replace('%cur_time', date("H:i:s"), $messages[$type][1]));
}
}
示例10: sendCurlResponse
if (isset($_GET['good'])) {
$res = sendCurlResponse($_GET['good']);
echo $res;
}
if (isset($_POST['mode']) && $_POST['mode'] == 'log') {
$name = iconv("UTF-8", "Windows-1251", $_POST['good']);
$id = $_POST['id'];
$ip = "unknown";
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
echo writeToLog($name, $id, $ip);
}
function sendCurlResponse_old($id)
{
global $part_id;
$server = "http://p.my-shop.ru/cgi-bin/myorder.pl";
$request = "partner={$part_id}&master=&cart={$id}-1&cartsource=get";
$ch = curl_init($server);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec($ch);
$curl_errno = curl_errno($ch);
示例11: writeToLog
exit;
} else {
// Build XML for a Failure response.
writeToLog("User and password failed. Writting failure XML.");
header("Content-type: text/xml");
$xml = "<?xml version='1.0' standalone='yes'?>";
$xml = $xml . "<authentication>";
$xml = $xml . "<result>Failure</result>";
$xml = $xml . "<id></id>";
$xml = $xml . "<name></name>";
$xml = $xml . "<email></email>";
$xml = $xml . "</authentication>";
echo $xml;
writeToLog("End authentication.\n{$xml}\n\n");
exit;
}
// End response
writeToLog($xml);
} else {
// Key compare failed. Redirect to an error page.
setcookie("message", "Missing API private key.", time() + 300, '/');
header('Location: ../error.php');
}
// End key compare.
}
// End post request
setcookie("message", "An error has occured. All conditionals failed.", time() + 300, '/');
header('Location: ../error.php');
?>
示例12: date
$date = date('Y-m-d H:i:s');
}
writeToLog("info", "tracker", json_encode($tracks), 0, 0, 0, 0, $digest, $date);
$response->result = true;
}
} catch (Exception $e) {
$response->result = false;
}
}
}
}
/*
* Output the response
*/
echo json_encode($response);
writeToLog("info", "pagehit", $_SERVER["REQUEST_URI"] . " method: " . $method);
$API->cleanUpDB();
function curPageURL()
{
$pageURL = 'http';
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
$pageURL .= "s";
}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
}
return $pageURL;
}
示例13: dirname
*/
require_once dirname(__FILE__) . "/includes/global_deploy_config.php";
require_once dirname(__FILE__) . '/includes/kaltura/kaltura_functions.php';
require_once dirname(__FILE__) . "/includes/common.inc.php";
// override max_execution_time for this script because uploads to Kaltura can take a very long time
$max_execution_time = 60 * 60;
set_time_limit($max_execution_time);
writeToLog("\n-------------- Starting clas_dir/upload_to_kaltura.php -----------------\n");
// restrict this script to run from command line only
$sapi_type = php_sapi_name();
if ('cli' != substr($sapi_type, 0, 3)) {
exit;
} else {
}
$title = stripslashes($argv[1]);
$description = stripslashes($argv[2]);
$userID = $argv[3];
$file = $argv[4];
$CopyrightTerm1 = $argv[5];
$CopyrightTerm2 = $argv[6];
$CopyrightTerm3 = $argv[7];
$CopyrightTerm4 = $argv[8];
writeToLog("{$file}: title {$title} -> upload started at " . date("H:i:s") . "\n");
// store custom data in 'tags' field since we aren't using the tags field
$data = "{$serverVersion},{$userID}" . ",{$CopyrightTerm1}" . ",{$CopyrightTerm2}" . ",{$CopyrightTerm3}" . ",{$CopyrightTerm4}" . "";
$fileToUpload = $uploadPath . $file;
writeToLog("calling uploadToKaltura({$fileToUpload}, {$title}, {$description}, {$data})" . "\n");
// die;
$entryID = uploadToKaltura($fileToUpload, $title, $description, $data);
writeToLog("{$file}: title {$title} -> upload finished at " . date("H:i:s") . ", result entry_id {$entryID}\n");
示例14: printWhiteLink
function printWhiteLink($url, $title, $cl)
{
global $db_con, $log_format, $copy, $no_log;
$log_msg_txt = "\n{$url} found. \nTitle ignored, as it did not meet the whitelist.\n";
$log_msg_html = "<br />Link: {$url} detected.<br />Title: {$title}<br /><span class='warnadmin'>Ignored, as the title did not meet the whitelist.</span><br />\n";
if ($no_log == '0') {
if ($cl != 1) {
print $log_msg_html;
} else {
print $log_msg_txt;
}
@ob_flush();
@flush();
}
if ($log_format == "html") {
writeToLog($log_msg_html, $copy);
} else {
writeToLog($log_msg_txt, $copy);
}
}
示例15: printSuccess
$newLocation = $client->__setLocation(setEndpoint('endpoint'));
}
$response = $client->processShipment($request);
// FedEx web service invocation
if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') {
printSuccess($client, $response);
// Create PNG or PDF label
// Set LabelSpecification.ImageType to 'PDF' for generating a PDF label
$fp = fopen(SHIP_LABEL, 'wb');
fwrite($fp, $response->CompletedShipmentDetail->CompletedPackageDetails->Label->Parts->Image);
fclose($fp);
echo 'Label <a href="./' . SHIP_LABEL . '">' . SHIP_LABEL . '</a> was generated.';
} else {
printError($client, $response);
}
writeToLog($client);
// Write to log file
} catch (SoapFault $exception) {
printFault($exception, $client);
}
function addShipper()
{
$shipper = array('Contact' => array('PersonName' => 'ASM Raju', 'CompanyName' => 'ELS', 'PhoneNumber' => '1234567890'), 'Address' => array('StreetLines' => array('Address Line 1'), 'City' => 'Austin', 'StateOrProvinceCode' => 'TX', 'PostalCode' => '73301', 'CountryCode' => 'US'));
return $shipper;
}
function addRecipient()
{
$recipient = array('Contact' => array('PersonName' => 'Rubai Mahbub', 'CompanyName' => 'Entrance', 'PhoneNumber' => '1234567891'), 'Address' => array('StreetLines' => array('Address Line 1'), 'City' => 'Richmond', 'StateOrProvinceCode' => 'BC', 'PostalCode' => 'V7C4V4', 'CountryCode' => 'CA', 'Residential' => false));
return $recipient;
}
function addShippingChargesPayment()