本文整理汇总了PHP中get_time函数的典型用法代码示例。如果您正苦于以下问题:PHP get_time函数的具体用法?PHP get_time怎么用?PHP get_time使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_time函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: pagination
/**
*
* @param string $where
* @return array 返回数据库查询后的数组:
*/
function pagination($where, $conn, $tbl_name)
{
require_once 'class/Config_commodity.php';
require_once 'class/DBpagination.php';
require_once 'class/DBcount.php';
require_once 'class/Info_user.php';
require_once 'class/Config_user.php';
require_once 'Include_picture.php';
//2.向数据库查询符合条件数,以计算显示分页数目
$dbcount = new DBcount($tbl_name, $where);
$retval = $dbcount->excute($conn);
$row = mysqli_fetch_array($retval, MYSQLI_NUM);
$count = 1 + (int) (($row ? $row[0] : 0) / SIZE_EACH_PAGE);
//3.计算当前页码;
$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
$page = $page > $count ? $count : $page;
//4. 查询当前页的数据
$choosed_fields = array(Config_commodity::table_name . '.' . Config_commodity::description, Config_commodity::table_name . '.' . Config_commodity::id, Config_commodity::table_name . '.' . Config_commodity::publisher, Config_commodity::table_name . '.' . Config_commodity::title, Config_commodity::table_name . '.' . Config_commodity::price, Config_commodity::table_name . '.' . Config_commodity::release_date, Config_commodity::table_name . '.' . Config_commodity::praise, Config_commodity::table_name . '.' . Config_commodity::leave_message_time, Config_commodity::table_name . '.' . Config_commodity::id);
$DBpagination = new DBpagination($tbl_name, $where, $page, SIZE_EACH_PAGE, $choosed_fields);
$reval = $DBpagination->excute($conn);
//逐个配置 array 三级关联数组 供界面使用
$array = array();
while (($temp_database_row_array = mysqli_fetch_array($reval, MYSQLI_ASSOC)) != null) {
$userinfo = Info_user::get_user_info_by_id($conn, $temp_database_row_array[Config_commodity::publisher]);
$array[] = array('imgs' => get_commodity_pic($conn, $temp_database_row_array[Config_commodity::id]), 'description' => $temp_database_row_array[Config_commodity::description], 'title' => $temp_database_row_array[Config_commodity::title], 'price' => $temp_database_row_array[Config_commodity::price], 'url' => 'upload/default.jpg', 'name' => $userinfo[Config_user::log_name], 'time' => get_time($temp_database_row_array[Config_commodity::release_date]), 'star_numbers' => $temp_database_row_array[Config_commodity::praise], 'message_numbers' => $temp_database_row_array[Config_commodity::leave_message_time], 'id' => $temp_database_row_array[Config_commodity::id]);
}
//5.释放资源
mysqli_free_result($reval);
return array('page' => $page, 'array' => $array);
}
开发者ID:DaiDanRui,项目名称:LinHang,代码行数:35,代码来源:Include_commodity_browse.php
示例2: check_access_ip
public static function check_access_ip()
{
$blocked_time = db::scalar(self::Q_GET_IP, array('%ip' => ip2long(get_ip())));
if ($blocked_time > get_time()) {
throw new Exception_wx(4030003, get_ip());
}
}
开发者ID:viking2000,项目名称:web-antarix,代码行数:7,代码来源:security.php
示例3: record
function record($start_date, $end_date)
{
global $useradmin;
$start = new DateTime($start_date);
$end = new DateTime($end_date);
$end = $end->modify('+1 day');
$interval = new DateInterval('P1D');
$period = new DatePeriod($start, $interval, $end);
//var_dump($period);
foreach ($period as $date) {
$index_date = $date->format('Y-m-d');
//echo $index_date;
$unique_visitors = get_unique_visits($index_date);
$visits = get_visits($index_date);
$time = get_time($index_date);
echo "<br/><br/>" . $index_date . "<br/><br/>";
echo "unique visitors:" . $unique_visitors . "<br/>";
echo "visits:" . $visits . "<br/>";
echo "total time:" . $time . "<br/>";
$selectSQL = "SELECT * FROM visitor_daily_report WHERE report_date='" . $index_date . "'";
if ($row_record = mysql_fetch_assoc(mysql_query_or_die($selectSQL, $useradmin))) {
echo "<br/>record already in database!<br/>";
} else {
echo "<br/>inserting new record into database!<br/>";
$insertSQL = sprintf("INSERT INTO visitor_daily_report (report_date, visits, unique_visitors, total_time) VALUES(%s, %s, %s, %s)", GetSQLValueString($index_date, "date"), GetSQLValueString($visits, "int"), GetSQLValueString($unique_visitors, "int"), GetSQLValueString($time, "int"));
$result = mysql_query_or_die($insertSQL, $useradmin);
}
}
}
开发者ID:omusico,项目名称:home365,代码行数:29,代码来源:report.php
示例4: JKY_generate_purchase
/**
* generate Purchase
*
* @param int purchase_id
* @return int count of Incomings generated
*/
function JKY_generate_purchase($the_id)
{
$db = Zend_Registry::get('db');
$sql = 'SELECT *' . ' FROM Purchases' . ' WHERE id = ' . $the_id;
$my_purchase = $db->fetchRow($sql);
$sql = 'SELECT *' . ' FROM PurchaseLines' . ' WHERE parent_id = ' . $the_id;
$my_rows = $db->fetchAll($sql);
$my_count = 0;
foreach ($my_rows as $my_row) {
$my_incoming_id = get_next_id('Incomings');
$sql = 'INSERT Incomings' . ' SET id = ' . $my_incoming_id . ', updated_by = ' . get_session('user_id') . ', updated_at ="' . get_time() . '"' . ', incoming_number = ' . $my_incoming_id . ', supplier_id = ' . $my_purchase['supplier_id'] . ', invoice_date ="' . $my_row['expected_date'] . '"' . ', invoice_weight = ' . $my_row['expected_weight'];
log_sql('Incomings', 'INSERT', $sql);
$db->query($sql);
insert_changes($db, 'Incomings', $my_incoming_id);
$my_batchin_id = get_next_id('Batches');
$sql = 'INSERT Batches' . ' SET id = ' . $my_batchin_id . ', updated_by = ' . get_session('user_id') . ', updated_at ="' . get_time() . '"' . ', incoming_id = ' . $my_incoming_id . ', thread_id = ' . $my_row['thread_id'] . ', purchase_line_id = ' . $my_row['id'];
log_sql('Batches', 'INSERT', $sql);
$db->query($sql);
insert_changes($db, 'Batches', $my_batchin_id);
$sql = 'UPDATE PurchaseLines' . ' SET batch_id = ' . $my_batchin_id . ' WHERE id = ' . $my_row['id'];
log_sql('PurchaseLines', 'UPDATE', $sql);
$db->query($sql);
insert_changes($db, 'PurchaseLines', $my_row['id']);
$my_count++;
}
$sql = 'UPDATE Purchases' . ' SET status = "Active"' . ' WHERE id = ' . $the_id;
log_sql('Purchases', 'UPDATE', $sql);
$db->query($sql);
insert_changes($db, 'Purchases', $the_id);
return $my_count;
}
开发者ID:shadobladez,项目名称:erp2,代码行数:37,代码来源:Generate_Purchase.php
示例5: JKY_return_piece
/**
* return Piece from Pieces Return
*
* $.ajax({ method:'return', table:'Pieces', barcode:9...9, ...};
*
* @return string ''
*/
function JKY_return_piece($the_data)
{
$db = Zend_Registry::get('db');
$my_barcode = get_data($the_data, 'barcode');
$my_inspected_by = get_data($the_data, 'inspected_by');
$my_weighed_by = get_data($the_data, 'weighed_by');
$my_remarks = get_data($the_data, 'remarks');
$my_checkin_weight = get_data($the_data, 'checkin_weight');
$my_checkin_location = get_data($the_data, 'checkin_location');
$sql = 'UPDATE Pieces' . ' SET ' . get_updated() . ', status="Check In"' . ', inspected_by= ' . $my_inspected_by . ', weighed_by= ' . $my_weighed_by . ', remarks=\'' . $my_remarks . '\'' . ', checkin_weight= ' . $my_checkin_weight . ', checkin_location=\'' . $my_checkin_location . '\'' . ', checkin_at=\'' . get_time() . '\'' . ' WHERE id =' . $my_barcode;
log_sql('Pieces', 'update', $sql);
$db->query($sql);
insert_changes($db, 'Pieces', $my_barcode);
$my_order_id = get_table_value('Pieces', 'order_id', $my_barcode);
$my_set = ', produced_at=\'' . get_time() . '\'' . ', produced_pieces = produced_pieces + 1';
if ($my_remarks != 'boa') {
$my_set = ', rejected_pieces = rejected_pieces + 1';
}
$my_field_name = $my_remarks == 'boa' ? 'produced_pieces' : 'rejected_pieces';
$sql = 'UPDATE Orders' . ' SET ' . get_updated() . $my_set . ' WHERE id = ' . $my_order_id;
log_sql('Orders', 'update', $sql);
$db->query($sql);
insert_changes($db, 'Orders', $my_order_id);
return '';
}
开发者ID:shadobladez,项目名称:erp2,代码行数:32,代码来源:Return.php
示例6: addRecord
public function addRecord()
{
$M = M('backup');
$M->backup_time = get_time();
$M->path = $this->config['path'];
$M->desc = session('username');
$M->add();
$this->success('备份成功', U('Database/index'));
}
开发者ID:ysking,项目名称:commlib,代码行数:9,代码来源:DatabaseAction.class.php
示例7: JKY_generate_order
/**
* generate Order from OSAs
*
* @param int quotation_id
* @return int count of Orders generated
*/
function JKY_generate_order($the_id)
{
$db = Zend_Registry::get('db');
$sql = 'SELECT *' . ' FROM OSAs' . ' WHERE id = ' . $the_id;
$my_osa = $db->fetchRow($sql);
$sql = 'SELECT *' . ' FROM OSA_Lines' . ' WHERE parent_id = ' . $the_id;
$my_rows = $db->fetchAll($sql);
$my_count = 0;
foreach ($my_rows as $my_row) {
$my_osa_line_id = $my_row['id'];
$sql = 'SELECT *' . ' FROM OSA_Colors' . ' WHERE parent_id = ' . $my_osa_line_id;
$my_colors = $db->fetchAll($sql);
foreach ($my_colors as $my_color) {
$my_order_id = get_next_id('Orders');
$sql = 'INSERT Orders' . ' SET id =' . $my_order_id . ', updated_by =' . get_session('user_id') . ', updated_at ="' . get_time() . '"' . ', order_number =' . $my_order_id . ', osa_line_id =' . $my_osa_line_id . ', osa_number =' . $my_osa['osa_number'] . ', ordered_at ="' . $my_osa['ordered_at'] . '"' . ', needed_at ="' . $my_osa['needed_at'] . '"' . ', quoted_units =' . $my_row['units'] . ', quoted_pieces =' . $my_color['quoted_pieces'] . ', quoted_weight =' . $my_color['quoted_weight'] . ', ordered_pieces =' . $my_color['ordered_pieces'] . ', ordered_weight =' . $my_color['ordered_weight'];
if ($my_osa['customer_id']) {
$sql .= ', customer_id=' . $my_osa['customer_id'];
}
if ($my_row['product_id']) {
$sql .= ', product_id=' . $my_row['product_id'];
}
if ($my_color['color_id']) {
$sql .= ', color_id=' . $my_color['color_id'];
}
if ($my_color['ftp_id']) {
$sql .= ', ftp_id=' . $my_color['ftp_id'];
}
if ($my_color['machine_id']) {
$sql .= ', machine_id=' . $my_color['machine_id'];
}
if ($my_color['partner_id']) {
$sql .= ', partner_id=' . $my_color['partner_id'];
}
log_sql('Orders', 'INSERT', $sql);
$db->query($sql);
insert_changes($db, 'Orders', $my_order_id);
/*
$sql= 'UPDATE OSA_lines'
. ' SET status = "Active"'
. ' WHERE id = ' . $my_row['id']
;
log_sql('OSA_Lines', 'UPDATE', $sql);
$db->query($sql);
insert_changes($db, 'OSA_Lines', $my_row['id']);
*/
$my_count++;
}
}
$sql = 'UPDATE OSAs' . ' SET status = "Active"' . ' WHERE id = ' . $the_id;
log_sql('OSAs', 'UPDATE', $sql);
$db->query($sql);
insert_changes($db, 'OSAs', $the_id);
return $my_count;
}
开发者ID:shadobladez,项目名称:erp2,代码行数:60,代码来源:Generate_Order.php
示例8: index
public function index()
{
if (session('?username') && session('userid')) {
redirect(U('Index/index'));
exit;
}
if ($this->isGet()) {
if (session('errors') > 2) {
$this->show_recaptcha();
}
//如果为get请求并且错误尝试次数大于3,显示验证码
$this->display();
exit;
} else {
if ($this->isPost()) {
session('errors', 0);
if (session('errors') < 3 || $this->recaptcha_valiaute()) {
//如果为post请求并且错误尝试次数小于4,则无需验证;否则需要对验证码进行验证
$username = htmlentities($this->_post('usernameoremail'));
$password = htmlentities($this->_post('password'));
$User = M('user');
$User->where("username='%s' or email='%s' ", $username, $username)->find();
if (isset($User->password) && $User->password === md5Encrypt($password)) {
session('username', $username);
session('userid', $User->id);
$M = M('log');
$M->update_user = session('userid');
$M->update_time = get_time();
$M->operate = 'login';
$M->ip = get_client_ip();
$M->status = '0';
$M->add();
$this->msg = 'success!';
redirect(U('Index/index'));
exit;
} else {
if (session('errors') > 2) {
$this->recaptcha = recaptcha_get_html($this->publickey, $error);
}
$this->msg = "Wrong username or email and password combine.";
}
}
session('errors', session('errors') + 1);
$this->errors = session('errors');
$this->username = $username;
$this->display();
} else {
if ($this->isAjax()) {
exit;
//Ajax cross domain attack
}
}
}
}
开发者ID:ysking,项目名称:commlib,代码行数:54,代码来源:LoginAction.class.php
示例9: update
public function update($id, array $data, $log = true)
{
$data['updated_at'] = get_time();
if (is_session('user_id')) {
$data['updated_by'] = get_session('user_id');
}
$where = $this->getAdapter()->quoteInto('id = ?', $id);
parent::update($data, $where);
if ($log) {
log_sql($this->_name, $id, 'updated', $data);
set_session('notice', 'current record saved');
}
}
开发者ID:shadobladez,项目名称:erp2,代码行数:13,代码来源:Application.php
示例10: __construct
/**
* 导入记录信息
*
* @param string $pid
* @param string $location
* @param string $toplocation
* @param string $cookies
* @param unknown $data
*/
public function __construct($pid = "", $location = "", $toplocation = "", $cookies = "", $data = array())
{
$this->pid = $pid;
$this->location = $location;
$this->toplocation = $toplocation;
$this->cookies = $cookies;
$this->data = is_array($data) ? $data : array();
$this->dbh = $GLOBALS['pmx_dbh'];
$this->ip = get_ip();
$this->time = get_time();
$this->HTTP_ACCEPT = isset($_SERVER["HTTP_ACCEPT"]) ? $_SERVER["HTTP_ACCEPT"] : "";
$this->HTTP_REFERER = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "";
$this->HTTP_USER_AGENT = isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "";
}
开发者ID:mtpkiss,项目名称:phpMyXSS,代码行数:23,代码来源:class.pmxprojectitem.php
示例11: JKY_generate_checkout
/**
* generate CheckOut from Planning Orders
*
* @param int order_id
* @return int count of CheckOuts generated
*/
function JKY_generate_checkout($the_id)
{
$db = Zend_Registry::get('db');
$sql = 'SELECT *' . ' FROM Orders' . ' WHERE id = ' . $the_id;
$my_order = $db->fetchRow($sql);
$sql = 'SELECT *' . ' FROM OrdThreads' . ' WHERE parent_id = ' . $the_id;
$my_rows = $db->fetchAll($sql);
/*
$my_needed_at = $my_order['needed_at'];
if ($my_needed_at == null) {
$my_needed_at = get_time();
}
*/
$my_checkout_id = get_next_id('CheckOuts');
$sql = 'INSERT CheckOuts' . ' SET id =' . $my_checkout_id . ', updated_by =' . get_session('user_id') . ', updated_at ="' . get_time() . '"' . ', number =' . $my_checkout_id . ', requested_at ="' . get_time() . '"' . ', requested_weight =' . $my_order['ordered_weight'];
if ($my_order['machine_id']) {
$sql .= ', machine_id=' . $my_order['machine_id'];
}
if ($my_order['partner_id']) {
$sql .= ', partner_id=' . $my_order['partner_id'];
}
log_sql('CheckOuts', 'INSERT', $sql);
$db->query($sql);
insert_changes($db, 'CheckOuts', $my_checkout_id);
$my_count = 0;
foreach ($my_rows as $my_row) {
$my_ord_thread_id = $my_row['id'];
$my_batch = db_get_row('Batches', 'id=' . $my_row['batchin_id']);
$my_ordered_weight = $my_row['ordered_weight'];
$my_ordered_boxes = ceil((double) $my_ordered_weight / (double) $my_batch['average_weight']);
$my_batchout_id = get_next_id('BatchOuts');
$sql = 'INSERT BatchOuts' . ' SET id =' . $my_batchout_id . ', updated_by =' . get_session('user_id') . ', updated_at ="' . get_time() . '"' . ', checkout_id =' . $my_checkout_id . ', thread_id =' . $my_row['thread_id'] . ', batchin_id =' . $my_row['batchin_id'] . ', order_thread_id =' . $my_ord_thread_id . ', batch ="' . $my_batch['batch'] . '"' . ', unit_price =' . $my_batch['unit_price'] . ', average_weight =' . $my_batch['average_weight'] . ', requested_weight =' . $my_ordered_weight . ', requested_boxes =' . $my_ordered_boxes;
log_sql('BatchOuts', 'INSERT', $sql);
$db->query($sql);
insert_changes($db, 'BatchOuts', $my_batchout_id);
$sql = 'UPDATE OrdThreads' . ' SET batchout_id = ' . $my_batchout_id . ' WHERE id = ' . $my_ord_thread_id;
log_sql('OrdThreads', 'UPDATE', $sql);
$db->query($sql);
insert_changes($db, 'OrdThreads', $my_ord_thread_id);
$my_count++;
}
$sql = 'UPDATE Orders' . ' SET status = "Active"' . ' WHERE id = ' . $the_id;
log_sql('Orders', 'UPDATE', $sql);
$db->query($sql);
insert_changes($db, 'Orders', $the_id);
return $my_count;
}
开发者ID:shadobladez,项目名称:erp2,代码行数:53,代码来源:Generate_CheckOut.php
示例12: show_recette
function show_recette($r)
{
global $PANIER;
?>
<a id="recette-<?php
echo $r['id'];
?>
" class="recette-el" href="recette-<?php
echo $r['id'] . '-' . txt2url($r['titre']);
?>
.html" style="background: url(images/<?php
echo $r['id'];
?>
.jpg) no-repeat center center; background-size: 100%;">
<div class="infos">
<div class="details fltr"><?php
echo '<img src="style/time11.png" alt="" /> ' . get_time($r['duree']) . ' <img src="style/pers11.png" alt="Pour " /> ' . $r['personnes'];
?>
</div>
<div class="stars"><div class="stars_full" style="width: <?php
echo $r['note'] / 2 * 12;
?>
px"></div></div>
<div class="titre"><?php
echo $r['titre'];
?>
</div>
</div>
<div class="cart"><?php
if (isset($PANIER[$r['id']])) {
for ($i = 1; $i <= $PANIER[$r['id']]; $i++) {
?>
<img src="style/ok25.png" alt="ok" onclick="return rem(<?php
echo $r['id'];
?>
,this)" /><?php
}
}
?>
<img class="cart-add" src="style/add25.png" alt="+" onclick="return add(<?php
echo $r['id'];
?>
)" />
</div>
<img src="style/transp.png" class="transp" />
</a><?php
}
开发者ID:ThomasRobertFr,项目名称:cookbook,代码行数:47,代码来源:list.php
示例13: get_leave_message
function get_leave_message($commodity_id, $conn)
{
require_once 'class/Config_leave_message.php';
require_once 'class/DBpagination.php';
require_once 'class/Info_user.php';
require_once 'class/Config_user.php';
$page = isset($_REQUEST['page']) ? (int) $_GET['id'] : 1;
$dbtraerser = new DBpagination(Config_leave_message::tbl_name, ' where ' . Config_leave_message::commodity_id . ' = ' . "'" . $commodity_id . "'", $page, MESSAGE_EACH_PAGE, array(Config_leave_message::content, Config_leave_message::time, Config_leave_message::talker));
$retval = $dbtraerser->excute($conn);
$array_message = array();
while (($temp_database_row_array = mysqli_fetch_array($retval, MYSQLI_ASSOC)) != null) {
$temp_user = Info_user::get_user_avatar_and_logname($conn, $temp_database_row_array[Config_leave_message::talker]);
$array_message[] = array('description' => $temp_database_row_array[Config_leave_message::content], 'time' => get_time($temp_database_row_array[Config_leave_message::time]), 'nickname' => $temp_user[Config_user::log_name], 'img' => 'upload/avatar.png');
}
mysqli_free_result($retval);
return $array_message;
}
开发者ID:DaiDanRui,项目名称:LinHang,代码行数:17,代码来源:Commodity_details.php
示例14: show_buy_html
function show_buy_html($commodity_id, $conn)
{
require_once 'class/Config_commodity.php';
require_once 'class/DBtraverser.php';
$where = ' where ' . Config_commodity::id . ' = ' . "'" . $commodity_id . "'";
$DBtraverser = new DBtraverser(Config_commodity::table_name, $where);
$result = $DBtraverser->excute($conn);
$array_commofity_info = mysqli_fetch_array($result, MYSQLI_ASSOC);
if ($array_commofity_info) {
require_once 'Include_picture.php';
require_once 'class/Info_user.php';
require_once 'class/Config_user.php';
$acceptor_info_array = Info_user::get_user_info_by_id($conn, $_SESSION['CURRENT_LOGIN_ID']);
$publisher_info_array = Info_user::get_user_info_by_id($conn, $array_commofity_info[Config_commodity::publisher]);
$commodity_array_for_display = array('nickname' => $acceptor_info_array[Config_user::log_name], 'acceptor_phone' => $acceptor_info_array[Config_user::phone_number], 'publisher_name' => $publisher_info_array[Config_user::log_name], 'publisher_phone' => $array_commofity_info[Config_commodity::communication_number], 'title' => $array_commofity_info[Config_commodity::title], 'time' => get_time($array_commofity_info[Config_commodity::release_date]), 'price' => $array_commofity_info[Config_commodity::price], 'description' => $array_commofity_info[Config_commodity::description], 'description_img' => get_one_commodity_pic($conn, $array_commofity_info[Config_commodity::id]), 'img' => 'upload/avatar.png', 'id' => $commodity_id);
return $commodity_array_for_display;
}
}
开发者ID:DaiDanRui,项目名称:LinHang,代码行数:18,代码来源:Include_commodity.php
示例15: show_welcome
function show_welcome($nick)
{
$location = get_location($nick);
if ($location === False) {
return;
}
$time = get_time($location);
if ($time == "") {
return;
}
$arr = convert_google_location_time($time);
$data = process_weather($location, $nick, True);
if ($data === False) {
return;
}
if ($data["tempC"] === False or $data["tempF"] === False) {
return;
}
privmsg("welcome {$nick}: " . trim($arr["location"]) . ", " . $data["tempC"] . "/" . $data["tempF"] . ", " . date("g:i a", $arr["timestamp"]) . " " . $arr["timezone"] . ", " . date("l, j F Y", $arr["timestamp"]));
}
开发者ID:cmn32480,项目名称:exec-irc-bot,代码行数:20,代码来源:welcome.php
示例16: set
public static function set($key, $content, $time, $position = 'pages')
{
switch ($position) {
case 'pages':
$cache_file = APPPATH . "cache/{$key}.cch";
break;
case 'styles':
$cache_file = FCPATH . "modules/styles/cache/{$key}.css";
break;
case 'scripts':
$cache_file = FCPATH . "modules/scripts/cache/{$key}.js";
break;
default:
return NULL;
}
$h = fopen($cache_file, 'w');
fwrite($h, $content);
fclose($h);
touch($cache_file, get_time() + $time);
return TRUE;
}
开发者ID:viking2000,项目名称:web-antarix,代码行数:21,代码来源:cache.php
示例17: regenerate_secret_key
public function regenerate_secret_key()
{
$id = $this->_user->get_id();
if (!$id or $this->_user->is_visitor()) {
return FALSE;
}
$sc =& $this->_special_chars;
$salt0 = uniqid('wx__');
$salt1 = $sc[array_rand($sc)];
$salt2 = $sc[array_rand($sc)];
$salt3 = $sc[array_rand($sc)];
$session_id = Session::get_sid();
$lifetime = get_time() + config('session', 'lifetime_secret_key');
$raw_data = array($salt0, $id, time(), $session_id, $lifetime, $salt1, $salt2 . $salt1, $salt2 . $salt1 . $salt3);
shuffle($raw_data);
$non_format_key = md5(implode(uniqid(), $raw_data));
//Заменяем повторяющиеся символы в коде на спец символы
$length = strlen($non_format_key);
for ($i = 0; $i < $length; $i++) {
$test_char = $non_format_key[$i];
for ($j = 0; $j < $length; $j++) {
if ($i == $j) {
continue;
}
if ($test_char == $non_format_key[$j]) {
if (!is_numeric($non_format_key[$j]) and mt_rand(0, 100) >= 50) {
$non_format_key[$j] = ucfirst($non_format_key[$j]);
continue;
}
$key = array_rand($sc);
$non_format_key[$j] = $sc[$key];
}
}
}
$secret_key = $non_format_key;
$secret_data = array('secret_key' => $secret_key);
Session::set_server_data($secret_data);
db::simple_query(self::Q_UPDATE_USER_KEY, array('%user_id' => $id, '%secret_key' => $secret_key));
return $secret_data['secret_key'];
}
开发者ID:viking2000,项目名称:web-antarix,代码行数:40,代码来源:secret_key.php
示例18: uploaded_file_info
function uploaded_file_info()
{
if (isset($_SESSION['url'])) {
//Is it a URL?
if (filter_var($_SESSION['url'], FILTER_VALIDATE_URL) == TRUE) {
//Note this should have already been sanitised, so this is an additional (uneccesary?) check
$testing_file_name = htmlentities($_SESSION['url']);
}
} elseif (isset($_SESSION['uploadedfilepath'])) {
//Has it been either uploaded or pasted
if (strstr($_SESSION['uploadedfilepath'], "paste")) {
//Pasted code is saved with the filename like pasted.time()
$testing_file_name = "Pasted code";
} else {
//Filename of type basename_time().xml
$testing_file_name = basename($_SESSION['uploadedfilepath']);
$extension = explode(".", $testing_file_name);
$extension = end($extension);
$testing_file_name = explode("_", $testing_file_name);
array_pop($testing_file_name);
$testing_file_name = implode("_", $testing_file_name) . "." . $extension;
}
}
//Finally only display the HTML if we have a file
if (isset($_SESSION['uploadedfilepath'])) {
$day_time = get_time(basename($_SESSION['uploadedfilepath']));
$day = $day_time[1];
$time = $day_time[0];
$today = date("z");
if ($today == $day) {
$day = "Today";
} elseif ($today - $day == 1) {
$day = "Yesterday";
} else {
$day = $today - $day . " days ago";
}
return '<div class="alert alert-info"><strong>Testing:</strong> ' . $testing_file_name . '<br/><strong>Uploaded:</strong> ' . $day . ' at ' . $time . ' GMT</div>';
}
}
开发者ID:rolfkleef,项目名称:IATI-Public-Validator,代码行数:39,代码来源:index.php
示例19: __construct
/**
* Session Constructor
*
* The constructor runs the session routines automatically
* whenever the class is instantiated.
*/
function __construct()
{
// Set all the session preferences, which can either be set
// manually via the $params array above or via the config file
foreach (array('sess_encrypt_cookie', 'sess_expiration', 'sess_expire_on_close', 'sess_match_ip', 'sess_match_useragent', 'sess_cookie_name', 'cookie_path', 'cookie_domain', 'cookie_secure', 'sess_time_to_update', 'time_reference', 'cookie_prefix', 'encryption_key') as $key) {
$this->{$key} = isset($params[$key]) ? $params[$key] : config_item($key);
}
if ($this->encryption_key == '') {
show_error(ld_msg('session_msg_001'));
}
// Do we need encryption? If so, load the encryption class
if ($this->sess_encrypt_cookie == TRUE) {
$this->ENC =& load_class('Encryption');
}
// Set the "now" time. Can either be GMT or server time, based on the
// config prefs. We use this to set the "last activity" time
$this->now = get_time();
// Set the session length. If the session expiration is
// set to zero we'll set the expiration two years from now.
if ($this->sess_expiration == 0) {
$this->sess_expiration = 60 * 60 * 24 * 365 * 2;
}
// Set the cookie name
$this->sess_cookie_name = $this->cookie_prefix . $this->sess_cookie_name;
// Run the Session routine. If a session doesn't exist we'll
// create a new one. If it does, we'll update it.
if (!$this->sess_read()) {
$this->sess_create();
} else {
$this->sess_update();
}
// Delete 'old' flashdata (from last request)
$this->_flashdata_sweep();
// Mark all new flashdata as old (data will be deleted before next request)
$this->_flashdata_mark();
// Delete expired sessions if necessary
$this->_sess_gc();
}
开发者ID:puncoz,项目名称:presentation,代码行数:44,代码来源:session.php
示例20: statistics
/**
* 根据时间统计各应用系统短信发送量
*
* @param string $appId 应用系统ID
* @param int $year 年份
* @param int $month 月份
* @param int $day 日期
*
* ~~
* 默认为当前前一天或者前一小时的时间
* ~~
*
* @return array $daily
*/
public function statistics($appId = '', $year = 0, $month = 0, $day = 0)
{
$conditions = [];
// 获取前一天的年月日
list($years, $months, $days) = get_time(2);
// 根据条件构造查询条件
if (!empty($appId)) {
$conditions['app_id'] = strval($appId);
}
if ($year == 0) {
$year = $years;
}
$conditions['year'] = $year;
if ($month == 0) {
$month = $months;
}
$conditions['month'] = $month;
if ($day == 0) {
$day = $days;
}
$conditions['day'] = $day;
$daily = self::find()->select(['app_id', 'SUM(total) total', 'year', 'month', 'day'])->where($conditions)->groupBy(['app_id'])->asArray()->all();
return $daily;
}
开发者ID:songhongyu,项目名称:datecenter,代码行数:38,代码来源:HourStat.php
注:本文中的get_time函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论