本文整理汇总了PHP中logit函数的典型用法代码示例。如果您正苦于以下问题:PHP logit函数的具体用法?PHP logit怎么用?PHP logit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: startthelog
function startthelog($logname, $quick = FALSE)
{
logit($logname, '-----------------------------------------------------------');
$line = '';
//logit($logname, $_SERVER['HTTP_REFERER']);
if (!$quick) {
// doing the dns lookup takes some extra time so use $quick to speed things up a bid
$line = gethostbyaddr($_SERVER["REMOTE_HOST"]);
if ($line == $_SERVER["REMOTE_ADDR"]) {
$line = '** No DNS entry found for calling IP';
}
$line = ' - ' . $line;
}
logit($logname, $_SERVER["REMOTE_ADDR"] . $line);
if (key_exists('HTTP_USER_AGENT', $_SERVER)) {
logit($logname, $_SERVER['HTTP_USER_AGENT'] . $line);
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (substr(str_replace(chr(10), '', print_r($_POST, true)), 10) == '') {
logit($logname, 'Called as a POST, but NO values were passed in');
} else {
logit($logname, 'POST values: ' . substr(str_replace(chr(10), '', print_r($_POST, true)), 10));
}
}
if ($_SERVER["QUERY_STRING"] != '') {
logit($logname, 'GET param string: ' . $_SERVER["QUERY_STRING"]);
}
}
示例2: SetSessionVals
function SetSessionVals($clientuserrecord, $PDOconn, $logname)
{
$cancontinue = TRUE;
//load client details
$_SESSION['clientdefaults']['clientid'] = $clientuserrecord->clientid;
$theq = 'select * from client where clientid=:clientid';
try {
$pdoquery = $PDOconn->prepare($theq);
$pdoquery->setFetchMode(PDO::FETCH_OBJ);
$pdoquery->execute(array('clientid' => $_SESSION["clientdefaults"]["clientid"]));
$client = $pdoquery->fetch();
} catch (PDOException $e) {
logit($logname, ' **ERROR** on line ' . __LINE__ . ' with query - ' . $theq . ' ' . $e->getMessage());
$cancontinue = FALSE;
}
if ($cancontinue) {
$_SESSION["clientdefaults"]["dbname"] = $client->dbname;
$_SESSION["clientdefaults"]["host"] = $client->host;
$_SESSION["clientdefaults"]["fullname"] = $client->fullname;
$_SESSION["clientdefaults"]["schoollogo"] = $client->schoollogo;
$_SESSION["clientdefaults"]["fedidprefix"] = $client->fedidprefix;
}
if ($cancontinue) {
$cancontinue = GetTheHTMLs($_SESSION["userlanguage"], $_SESSION["clientdefaults"]["clientid"], $PDOconn, $logname);
}
if ($cancontinue) {
header('Location: school.php');
}
return $cancontinue;
}
示例3: call_yql
/**
* Call the Yahoo Contact API
* @param string $consumer_key obtained when you registered your app
* @param string $consumer_secret obtained when you registered your app
* @param string $guid obtained from getacctok
* @param string $access_token obtained from getacctok
* @param string $access_token_secret obtained from getacctok
* @param bool $usePost use HTTP POST instead of GET
* @param bool $passOAuthInHeader pass the OAuth credentials in HTTP header
* @return response string with token or empty array on error
*/
function call_yql($consumer_key, $consumer_secret, $querynum, $access_token, $access_token_secret, $usePost = false, $passOAuthInHeader = true)
{
$retarr = array();
// return value
$response = array();
if ($querynum == 1) {
$url = 'http://query.yahooapis.com/v1/yql';
// Show my profile
$params['q'] = 'select * from social.profile where guid=me';
} elseif ($querynum == 2) {
$url = 'http://query.yahooapis.com/v1/yql';
// Find my friends
$params['q'] = 'select * from social.connections where owner_guid=me';
} else {
// Since this information is public, use the non oauth endpoint 'public'
$url = 'http://query.yahooapis.com/v1/public/yql';
// Find all sushi restaurants in SF order by number of ratings desc
$params['q'] = 'select Title,Address,Rating from local.search where query="sushi" and location="san francisco, ca"|sort(field="Rating.TotalRatings",descending="true")';
}
$params['format'] = 'json';
$params['callback'] = 'cbfunc';
$params['oauth_version'] = '1.0';
$params['oauth_nonce'] = mt_rand();
$params['oauth_timestamp'] = time();
$params['oauth_consumer_key'] = $consumer_key;
$params['oauth_token'] = $access_token;
// compute hmac-sha1 signature and add it to the params list
$params['oauth_signature_method'] = 'HMAC-SHA1';
$params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $access_token_secret);
// Pass OAuth credentials in a separate header or in the query string
if ($passOAuthInHeader) {
$query_parameter_string = oauth_http_build_query($params, true);
$header = build_oauth_header($params, "yahooapis.com");
$headers[] = $header;
} else {
$query_parameter_string = oauth_http_build_query($params);
}
// POST or GET the request
if ($usePost) {
$request_url = $url;
logit("call_yql:INFO:request_url:{$request_url}");
logit("call_yql:INFO:post_body:{$query_parameter_string}");
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$response = do_post($request_url, $query_parameter_string, 80, $headers);
} else {
$request_url = $url . ($query_parameter_string ? '?' . $query_parameter_string : '');
logit("call_yql:INFO:request_url:{$request_url}");
$response = do_get($request_url, 80, $headers);
}
// extract successful response
if (!empty($response)) {
list($info, $header, $body) = $response;
if ($body) {
logit("call_yql:INFO:response:");
print json_pretty_print($body);
}
$retarr = $response;
}
return $retarr;
}
示例4: log_activity
public function log_activity($user_id = null, $activity = '', $module = 'any')
{
if (!is_numeric($user_id) || empty($activity)) {
logit('Not enough information provided to insert activity.');
}
$data = array('user_id' => $user_id, 'activity' => $activity, 'module' => $module);
return parent::insert($data);
}
示例5: update_from_feed
public function update_from_feed()
{
$xpath = "//a[contains(@href, \"mp3\")]";
$url = $this->main_url;
logit("Gathering ... {$url}");
logit("Xpath: {$xpath}");
$feed_contents = $this->read_feed($url);
$doc = new DOMDocument();
@$doc->loadHTML($feed_contents);
$dx = new DOMXPath($doc);
$entries = $dx->query($xpath);
$all_bayans = array();
$count = 0;
foreach ($entries as $entry) {
// if($count++ >= 40) return $all_bayans;
logit("Found: " . htmlentities($doc->saveXML($entry)));
$ps1 = $entry->previousSibling;
$ps2 = $ps1->previousSibling;
$ps3 = $ps2->previousSibling;
$ps4 = $ps3->previousSibling;
$ps5 = $ps4->previousSibling;
$ps6 = $ps5->previousSibling;
/*
logit(" -- ps1: " . htmlentities($doc->saveXML($ps1)));
logit(" -- ps2: " . htmlentities($doc->saveXML($ps2)));
logit(" -- ps3: " . htmlentities($doc->saveXML($ps3)));
logit(" -- ps4: " . htmlentities($doc->saveXML($ps4)));
logit(" -- ps5: " . htmlentities($doc->saveXML($ps5)));
logit(" -- ps6: " . htmlentities($doc->saveXML($ps6)));
*/
$ps4_dt = trim(strip_tags($ps4->nodeValue));
$ps6_dt = trim(strip_tags($ps6->nodeValue));
// check which format we have
if ($this->validate_date($ps4_dt)) {
// older format
$date_str = $this->convert_date($ps4_dt);
$title_str = trim(strip_tags($ps2->nodeValue));
} else {
if ($this->validate_date($ps6_dt)) {
// newer format
$date_str = $this->convert_date($ps6_dt);
$title_str = trim(strip_tags($ps4->nodeValue));
} else {
logit(" =====> ERROR: COULDN'T UNDERSTAND THE FORMAT");
continue;
}
}
$url_str = $this->prefix_to_url . $entry->getAttribute('href');
logit(" --- url: " . $url_str);
logit(" --- date: " . $date_str);
logit(" --- title: " . $title_str);
logit(" ------ ");
$bayan = array('url' => $url_str, 'title' => $title_str, 'uploaded_on' => $date_str);
$all_bayans[] = $bayan;
}
return $all_bayans;
}
示例6: callcontact
/**
* Call the Yahoo Contact API
* @param string $consumer_key obtained when you registered your app
* @param string $consumer_secret obtained when you registered your app
* @param string $guid obtained from getacctok
* @param string $access_token obtained from getacctok
* @param string $access_token_secret obtained from getacctok
* @param bool $usePost use HTTP POST instead of GET
* @param bool $passOAuthInHeader pass the OAuth credentials in HTTP header
* @return response string with token or empty array on error
*/
function callcontact($consumer_key, $consumer_secret, $guid, $access_token, $access_token_secret, $usePost = false, $passOAuthInHeader = true, $_count)
{
$retarr = array();
// return value
$response = array();
$url = 'http://social.yahooapis.com/v1/user/' . $guid . '/contacts?count=' . $_count;
$params['format'] = 'xml';
$params['view'] = 'compact';
$params['oauth_version'] = '1.0';
$params['oauth_nonce'] = mt_rand();
$params['oauth_timestamp'] = time();
$params['oauth_consumer_key'] = $consumer_key;
$params['oauth_token'] = $access_token;
// compute hmac-sha1 signature and add it to the params list
$params['oauth_signature_method'] = 'HMAC-SHA1';
//$params['oauth_signature'] =
// oauth_compute_hmac_sig($usePost? 'POST' : 'GET', $url, $params,
// $consumer_secret, $access_token_secret);
echo ',';
echo $params['oauth_nonce'];
echo ',';
echo $params['oauth_timestamp'];
echo ',';
echo oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $access_token_secret);
exit(0);
// Pass OAuth credentials in a separate header or in the query string
if ($passOAuthInHeader) {
$query_parameter_string = oauth_http_build_query($params, true);
$header = build_oauth_header($params, "yahooapis.com");
$headers[] = $header;
} else {
$query_parameter_string = oauth_http_build_query($params);
}
// POST or GET the request
if ($usePost && 0) {
$request_url = $url;
logit("callcontact:INFO:request_url:{$request_url}");
logit("callcontact:INFO:post_body:{$query_parameter_string}");
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$response = do_post($request_url, $query_parameter_string, 80, $headers);
} else {
$request_url = $url . ($query_parameter_string ? '?' . $query_parameter_string : '');
logit("callcontact:INFO:request_url:{$request_url}");
$response = do_get($request_url, 80, $headers);
}
// extract successful response
if (!empty($response)) {
list($info, $header, $body) = $response;
if ($body) {
logit("callcontact:INFO:response:");
print json_pretty_print($body);
}
$retarr = $response;
}
return $retarr;
}
示例7: activity_list
/**
* Displays the Activities for a module
*
* @param string $module Name of the module
* @param int $limit The number of activities to return
*
* @return string Displays the activities
*/
public function activity_list($module = null, $limit = 25)
{
if (empty($module)) {
logit('No module provided to `activity_list`.');
return;
}
$this->load->helper('date');
$activities = $this->activity_model->order_by('created_on', 'desc')->limit($limit, 0)->find_by_module($module);
$this->load->view('activity_list', array('activities' => $activities));
}
示例8: log_hit
function log_hit($status)
{
global $nolog, $logging;
if (!isset($nolog) && $status != '404') {
if ($logging == 'refer') {
logit('refer', $status);
} elseif ($logging == 'all') {
logit('', $status);
}
}
}
示例9: refresh_access_token
/**
* Refresh an access token using an expired request token
* @param string $consumer_key obtained when you registered your app
* @param string $consumer_secret obtained when you registered your app
* @param string $old_access_token obtained previously
* @param string $old_token_secret obtained previously
* @param string $oauth_session_handle obtained previously
* @param bool $usePost use HTTP POST instead of GET (default false)
* @param bool $useHmacSha1Sig use HMAC-SHA1 signature (default false)
* @return response string with token or empty array on error
*/
function refresh_access_token($consumer_key, $consumer_secret, $old_access_token, $old_token_secret, $oauth_session_handle, $usePost = false, $useHmacSha1Sig = true, $passOAuthInHeader = true)
{
$retarr = array();
// return value
$response = array();
$url = 'https://api.login.yahoo.com/oauth/v2/get_token';
$params['oauth_version'] = '1.0';
$params['oauth_nonce'] = mt_rand();
$params['oauth_timestamp'] = time();
$params['oauth_consumer_key'] = $consumer_key;
$params['oauth_token'] = $old_access_token;
$params['oauth_session_handle'] = $oauth_session_handle;
// compute signature and add it to the params list
if ($useHmacSha1Sig) {
$params['oauth_signature_method'] = 'HMAC-SHA1';
$params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $old_token_secret);
} else {
$params['oauth_signature_method'] = 'PLAINTEXT';
$params['oauth_signature'] = oauth_compute_plaintext_sig($consumer_secret, $old_token_secret);
}
// Pass OAuth credentials in a separate header or in the query string
if ($passOAuthInHeader) {
$query_parameter_string = oauth_http_build_query($params, true);
$header = build_oauth_header($params, "yahooapis.com");
$headers[] = $header;
} else {
$query_parameter_string = oauth_http_build_query($params);
}
// POST or GET the request
if ($usePost) {
$request_url = $url;
logit("refacctok:INFO:request_url:{$request_url}");
logit("refacctok:INFO:post_body:{$query_parameter_string}");
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$response = do_post($request_url, $query_parameter_string, 443, $headers);
} else {
$request_url = $url . ($query_parameter_string ? '?' . $query_parameter_string : '');
logit("refacctok:INFO:request_url:{$request_url}");
$response = do_get($request_url, 443, $headers);
}
// extract successful response
if (!empty($response)) {
list($info, $header, $body) = $response;
$body_parsed = oauth_parse_str($body);
if (!empty($body_parsed)) {
logit("getacctok:INFO:response_body_parsed:");
print_r($body_parsed);
}
$retarr = $response;
$retarr[] = $body_parsed;
}
return $retarr;
}
示例10: log_hit
/**
* Adds a row to the visitor logs.
*
* This function follows the site's logging preferences.
* If $logging preference is set to 'refer', only referrer
* hits are logged. If $logging is set to 'none' or '$nolog'
* global to TRUE, the function will ignore all hits.
*
* If the $status parameter is set to 404, the hit isn't logged.
*
* @param int $status HTTP status code
* @example
* log_hit(200);
*/
function log_hit($status)
{
global $nolog, $logging;
callback_event('log_hit');
if (!isset($nolog) && $status != 404) {
if ($logging == 'refer') {
logit('refer', $status);
} elseif ($logging == 'all') {
logit('', $status);
}
}
}
示例11: write
function write($data, $log = true)
{
global $socket;
if (is_array($data)) {
$line = "PRIVMSG " . $data[0] . " :" . $data[1];
} else {
$line = $data;
}
logit("<<\t" . $line, $log);
if (!fwrite($socket, $line . "\n")) {
die("ERROR socket write\n");
}
}
示例12: get_request_token
function get_request_token($callback = 'oob', $usePost = false, $useHmacSha1Sig = true, $passOAuthInHeader = false)
{
$retarr = array();
// return value
$response = array();
$params['oauth_version'] = '1.0';
$params['oauth_nonce'] = mt_rand();
$params['oauth_timestamp'] = time();
$params['oauth_consumer_key'] = $this->consumer_key;
$params['oauth_callback'] = $callback;
$headers = array();
// compute signature and add it to the params list
if ($useHmacSha1Sig) {
$params['oauth_signature_method'] = 'HMAC-SHA1';
$params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $this->reqUrl, $params, $this->consumer_secret, null);
} else {
$params['oauth_signature_method'] = 'PLAINTEXT';
$params['oauth_signature'] = oauth_compute_plaintext_sig($this->consumer_secret, null);
}
// Pass OAuth credentials in a separate header or in the query string
if ($passOAuthInHeader) {
$query_parameter_string = oauth_http_build_query($params, true);
$header = build_oauth_header($params, "Twitter API");
$headers[] = $header;
} else {
$query_parameter_string = oauth_http_build_query($params);
}
// POST or GET the request
if ($usePost) {
$request_url = $this->reqUrl;
logit("getreqtok:INFO:request_url:{$request_url}");
logit("getreqtok:INFO:post_body:{$query_parameter_string}");
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$response = do_post($request_url, $query_parameter_string, 80, $headers);
} else {
$request_url = $this->reqUrl . ($query_parameter_string ? '?' . $query_parameter_string : '');
logit("getreqtok:INFO:request_url:{$request_url}");
$response = do_get($request_url, 80, $headers);
}
// extract successful response
if (!empty($response)) {
list($info, $header, $body) = $response;
$body_parsed = oauth_parse_str($body);
if (!empty($body_parsed)) {
logit("getreqtok:INFO:response_body_parsed:");
}
$retarr = $response;
$retarr[] = $body_parsed;
}
return $retarr;
}
示例13: yim_checkinfo
function yim_checkinfo($username, $password, $return = array())
{
// Add to refresh token here
//Should check if session is valid
$oauth_data = array_key_exists('oauth_data', $_SESSION) ? $_SESSION['oauth_data'] : array();
$session_data = array_key_exists('session_data', $_SESSION) ? $_SESSION['session_data'] : array();
if (count($oauth_data) <= 0 || count($session_data) <= 0 || !yim_session_is_valid($oauth_data, $session_data)) {
$oauth_data = yim_login($username, $password);
$session_data = yim_create_session();
logit("PHP session active (" . session_id() . "). Created new Yahoo session with id: " . $session_data->sessionId . "\n\n");
} else {
logit("PHP session active (" . session_id() . "). Using Yahoo! session id: " . $session_data->sessionId . "\n\n");
}
return $session_data ? $session_data : false;
}
示例14: find_by_module
public function find_by_module($modules = array())
{
if (empty($modules)) {
logit('No module name given to `find_by_module`.');
return false;
}
if (!is_array($modules)) {
$modules = array($modules);
}
foreach ($modules as $module) {
$this->db->or_where('module', $module);
}
$this->db->select('activity_id, activities.user_id, activity, module, activities.created_on, first_name, last_name, username, email, last_login');
$this->db->join('users', 'activities.user_id = users.id', 'left');
return $this->find_all();
}
示例15: updatesysdef
function updatesysdef($key, $value, $dbconn, $logname)
{
try {
$theq = " delete from sysdef.system_defaults where sd_item=:key";
$pdoquery = $dbconn->prepare($theq);
$pdoquery->execute(array(":key" => $key));
$theq = " insert into sysdef.system_defaults (sd_value,sd_item)";
$theq .= " values (:value,:key)";
$pdoquery = $dbconn->prepare($theq);
$pdoquery->execute(array(":key" => $key, ":value" => $value));
} catch (PDOException $e) {
logit($logname, ' **ERROR** on line ' . __LINE__ . ' with query - ' . $theq . ' ' . $e->getMessage());
$results->errortext = $e->getMessage();
$cancontinue = FALSE;
}
}