本文整理汇总了PHP中getTimeStamp函数的典型用法代码示例。如果您正苦于以下问题:PHP getTimeStamp函数的具体用法?PHP getTimeStamp怎么用?PHP getTimeStamp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getTimeStamp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: finishAuth
public static function finishAuth()
{
Social_Client::init();
$network_name = trim(strip_tags(Social_Client::$request["sa_login_finish"]));
$network = Social_Auth::prepare($network_name);
if (!$network) {
Social_Logger::error("Invalid parameter given on sa_login_finish");
$network->adapter->disconnectUser();
header("HTTP/1.0 404 Not Found");
die("Invalid parameter given on sa_login_finish. Try login again");
}
try {
Social_Logger::info("Login finish: {$network_name}");
$network->adapter->finishLogin();
$user_profile = $network->adapter->getUserProfile();
if ($network_name == 'facebook') {
$user_profile->photoURL = $user_profile->photoURL . '&ts=' . getTimeStamp();
}
$user_profile->network_name = $network_name;
$userid = socialLogin($user_profile);
Social_Auth::session()->set("SA_USER", $user_profile);
} catch (Exception $e) {
$network->adapter->disconnectUser();
}
Social_Logger::info("Returned to callback");
$network->goToCallbackPage();
die;
}
示例2: formatMessage
private function formatMessage($level, $msgFormat, $params = null)
{
$message = "[";
switch ($level) {
case self::LOG_DEBUG:
$message .= 'debug';
break;
case self::LOG_INFO:
$message .= 'info';
break;
case self::LOG_ERROR:
$message .= 'error';
break;
case self::LOG_FATAL:
$message .= 'fatal';
break;
default:
return '';
}
$parts = explode(' ', microtime());
$message .= '][' . getTimeStamp() . "-" . floatval($parts[0]) * 100000000 . '] ';
if (is_array($params)) {
$message .= vsprintf($msgFormat, $params);
} elseif (!is_null($params)) {
$message .= sprintf($msgFormat, $params);
} else {
$message .= $msgFormat;
}
return $message;
}
示例3: chatroomsusers
function chatroomsusers()
{
$sql = "delete from cometchat_chatrooms_users where lastactivity < (" . getTimeStamp() . "-3600)";
$query = mysqli_query($GLOBALS['dbh'], $sql);
if (defined('DEV_MODE') && DEV_MODE == '1') {
echo mysqli_error($GLOBALS['dbh']);
}
}
示例4: clearGuestEntries
function clearGuestEntries()
{
$sql = "delete from cometchat_guests where id in (select userid from cometchat_status where (" . mysqli_real_escape_string($GLOBALS['dbh'], getTimeStamp()) . "-cometchat_status.lastactivity)>10800)";
$query = mysqli_query($GLOBALS['dbh'], $sql);
if (defined('DEV_MODE') && DEV_MODE == '1') {
echo mysqli_error($GLOBALS['dbh']);
}
}
示例5: onlineusers
function onlineusers()
{
global $db;
$sql = "select count(distinct(cometchat.from)) users from cometchat where ('" . mysqli_real_escape_string($GLOBALS['dbh'], getTimeStamp()) . "'-cometchat.sent)<300";
$query = mysqli_query($GLOBALS['dbh'], $sql);
$chat = mysqli_fetch_assoc($query);
return $chat['users'];
}
示例6: chatroomsusers
function chatroomsusers()
{
$sql = "delete from cometchat_chatrooms_users where (" . getTimeStamp() . "-lastactivity)>3600";
$query = mysql_query($sql);
if (defined('DEV_MODE') && DEV_MODE == '1') {
echo mysql_error();
}
echo "All inactive chatroom users have been deleted.<br />";
}
示例7: getDBDateValue
/**
* Get db prepared dateTime value
* @param String textValue
* @param String dateFormat
* @return String
*/
function getDBDateValue($textValue, $dateFormat)
{
if (!$textValue) {
return NULL;
}
$timeStamp = getTimeStamp($textValue, $dateFormat);
if ($timeStamp === FALSE) {
return NULL;
}
$time = localtime($timeStamp, true);
return $time["tm_year"] + 1900 . "-" . ($time["tm_mon"] + 1) . "-" . $time["tm_mday"] . " " . $time["tm_hour"] . ":" . $time["tm_min"] . ":" . $time["tm_sec"];
}
示例8: publish
function publish($args)
{
if (!($args['channel'] && $args['message'])) {
echo 'Missing Channel or Message';
return false;
}
$channel = $args['channel'];
$message = json_encode($args['message']);
$sql = "insert into cometchat_comethistory (channel,message,sent) values ( '" . mysqli_real_escape_string($GLOBALS['dbh'], $channel) . "', '" . mysqli_real_escape_string($GLOBALS['dbh'], serialize($args['message'])) . "','" . getTimeStamp() . "')";
mysqli_query($GLOBALS['dbh'], $sql);
$string_to_sign = implode('/', array($this->PUBLISH_KEY, $this->SUBSCRIBE_KEY, $this->SECRET_KEY, $channel, $message));
$signature = $this->SECRET_KEY ? md5($string_to_sign) : '0';
if (strlen($message) > $this->LIMIT) {
echo 'Message TOO LONG (' . $this->LIMIT . ' LIMIT)';
return array(0, 'Message Too Long.');
}
return $this->_request(array('publish', $this->PUBLISH_KEY, $this->SUBSCRIBE_KEY, $signature, $channel, '0', $message));
}
示例9: isSubscriber
/**
* 查询用户是否订阅,订阅是否过期。
* @param $appInstanceId 用户订阅的app实例id
*
* @return
* 1. 用户没有订阅,返回false
* 2. 用户已订阅,但是已过期,返回订阅结束的时间
* 3. 用户已订阅,并且没有过期,返回true
*
*/
public static function isSubscriber($appInstanceId)
{
$sip_sessionid = session_id();
$result = RESTRequestHelper::postRequest('alisoft.getSubscCtrl', array('appInstanceId' => $appInstanceId), $sip_sessionid);
writeDebug("getSubscCtrl of appInstance {$appInstanceId} result:" . $result);
if ($result == null || strlen($result) < 1) {
return false;
}
$xml = new SimpleXMLElement($result);
$endDate = $xml->gmtEnd;
writeDebug('End date of subscribe:' . $endDate);
$endDate = substr($endDate, 0, 10);
$currentDate = getTimeStamp('Y-m-d');
if ($endDate <= $currentDate) {
return $endDate;
}
return true;
}
示例10: finishAuth
public static function finishAuth()
{
Social_Client::init();
$network_name = trim(strip_tags(Social_Client::$request["sa_login_finish"]));
$network = Social_Auth::prepare($network_name);
if (!$network) {
Social_Logger::error("Invalid parameter given on sa_login_finish");
$network->adapter->disconnectUser();
header("HTTP/1.0 404 Not Found");
die("Invalid parameter given on sa_login_finish. Try login again");
}
try {
Social_Logger::info("Login finish: {$network_name}");
$network->adapter->finishLogin();
$user_profile = $network->adapter->getUserProfile();
if ($network_name == 'facebook') {
$user_profile->photoURL = $user_profile->photoURL . '&ts=' . getTimeStamp();
}
$sql = "select " . DB_USERTABLE . "." . DB_USERTABLE_USERID . " from " . DB_USERTABLE . " where " . DB_USERTABLE . "." . DB_USERTABLE_USERNAME . " = '" . mysqli_real_escape_string($GLOBALS['dbh'], $network_name) . "_" . mysqli_real_escape_string($GLOBALS['dbh'], $user_profile->identifier) . "'";
$result = mysqli_query($GLOBALS['dbh'], $sql);
if ($row = mysqli_fetch_assoc($result)) {
$sql = "update " . DB_USERTABLE . " set " . DB_USERTABLE . "." . DB_USERTABLE_NAME . "='" . mysqli_real_escape_string($GLOBALS['dbh'], $user_profile->firstName) . "'," . DB_AVATARFIELD . "='" . mysqli_real_escape_string($GLOBALS['dbh'], $user_profile->photoURL) . "'," . DB_USERTABLE . "." . DB_LINKFIELD . "='" . mysqli_real_escape_string($GLOBALS['dbh'], $user_profile->profileURL) . "' where " . DB_USERTABLE . "." . DB_USERTABLE_USERNAME . "='" . mysqli_real_escape_string($GLOBALS['dbh'], $network_name) . "_" . mysqli_real_escape_string($GLOBALS['dbh'], $user_profile->identifier) . "'";
mysqli_query($GLOBALS['dbh'], $sql);
if (!empty($row[DB_USERTABLE_USERID])) {
$userid = $row[DB_USERTABLE_USERID];
}
} else {
$sql = "insert into " . DB_USERTABLE . " (" . DB_USERTABLE . "." . DB_USERTABLE_USERNAME . "," . DB_USERTABLE . "." . DB_USERTABLE_NAME . "," . DB_AVATARFIELD . "," . DB_USERTABLE . "." . DB_LINKFIELD . "," . DB_USERTABLE . "." . DB_GROUPFIELD . ") values ( '" . mysqli_real_escape_string($GLOBALS['dbh'], $network_name) . "_" . mysqli_real_escape_string($GLOBALS['dbh'], $user_profile->identifier) . "','" . mysqli_real_escape_string($GLOBALS['dbh'], $user_profile->firstName) . "','" . mysqli_real_escape_string($GLOBALS['dbh'], $user_profile->photoURL) . "','" . mysqli_real_escape_string($GLOBALS['dbh'], $user_profile->profileURL) . "','" . mysqli_real_escape_string($GLOBALS['dbh'], ucfirst($network_name)) . "')";
mysqli_query($GLOBALS['dbh'], $sql);
$userid = mysqli_insert_id($GLOBALS['dbh']);
}
$_SESSION['cometchat']['userid'] = $userid;
$_SESSION['cometchat']['ccauth'] = '1';
Social_Auth::session()->set("SA_USER", $user_profile);
} catch (Exception $e) {
$network->adapter->disconnectUser();
}
Social_Logger::info("Returned to callback");
$network->goToCallbackPage();
die;
}
示例11: postRequest
/**
* 向阿里REST服务器发送调用请求。
*
* @param string $apiname api名字
* @param string $appInstanceId 用户订购的appid
* @param string $userId 用户id
* @param string $token 阿里平台产生的请求token
* @param string $sip_sessionid 用户的session id
* @param string $sip_format 请求结果格式,xml或者json,默认xml。
* @param string $otherParams 其他附加的参数。
* @return string 请求结果字符串。
*/
public static function postRequest($apiname, $appParams = null, $sip_sessionid = null, $sip_format = null)
{
//准备本次请求参数
$timestamp = getTimeStamp();
/* REST request url. Use snoopy to submit a request
$url = $this->SIP_URL_PRE."?sip_timestamp=".date("Y-m-d H:i:s")
.'&sip_appkey='.$this->APP_ID.'&appId='.$this->APP_ID.'&sip_sign='.$sip_sign.
'&token='.$token.'&appInstanceId='.$appInstanceId
.'&userId='.$userId.'&sip_apiname=alisoft.validateUser'.'&sip_sessionid='.$sip_sessionid;
*/
$formVars['sip_appkey'] = APP_ID;
$formVars['sip_apiname'] = $apiname;
$formVars['sip_timestamp'] = $timestamp;
$formVars['appId'] = APP_ID;
if (isset($sip_sessionid)) {
$formVars['sip_sessionid'] = $sip_sessionid;
}
if (isset($sip_format)) {
$formVars['sip_format'] = $sip_format;
}
if (isset($appParams) && is_array($appParams)) {
$formVars = array_merge($formVars, $appParams);
//writeDebug('form var before encode:' . print_r($formVars,true));
//$encodeParams = self::encodeParams($appParams);
}
// 生成签名
$sip_sign = SignGenerator::generateSign($formVars);
$formVars['sip_sign'] = $sip_sign;
//$formVars = array_merge($formVars,$encodeParams);
writeDebug(sprintf("API: %s\nParams: %s", $apiname, print_r($formVars, true)));
$proxy = new Snoopy();
//$proxy->set_submit_multipart();
//向AEP发出服务端请求
$proxy->submit(SIP_REST_URI, $formVars);
WriteDebug("http header:" . print_r($proxy->headers, true));
self::handleError($proxy->headers);
// 返回请求结果
return $proxy->results;
}
示例12: getGuestID
function getGuestID()
{
$_SESSION['guestMode'] = 1;
global $cookiePrefix;
$userid = 0;
if (!empty($_COOKIE[$cookiePrefix . 'guest'])) {
$checkId = base64_decode($_COOKIE[$cookiePrefix . 'guest']);
$sql = "select id from cometchat_guests where id = '" . mysqli_real_escape_string($GLOBALS['dbh'], $checkId) . "'";
$query = mysqli_query($GLOBALS['dbh'], $sql);
$result = mysqli_fetch_assoc($query);
if (!empty($result['id'])) {
$userid = $result['id'];
}
}
if (empty($userid)) {
$random = rand(10000, 99999);
$sql = "insert into cometchat_guests (name,lastactivity) values ('" . mysqli_real_escape_string($GLOBALS['dbh'], $random) . "','" . mysqli_real_escape_string($GLOBALS['dbh'], getTimeStamp()) . "')";
$query = mysqli_query($GLOBALS['dbh'], $sql);
$userid = mysqli_insert_id($GLOBALS['dbh']);
setcookie($cookiePrefix . 'guest', base64_encode($userid), time() + 3600 * 24 * 365, "/");
}
return $userid;
}
示例13: updateGuestLastActivity
function updateGuestLastActivity($userid)
{
$sql = "update `cometchat_guests` set lastactivity = '" . getTimeStamp() . "' where id = '" . mysql_real_escape_string($userid) . "'";
return $sql;
}
示例14: md5
<ul class="games">
\t{$games_language[13]}
</ul>
<div style="clear:both"></div>
</div>
</div>
</div>
</body>
</html>
EOD;
} else {
if ($_GET['action'] == 'request') {
$random_from = md5(getTimeStamp() + $userid + 'from');
$random_to = md5(getTimeStamp() + intval($_GET['toId']) + 'to');
$random_order = $random_from . ',' . $random_to;
$toId = intval($_GET['toId']);
$baseData = $_REQUEST['basedata'];
$embed = '';
$embedcss = '';
$close = "setTimeout('window.close()',2000);";
if (!empty($_GET['embed']) && $_GET['embed'] == 'web') {
$embed = 'web';
$embedcss = 'embed';
$close = "parent.closeCCPopup('games_init');";
}
if (!empty($_GET['embed']) && $_GET['embed'] == 'desktop') {
$embed = 'desktop';
$embedcss = 'embed';
$close = "parentSandboxBridge.closeCCPopup('games_init');";
示例15: updateLastActivity
function updateLastActivity($userid)
{
$sql = "update `" . TABLE_PREFIX . DB_USERTABLE . "` set " . DB_USERTABLE_LASTACTIVITY . " = '" . getTimeStamp() . "' where " . DB_USERTABLE_USERID . " = '" . mysql_real_escape_string($userid) . "'";
return $sql;
}