本文整理汇总了PHP中mysql_to_unix函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_to_unix函数的具体用法?PHP mysql_to_unix怎么用?PHP mysql_to_unix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysql_to_unix函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: update_data
public function update_data()
{
$this->load->model('tags_model', 'tags', true);
$this->load->model('links_model', 'links', true);
$this->load->model('images_model', 'images', true);
$this->load->helper('date');
$config = $this->config->item('upload');
$file = file('/srv/www/themoviepostersite.com/posters.csv');
$data = '';
$views = array();
foreach ($file as $key => $value) {
$csv = str_getcsv($value);
$data['id'] = $csv[0];
$data['title'] = $csv[1];
$data['filename'] = $csv[2];
$num_views = $csv[3];
$data['created_on'] = mysql_to_unix($csv[4]);
$views['created_on'] = $csv[5];
$data['group_id'] = $csv[6];
$data['thumbnail'] = $csv[7];
$data['path_to_file'] = $config['upload_path'] . $data['id'];
//legacy path
$tags = explode(", ", $csv[9]);
$this->images->create($data);
foreach ($tags as $k => $v) {
$tag['tag'] = $v;
$this->tags->create($tag);
$id = $this->tags->get_insert_id();
$tag_link['itemid'] = $id;
$tag_link['item'] = 'tag';
$tag_link['pinupid'] = $data['id'];
$this->links->create($tag_link);
}
}
}
开发者ID:richtestani,项目名称:Pinups,代码行数:35,代码来源:preferences.php
示例2: _get_updateddate
public function _get_updateddate($Date)
{
if (empty($Date)) {
return null;
}
return mysql_to_unix($Date);
}
开发者ID:Swift-Jr,项目名称:thmdhc,代码行数:7,代码来源:mStoreItem.php
示例3: edit
public function edit()
{
$id = abs((int) $this->uri->segment(4));
if (!empty($id)) {
$this->form_validation->set_rules('Start_time', 'start', 'required');
$this->form_validation->set_rules('End_time', 'end', 'required');
//validasi date
$start = $this->input->post('Start_time');
$end = $this->input->post('End_time');
if ($this->form_validation->run() == FALSE || $this->validate_date($start) == FALSE || $this->validate_date($end) == FALSE || (mysql_to_unix($end) - mysql_to_unix($start)) / 86400 <= 0) {
$this->data['user'] = $this->access->get_user($id);
$this->data['title'] = 'Edit Akses Satker';
$this->data['template'] = 'manajemen_akses/edit';
// $this->session->set_flashdata('message_type', 'error');
// $this->session->set_flashdata('message1', 'Data salah input');
$this->load->view('backend/index', $this->data);
} else {
$this->access->update_date($start, $end, $id);
$this->session->set_flashdata('message_type', 'success');
$this->session->set_flashdata('message', 'Data berhasil diperbaharui');
redirect('backend/access_management/');
}
} else {
redirect('backend');
}
}
开发者ID:raymerta,项目名称:Monev,代码行数:26,代码来源:access_management.php
示例4: retorno
function retorno()
{
$data['title'] = "Relatórios - Controle de Estoque";
$data['headline'] = "Relatório";
$data['include'] = 'Relatorio_retorno';
$this->load->model('MRelatorio', '', TRUE);
$qry = $this->MRelatorio->getConsumoProduto($_POST);
$table = $this->table->generate($qry);
$tmpl = array('table_open' => '<table id="tabela" class="relatorio">');
$this->table->set_template($tmpl);
$this->table->set_empty(" ");
$this->table->set_heading('Produto', 'Quantidade', 'Data');
$table_row = array();
$data['qry'] = array();
foreach ($qry->result() as $produto) {
$table_row = NULL;
$table_row[] = $produto->nome_produto;
$table_row[] = $produto->quantidade_pedida;
$data_human = mysql_to_pt($produto->data_pedido);
$table_row[] = $data_human;
$this->table->add_row($table_row);
$data['qry'][] = array(mysql_to_unix($produto->data_pedido) * 1000, $produto->quantidade_pedida);
}
$table = $this->table->generate();
$data['data_table'] = $table;
$this->load->view('template', $data);
}
开发者ID:fellipe6,项目名称:estoque,代码行数:27,代码来源:relatorio.php
示例5: view_forum
function view_forum($forumID = 0)
{
$this->load->helper('date');
$forumID = intval($forumID);
$forum = $this->forum_model->getForum($forumID);
// Check if topic exists
if (!empty($forum)) {
$forum['topic_list'] = array();
// Get a list of posts which have no parents (topics) in this forum
foreach ($this->post_model->getTopicsInForum($forumID) as $topic) {
$topic['post_count'] = count($this->post_model->getPostsInTopic($topic['postID']));
$topic['last_post'] = $this->post_model->getLastPost('topic', $topic['postID']);
// Convert to unix and see how long ago it was posted
$timespan = timespan(mysql_to_unix($topic['last_post']['post_date']));
// If its set and doesnt contain the word days in the timespan
if (isset($forum['last_post']['post_date']) && !strpos($timespan, 'Day')) {
$topic['last_post']['post_date'] = $timespan;
} else {
$topic['last_post']['post_date'] = $topic['last_post']['post_date'];
}
$forum['topic_list'][] = $topic;
}
$this->data = array_merge($this->data, $forum);
$this->layout->title('Forums > ' . $this->data['forum_name']);
$this->layout->create('view_forum', $this->data);
} else {
show_error('The Forum doesn\'t exist!');
$this->layout->create('message', $this->data);
}
}
开发者ID:BenneX,项目名称:pyrocms,代码行数:30,代码来源:forums.php
示例6: get_cliente_by_id
function get_cliente_by_id($id)
{
$this->load->helper('date');
$query = $this->db->get_where("clientes", array("idcliente" => $id));
if ($query->num_rows() > 0) {
$c = $query->row_array();
if ($c['fecnac'] == "" || is_null($c['fecnac'])) {
$c['fecnac'] = "No especificado";
} else {
$c['fecnac'] = mdate("%d-%m-%Y", mysql_to_unix($c['fecnac']));
}
$c['fecnac2'] = $c['fecnac'];
$c['sexo'] = $c['sexo'] == 0 ? "Masculino" : "Femenino";
$c['ocupacion'] = $c['ocupacion'] == "" || is_null($c['ocupacion']) ? "No especificado" : $c['ocupacion'];
$c['direccion'] = $c['direccion'] == "" || is_null($c['direccion']) ? "No especificado" : $c['direccion'];
$c['colonia'] = $c['colonia'] == "" || is_null($c['colonia']) ? "No especificada" : $c['colonia'];
$c['cp'] = $c['cp'] == "" || is_null($c['cp']) ? "No especificado" : $c['cp'];
$c['ciudad'] = $c['ciudad'] == "" || is_null($c['ciudad']) ? "No especificada" : $c['ciudad'];
$c['estado'] = $c['estado'] == "" || is_null($c['estado']) ? "No especificado" : $c['estado'];
$c['telefono1'] = $c['telefono1'] == "" || is_null($c['telefono1']) ? "No especificado" : $c['telefono1'];
$c['telefono2'] = $c['telefono2'] == "" || is_null($c['telefono2']) ? "" : $c['telefono2'];
$c['email'] = $c['email'] == "" || is_null($c['email']) ? "No especificado" : $c['email'];
$c['enfermedad'] = $c['enfermedad'] == "" || is_null($c['enfermedad']) ? "No especificado" : $c['enfermedad'];
$c['avisar'] = $c['avisar'] == "" || is_null($c['avisar']) ? "No especificado" : $c['avisar'];
$c['aviparen'] = $c['aviparen'] == "" || is_null($c['aviparen']) ? "No especificado" : $c['aviparen'];
$c['avidom'] = $c['avidom'] == "" || is_null($c['avidom']) ? "No especificado" : $c['avidom'];
$c['avitel'] = $c['avitel'] == "" || is_null($c['avitel']) ? "No especificado" : $c['avitel'];
$c['vence'] = $c['vence'] == "" || is_null($c['vence']) ? null : $c['vence'];
return $c;
}
return false;
}
开发者ID:noamyc,项目名称:Gym,代码行数:32,代码来源:clientes_model.php
示例7: comments
function comments($comments, $object_id, $object, $usernames, $format, $return = 'agilan/index')
{
$string = "";
$string .= "<ol class='comments'>";
if (isset($comments[$object_id]) && count($comments[$object_id]) > 0) {
foreach ($comments[$object_id] as $kk => $ll) {
$CID = $ll->user_id;
$CU = $usernames[$ll->user_id];
$stamp = mysql_to_unix($ll->created);
$string .= "<li><b>" . $CU . ":</b> <small>" . $ll->comment . "<br/>" . mdate($format, $stamp) . "</small></li>";
}
} else {
$string .= nbs();
}
$string .= "<li class='last'>";
$string .= form_open('comments/index');
$input = array('name' => 'comment', 'id' => 'comment', 'size' => 35);
$string .= form_input($input);
$string .= form_hidden('object', $object);
$string .= form_hidden('object_id', $object_id);
$string .= form_hidden('return_url', $return);
$string .= form_submit('add comment', 'comment');
$string .= form_close();
$string .= "</li>";
$string .= "</ol>";
echo $string;
}
开发者ID:Ahmad-Hilali,项目名称:agilan,代码行数:27,代码来源:social_pi.php
示例8: index
function index()
{
$ga = new ga();
$this->ga->authen('[email protected]', 'rain2512', 'ga:98468001');
if ($_GET) {
$now = Date2DB($_GET['date']);
} else {
$now = date("Y-m-d");
}
$lastmonth = date('Y-m-d', strtotime('-29 days', mysql_to_unix($now)));
//Summery: visitors, unique visit, pageview, time on site, new visits, bounce rates
$data['summery'] = $this->ga->getSummery($lastmonth, $now);
//All time summery: visitors, page views
$data['allTimeSummery'] = $this->ga->getAllTimeSummery();
//Last 10 days visitors (for graph)
$data['visits'] = $this->ga->getVisits($lastmonth, $now, 30);
//Top 10 search engine keywords
$data['topKeywords'] = $this->ga->getTopKeyword($lastmonth, $now, 10);
//Top 10 visitor countries
$data['topCountries'] = $this->ga->getTopCountry($lastmonth, $now, 10);
//Top 10 page views
$data['topPages'] = $this->ga->getTopPage($lastmonth, $now, 10);
//Top 10 referrer websites
$data['topReferrer'] = $this->ga->getTopReferrer($lastmonth, $now, 10);
//Top 10 visitor browsers
$data['topBrowsers'] = $this->ga->getTopBrowser($lastmonth, $now, 10);
//Top 10 visitor operating systems
$data['topOs'] = $this->ga->getTopOs($lastmonth, $now, 10);
$this->template->append_metadata(js_datepicker());
$this->template->build("index", $data);
}
开发者ID:ultraauchz,项目名称:asean_cultural_mapping,代码行数:31,代码来源:analytics.php
示例9: retorno_compra
function retorno_compra()
{
$data['title'] = "Relatórios - Controle de Estoque";
$data['headline'] = "Relatório";
$data['include'] = 'relatorio_retorno';
$this->load->model('MRelatorio', '', TRUE);
$qry = $this->MRelatorio->getCompraProduto();
$table = $this->table->generate($qry);
$tmpl = array('table_open' => '<table id="tabela" class="relatorio">');
$this->table->set_template($tmpl);
$this->table->set_empty(" ");
$this->table->set_heading('Número Nota', 'Fornecedor', 'Data da Nota', 'Valor Total');
$table_row = array();
$data['qry'] = array();
foreach ($qry->result() as $nota) {
$table_row = NULL;
$table_row[] = $nota->numero_nota;
$this->load->model('MFornecedor', '', TRUE);
$fornecedor = $this->MFornecedor->getFornecedor($nota->id_fornecedor)->result();
$table_row[] = $fornecedor[0]->razao_social;
$table_row[] = mysql_to_pt($nota->data_nota);
$table_row[] = ' ';
$this->table->add_row($table_row);
$data['qry'][] = array(mysql_to_unix($nota->data_nota) * 1000, $fornecedor[0]->razao_social);
}
$table = $this->table->generate();
$data['data_table'] = $table;
$this->load->view('template3', $data);
}
开发者ID:fellipe6,项目名称:estoque,代码行数:29,代码来源:relatorio.php
示例10: set_vars
private function set_vars($row)
{
if (!is_array($row)) {
return trigger_error('$comic->set_vars($row) must be called with an array as the argument!');
}
global $scdb;
$this->title = $row['title'];
$this->image = $row['image'];
$this->info = $row['info'];
$this->cat = (int) $row['cat'];
$this->category = $this->cat_info($this->cat);
$this->transcript = $row['transcript'];
$this->time = $row['time'];
$this->stamp = (int) mysql_to_unix($this->time);
$this->views = (int) $row['views'] + 1;
$this->ID = (int) $row['ID'];
$this->PID = (int) $row['PID'];
$user_info = $this->user_info($row['author']);
$this->author = $user_info->nicename;
$this->author_full = $user_info->name;
// keep until i've changed all calls to $this->type to $this->category->nicename
$this->type = $this->category->nicename;
$this->first = (int) $scdb->get_var("SELECT `ID` FROM `{$scdb->comics}` WHERE `cat` = '{$this->cat}' ORDER BY `ID` ASC LIMIT 1");
$this->last = (int) $scdb->get_var("SELECT `ID` FROM `{$scdb->comics}` WHERE `cat` = '{$this->cat}' AND `time` <= '" . NOW . "' ORDER BY `ID` DESC LIMIT 1");
if ($this->ID !== $this->first) {
$this->prev = (int) $scdb->get_var("SELECT `ID` FROM `{$scdb->comics}` WHERE `ID` < '{$this->ID}' AND `cat` = '{$this->cat}' ORDER BY `ID` DESC LIMIT 1");
}
if ($this->ID !== $this->last) {
$this->next = (int) $scdb->get_var("SELECT `ID` FROM `{$scdb->comics}` WHERE `ID` > '{$this->ID}' AND `cat` = '{$this->cat}' ORDER BY `ID` ASC LIMIT 1");
}
}
开发者ID:jclay06,项目名称:scms,代码行数:31,代码来源:comic.class.php
示例11: inc_statistic
public function inc_statistic()
{
$ga = new ga();
$this->ga->authen('[email protected]', 'rain2512', 'ga:98468001');
// $ga->authen('[email protected]','rain2512','ga:98468001');
$now = date("Y-m-d");
$lastmonth = date("Y-m-d", strtotime('-1 month', mysql_to_unix($now)));
$data["today"] = $this->ga->getSummery($now, $now);
$data["month"] = $this->ga->getSummery($lastmonth, $now);
$data["alltime"] = $this->ga->getAllTimeSummery();
$lastmonth = date('Y-m-d', strtotime('-30 days'));
//Summery: visitors, unique visit, pageview, time on site, new visits, bounce rates
$data['summery'] = $this->ga->getSummery($lastmonth, $now);
//All time summery: visitors, page views
$data['allTimeSummery'] = $this->ga->getAllTimeSummery();
//Last 10 days visitors (for graph)
$data['visits'] = $this->ga->getVisits(date('Y-m-d', strtotime('-10 days')), $now, 10);
//Top 10 search engine keywords
$data['topKeywords'] = $this->ga->getTopKeyword($lastmonth, $now, 10);
//Top 10 visitor countries
$data['topCountries'] = $this->ga->getTopCountry($lastmonth, $now, 10);
//Top 10 page views
$data['topPages'] = $this->ga->getTopPage($lastmonth, $now, 10);
//Top 10 referrer websites
$data['topReferrer'] = $this->ga->getTopReferrer($lastmonth, $now, 10);
//Top 10 visitor browsers
$data['topBrowsers'] = $this->ga->getTopBrowser($lastmonth, $now, 10);
//Top 10 visitor operating systems
$data['topOs'] = $this->ga->getTopOs($lastmonth, $now, 10);
$this->load->view("inc_statistic", $data);
}
开发者ID:ultraauchz,项目名称:asean_cultural_mapping,代码行数:31,代码来源:admin.php
示例12: replace
/**
* Replace all of the default date fields.
*
* @param String The tagdata to be parsed
* @param Object The channel parser object
* @param Mixed The results from the preparse method
*
* @return String The processed tagdata
*/
public function replace($tagdata, EE_Channel_data_parser $obj, $date_vars)
{
$prefix = $obj->prefix();
$tag = $obj->tag();
$data = $obj->row();
$dates = array($prefix . 'entry_date' => $data['entry_date'], $prefix . 'edit_date' => mysql_to_unix($data['edit_date']), $prefix . 'recent_comment_date' => $data['recent_comment_date'] != 0 ? $data['recent_comment_date'] : '', $prefix . 'expiration_date' => $data['expiration_date'] != 0 ? $data['expiration_date'] : '', $prefix . 'comment_expiration_date' => $data['comment_expiration_date'] != 0 ? $data['comment_expiration_date'] : '');
// "week_date"
// Subtract the number of days the entry is "into" the week to get zero (Sunday)
// If the entry date is for Sunday, and Monday is being used as the week's start day,
// then we must back things up by six days
$offset = 0;
if (strtolower(ee()->TMPL->fetch_param('start_day')) == 'monday') {
$day_of_week = ee()->localize->format_date('%w', $data['entry_date']);
if ($day_of_week == '0') {
$offset = -518400;
// back six days
} else {
$offset = 86400;
// plus one day
}
}
$dates['week_date'] = $data['entry_date'] - ee()->localize->format_date('%w', $data['entry_date'], TRUE) * 60 * 60 * 24 + $offset;
$tagdata = ee()->TMPL->parse_date_variables($tagdata, $dates);
$dates = array($prefix . 'gmt_date' => $data['entry_date'], $prefix . 'gmt_entry_date' => $data['entry_date'], $prefix . 'gmt_edit_date' => mysql_to_unix($data['edit_date']));
$tagdata = ee()->TMPL->parse_date_variables($tagdata, $dates, FALSE);
return $tagdata;
}
开发者ID:ayuinc,项目名称:laboratoria-v2,代码行数:36,代码来源:Date.php
示例13: datediff
function datediff($datefrom, $dateto = FALSE)
{
$startDate = mysql_to_unix($datefrom);
$lastDate = $dateto ? mysql_to_unix($dateto) : now();
$differnce = $startDate - $lastDate;
$differnce = $differnce / (60 * 60 * 24);
return (int) $differnce;
}
开发者ID:unisexx,项目名称:thaigcd2015,代码行数:8,代码来源:MY_date_helper.php
示例14: get_timespan
public function get_timespan($time)
{
$time = mysql_to_unix($time);
//$time -= -3600;
return $this->time_since($time);
//return $time;
//return timespan($time, $now);
}
开发者ID:naeem91,项目名称:5ellow,代码行数:8,代码来源:DateLib.php
示例15: post_comments
public function post_comments($post_id = 0)
{
// load date_helper from CI's app singleton
get_instance()->load->helper('date');
$comments = $this->db->where('post_id', (int) $post_id)->order_by('created DESC')->get('comments')->result_array();
return array_map(function ($a) {
$a['time_ago'] = timespan(mysql_to_unix($a['created']), time(), 2);
return $a;
}, $comments);
}
开发者ID:DavBfr,项目名称:BlogMVC,代码行数:10,代码来源:posts_model.php
示例16: updpet_lock
function updpet_lock($arr)
{
$ownerdataobj = $this->user_io_m->init('id_user', getAccountUserId());
//$expdate=date('Y-m-d H:i:s',strtotime('+'.$arr['totday']."days"));
if ($arr['totday'] > 1) {
$day = "days";
} else {
$day = 'day';
}
$checkrecord = $this->getPetLockRecord($arr['iduser']);
if (mysql_to_unix($checkrecord->lockexp_date) > mysql_to_unix(mysqlDate())) {
//if this pet had locked and not expire date
$sql = "UPDATE " . TBL_PET . " \r\n\t\t\t\tSET lockstatus=1 ,id_petlock=" . $arr['lockid'] . ",userprice=" . $arr['totprice'] . "/2,\r\n\t\t\t\taddlock_date=NOW(),intr=" . $arr['totday'] . "*24,\r\n\t\t\t\tlockexp_date=ADDDATE(lockexp_date,'" . $arr['totday'] . "')\r\n\t\t\t\tWHERE id_user=" . $arr['iduser'] . " AND id_owner=" . getAccountUserId();
} else {
$sql = "UPDATE " . TBL_PET . " \r\n\t\t\t\tSET lockstatus=1 ,id_petlock=" . $arr['lockid'] . ",userprice=" . $arr['totprice'] . "/2,\r\n\t\t\t\taddlock_date=NOW(),intr=" . $arr['totday'] . "*24,\r\n\t\t\t\tlockexp_date=ADDDATE(NOW(),'" . $arr['totday'] . "')\r\n\t\t\t\tWHERE id_user=" . $arr['iduser'] . " AND id_owner=" . getAccountUserId();
}
$this->db->query($sql);
debug("update tbl pet");
//For lock history added on dt-30-12-10
$petinfo = $this->user_io_m->init('id_user', $arr['iduser']);
$lock_sql = "INSERT INTO " . TBL_LOCKHISTORY . "\r\n\t\t\t\t\t(owner,pet,owner_email,pet_email,id_lock,pet_amount,owner_amount,lock_time,time_from,time_to,ip) \r\n\t\t\t\t\tVALUES('" . $ownerdataobj->username . "','" . $petinfo->username . "','" . $ownerdataobj->email . "','" . $petinfo->email . "'," . $arr['lockid'] . "," . $arr['totprice'] . "/2," . $arr['totprice'] . "/2," . $arr['totday'] . "*24,NOW(),ADDDATE(NOW(),'" . $arr['totday'] . "'),'" . $_SERVER['REMOTE_ADDR'] . "')";
$this->db->query($lock_sql);
debug("update lock history");
//For lock history ended on dt-30-12-10
$user_amount = $arr['totprice'] * $GLOBALS['global']['LOCKPET']['user'] / 100;
$site_amount = $arr['totprice'] * $GLOBALS['global']['LOCKPET']['site'] / 100;
$sql_trans = "INSERT INTO " . TBL_TRANSACTION . " \r\n\t\t\t\t\t\t(id_user,id_owner,facevalue,amount,trans_type,site_amt,user_amt,trans_date,ip) \r\n\t\t\t\t\tVALUES\r\n\t\t\t\t\t(" . $arr['iduser'] . "," . $ownerdataobj->id_user . ",0," . $arr['totprice'] . "," . $GLOBALS['global']['TRANS_TYPE']['petlock'] . "," . $site_amount . "," . $user_amount . ",NOW(),'" . $_SERVER['REMOTE_ADDR'] . "')";
$this->db->query($sql_trans);
debug("update transaction history");
//update wall
$sql_wall = "INSERT INTO " . TBL_WALL . " \r\n\t\t\t(id_user,action_to,trans_type,description,post_code,add_date_post) \r\n\t\t\tVALUES\r\n\t\t\t(" . $ownerdataobj->id_user . ",'" . $arr['petname'] . "'," . $GLOBALS['global']['TRANS_TYPE']['petlock'] . ",'with " . $arr['lockname'] . " for " . $arr['totday'] . " {$day}','" . $GLOBALS['global']['CHATTER_CODE']['pet_locked'] . "',NOW())";
$this->db->query($sql_wall);
$id_wall = $this->db->insert_id();
$this->user_io_m->postItemOnFbTt($id_wall, TIMELINE_LOCKPET);
debug("update wall");
//update cash to pet
//$ucase = $arr['totprice']/2;
$sql_updu = "UPDATE " . TBL_USER . " SET cash= cash+" . $user_amount . " WHERE id_user=" . $arr['iduser'];
$this->db->query($sql_updu);
debug("update cash pet");
//update cash to admin
$sql_upda = "UPDATE " . TBL_USER . " SET cash= cash+" . $site_amount . " WHERE id_admin=1";
$this->db->query($sql_upda);
debug("update cash admin");
//update cash to owner
$sql_updo = "UPDATE " . TBL_USER . " SET cash=cash-" . $arr['totprice'] . " WHERE id_user=" . getAccountUserId();
$this->db->query($sql_updo);
debug("update cash owner");
return true;
}
开发者ID:phonglanpls,项目名称:jz-proj-2012,代码行数:50,代码来源:lock_m.php
示例17: timediff
function timediff($last_time, $first_time = false)
{
// convert to unix timestamps
$last_time = mysql_to_unix($last_time);
if ($first_time) {
$first_time = mysql_to_unix($first_time);
} else {
$first_time = now();
// default now
}
// perform subtraction to get the difference (in seconds) between times
$time_diff = $last_time - $first_time;
// return the difference
return $time_diff;
}
开发者ID:groucho75,项目名称:ci_html5_auth_crud,代码行数:15,代码来源:MY_date_helper.php
示例18: mysql_to_human
function mysql_to_human($fecha = '', $tiempo = FALSE, $seconds = FALSE)
{
if ($fecha != '0000-00-00 00:00:00') {
$time = mysql_to_unix($fecha);
$r = date('d', $time) . '/' . date('m', $time) . '/' . date('Y', $time) . ' ';
if ($tiempo) {
$r .= date('H', $time) . ':' . date('i', $time);
if ($seconds) {
$r .= ':' . date('s', $time);
}
}
} else {
$r = '';
}
return $r;
}
开发者ID:ricardocasares,项目名称:Cobros,代码行数:16,代码来源:date_helper.php
示例19: _cron_unlockpet
function _cron_unlockpet()
{
$res = $this->db->where('lockstatus', 1)->get(TBL_PET)->result();
$unlockid = array();
for ($i = 0; $i < count($res); $i++) {
if (mysql_to_unix($res[$i]->lockexp_date) < mysql_to_unix(mysqlDate())) {
$unlockid[] = $res[$i]->id_pet;
}
}
if (count($unlockid)) {
for ($i = 0; $i < count($unlockid); $i++) {
$sql = "UPDATE " . TBL_PET . " SET lockstatus=0,addlock_date='0000-00-00 00:00:00',userprice=0,id_petlock=0,lockexp_date='0000-00-00 00:00:00',intr=0 WHERE id_pet=" . $unlockid[$i];
$this->db->query($sql);
}
}
}
开发者ID:phonglanpls,项目名称:jz-proj-2012,代码行数:16,代码来源:crontab_io_m.php
示例20: submitBuyPeepedAccess
function submitBuyPeepedAccess()
{
$userdataobj = getAccountUserDataObject(true);
$id_user = $this->input->post('id_user', 0);
$sellerdataobj = $this->user_io_m->init('id_user', $id_user);
$days = $this->input->post('days', 0);
$amountfee = $days * $sellerdataobj->peep_access;
$cash = $userdataobj->cash;
if ($cash < $amountfee) {
echo json_encode(array('result' => 'ERROR', 'message' => 'Your balance is not enough to access peeped.'));
exit;
}
if ($days < 1) {
echo json_encode(array('result' => 'ERROR', 'message' => 'Unknown error.'));
exit;
}
$data['id_buyer'] = getAccountUserId();
$data['id_user'] = $id_user;
$data['amount'] = $amountfee;
$data['ip'] = $this->geo_lib->getIpAddress();
$data['access_days'] = $days;
$data['buy_date'] = mysqlDate();
$data['exp_date'] = sysDateTimeFormat(mysql_to_unix($data['buy_date']) + 86400 * $days, 'Y-m-d H:i:s');
$id_history = $this->mod_io_m->insert_map($data, TBL_PEEPBOUGHT_HISTORY);
$site_amt = $amountfee * ($GLOBALS['global']['PEEP_PRICE']['site'] / 100);
$user_amt = $amountfee * ($GLOBALS['global']['PEEP_PRICE']['user'] / 100);
$transaction_data = array();
$transaction_data['id_owner'] = getAccountUserId();
$transaction_data['id_user'] = $data['id_user'];
$transaction_data['amount'] = $data['amount'];
$transaction_data['trans_type'] = $GLOBALS['global']['TRANS_TYPE']['buy_peeped'];
$transaction_data['site_amt'] = $site_amt;
$transaction_data['user_amt'] = $user_amt;
$transaction_data['trans_date'] = mysqlDate();
$transaction_data['ip'] = $this->geo_lib->getIpAddress();
$transaction_id = $this->mod_io_m->insert_map($transaction_data, TBL_TRANSACTION);
if ($transaction_id) {
$this->db->query("UPDATE " . TBL_USER . " SET cash= cash +'" . $site_amt . "' WHERE id_admin=1");
$this->db->query("UPDATE " . TBL_USER . " SET cash= cash -'" . $data['amount'] . "' WHERE id_user='" . getAccountUserId() . "'");
$this->db->query("UPDATE " . TBL_USER . " SET cash= cash +'" . $user_amt . "' WHERE id_user='" . $data['id_user'] . "'");
}
$CMCHATMSG = str_replace(array('$u1', '$u2', '$p3'), array($userdataobj->username, $sellerdataobj->username, $amountfee), language_translate('hook_chat_buy_peep_access'));
echo json_encode(array('result' => 'ok', 'message' => 'Buy peeped access successfully.', 'CMCHATMSG' => $CMCHATMSG));
$this->email_sender->juzonSendEmail_JUZ_WHO_BOUGHT_WHO_PEEPED_ME($transaction_data['id_owner'], $transaction_data['id_user'], $transaction_data['amount']);
exit;
}
开发者ID:phonglanpls,项目名称:jz-proj-2012,代码行数:46,代码来源:peeped_access_io_m.php
注:本文中的mysql_to_unix函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论