本文整理汇总了PHP中mysqlDate函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqlDate函数的具体用法?PHP mysqlDate怎么用?PHP mysqlDate使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysqlDate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submitAnswerQuestion
function submitAnswerQuestion()
{
$id_question = $this->input->post("id_question");
$answer = $this->input->post("answer");
$questionRecord = $this->qa_m->getRecord_Question($id_question);
$array['answer'] = substr($answer, 0, $GLOBALS['global']['INPUT_LIMIT']['askme_answer']);
$array['id_askmeq'] = $id_question;
$array['asked_by'] = $questionRecord->asked_by;
$array['ans_by'] = getAccountUserId();
$array['ans_date'] = mysqlDate();
$this->mod_io_m->insert_map($array, TBL_ASK_ANSWER);
//update question status
$update['q_status'] = 1;
$this->mod_io_m->update_map($update, array('id_askmeq' => $id_question), TBL_ASK_QUESTION);
//also insert into wall feed
$wall['id_parent'] = 0;
$wall['id_user'] = getAccountUserId();
$wall['description'] = $array['answer'];
$wall['add_date_post'] = mysqlDate();
$wall['post_id'] = 0;
$wall['id_ques'] = $id_question;
$id_wall = $this->mod_io_m->insert_map($wall, TBL_WALL);
echo 'ok';
$this->email_sender->juzonSendEmail_JUZ_ASKME_ANSWER($array['asked_by'], $array['ans_by'], $array['answer']);
$this->user_io_m->postItemOnFbTt($id_wall, TIMELINE_AKSME_ANSWER);
exit;
}
示例2: get_current_loan
/**
* Get current loan related to this item, if one exists
*
* Attribute name : current_loan (NULL if item is currently not loaned)
*/
protected function get_current_loan($item)
{
$this->load->model('loan_model');
$this->load->helper('date');
$where = "item_id=" . $item->item_id . " AND " . "date<='" . mysqlDate('now') . "' AND " . "real_return_date IS NULL";
$item->current_loan = $this->loan_model->get_by($where);
return $item;
}
示例3: createEventFromPost
function createEventFromPost()
{
if (isset($_POST, $_FILES)) {
return array("title" => $_POST["title"], "description" => $_POST["description"], "pub_date" => mysqlDate($_POST["pub_date"]), "event_date" => mysqlDate($_POST["event_date"]), "image_name" => $_FILES["files"]["name"][0], "image_tmp_name" => $_FILES["files"]["tmp_name"][0], "image_size" => $_FILES["files"]["size"][0], "image_type" => $_FILES["files"]["type"][0], "image_err" => $_FILES["files"]["error"][0]);
} else {
echo "retrieval of post data failed";
exit;
}
}
示例4: submitReportAbuse
function submitReportAbuse()
{
$data['id_user'] = $this->input->post('id_user');
$data['id_reporter'] = getAccountUserId();
$data['message'] = substr($this->input->post('message'), 0, $GLOBALS['global']['INPUT_LIMIT']['askmeq']);
$data['datetime'] = mysqlDate();
$this->mod_io_m->insert_map($data, TBL_REPORT_ABUSE);
echo 'ok';
exit;
}
示例5: saveSearchInfo
function saveSearchInfo($arr)
{
$mypetsearch = $this->db->where('id_user', getAccountUserId())->get(TBL_PETSEARCH)->result();
$arr['id_user'] = getAccountUserId();
$arr['add_date'] = mysqlDate();
$arr['ip'] = $this->geo_lib->getIpAddress();
if ($mypetsearch) {
$this->mod_io_m->update_map($arr, array('id_pet_search' => $mypetsearch[0]->id_pet_search), TBL_PETSEARCH);
} else {
$this->mod_io_m->insert_map($arr, TBL_PETSEARCH);
}
}
示例6: updateComment
function updateComment()
{
$id_photo = $this->input->get('id_photo');
$comment = $this->input->get('comment');
$data['id_wall'] = $id_photo;
$data['comment'] = $comment;
$data['comment_by'] = getAccountUserId();
$data['comm_date'] = mysqlDate();
$data['ip'] = $this->geo_lib->getIpAddress();
$this->mod_io_m->insert_map($data, TBL_PHOTO_COMMENT);
$this->email_sender->juzonSendEmail_JUZ_PHOTO_COMMENT($data['comment_by'], $id_photo, $comment);
return true;
}
示例7: addToWishList
function addToWishList()
{
$id_user = $this->input->get('id_user', 0);
$wishlistdata = $this->seekWishListRecord($owner_id = getAccountUserId(), $id_user);
if (!$wishlistdata) {
$data['id_owner'] = $owner_id;
$data['id_user'] = $id_user;
$data['date'] = mysqlDate();
$data['ip'] = $this->geo_lib->getIpAddress();
$this->mod_io_m->insert_map($data, TBL_WISHLIST);
}
echo "<a href=\"javascript:void(0);\" onclick=\"callFuncRemoveFromWishList({$id_user});\">\r\n\t\t\t\t" . language_translate('wishlist_remove_label') . "\r\n\t\t\t</a>";
exit;
}
示例8: 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;
}
示例9: getByDate
function getByDate($dbh, $date)
{
$sql = "SELECT id, title, description, pub_date, event_date," . "image_path FROM `events` WHERE pub_date=:date;";
try {
$sth = $dbh->prepare($sql);
$sth->bindValue(":date", mysqlDate($date));
$results = array();
$sth->execute();
} catch (PDOException $e) {
echo "select by date failed: " . $e->getMessage();
}
$results = $sth->fetchAll(PDO::FETCH_ASSOC);
$dbh = null;
return $results;
}
示例10: _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);
}
}
}
示例11: 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;
}
示例12: saveAccountToSessionInfo
function saveAccountToSessionInfo($id_user)
{
$dataobj = $this->init('id_user', $id_user);
$_SESSION['joz_account']['id_user'] = $id_user;
$_SESSION['joz_account']['dataobj'] = $dataobj;
$user['last_login'] = mysqlDate();
$this->update_map($user, $id_user);
if ($dataobj) {
$data['id_user'] = $dataobj->id_user;
$data['ip'] = $this->geo_lib->getIpAddress();
$data['date_login'] = mysqlDate();
$data['username'] = $dataobj->username;
$data['status'] = 1;
$data['failure_attempt'] = 0;
$data['email'] = $dataobj->email;
$this->mod_io_m->insert_map($data, TBL_LOGIN);
}
}
示例13: buyFavouriteAccessPackage
function buyFavouriteAccessPackage()
{
$userdata = getAccountUserDataObject(true);
if ($userdata->cash < $GLOBALS['global']['ADMIN_DEFAULT']['favourite']) {
echo json_encode(array('result' => 'error', 'message' => "Your balance is not enough to buy this package."));
exit;
}
$sql = "INSERT INTO " . TBL_TRANSACTION . " (id_owner,id_user,amount,trans_type,site_amt,trans_date,ip) \r\n\t\t\t\t\tVALUES('" . getAccountUserId() . "',1,'" . $GLOBALS['global']['ADMIN_DEFAULT']['favourite'] . "','" . $GLOBALS['global']['TRANS_TYPE']['favourite'] . "','" . $GLOBALS['global']['ADMIN_DEFAULT']['favourite'] . "',NOW(),'" . $_SERVER['REMOTE_ADDR'] . "')";
$this->db->query($sql);
$this->db->query("UPDATE " . TBL_USER . " SET cash= cash +'" . $GLOBALS['global']['ADMIN_DEFAULT']['favourite'] . "' WHERE id_admin=1");
$this->db->query("UPDATE " . TBL_USER . " SET cash= cash -'" . $GLOBALS['global']['ADMIN_DEFAULT']['favourite'] . "' WHERE id_user='" . getAccountUserId() . "'");
$data['id_user'] = getAccountUserId();
$data['price'] = $GLOBALS['global']['ADMIN_DEFAULT']['favourite'];
$data['datetime'] = mysqlDate();
$this->mod_io_m->insert_map($data, TBL_FAVOURITE_BUY_LOG);
echo json_encode(array('result' => 'ok', 'message' => "Buy Favourite View Package successfully."));
exit;
}
示例14: sendMessage
function sendMessage()
{
$gender = $this->input->post('gender');
$type = $this->input->post('type');
$message = substr($this->input->post('message'), 0, $GLOBALS['global']['INPUT_LIMIT']['random_message']);
$sql = "SELECT u.id_user FROM " . TBL_USER . " u, " . TBL_FRIENDLIST . " f WHERE u.status=0 ";
$cond = '';
if ($type == 'friend') {
$my_id_user = getAccountUserId();
$cond .= " AND ( (u.id_user=f.id_user AND f.friend={$my_id_user}) OR ( f.friend=u.id_user AND f.id_user={$my_id_user}) ) AND f.request_type=0 ";
}
if ($gender != 'Both') {
$cond .= " AND u.gender= '{$gender}'";
}
$offset_result = $this->db->query(" SELECT FLOOR(RAND() * COUNT(*)) AS offset FROM " . TBL_USER . " u, " . TBL_FRIENDLIST . " f WHERE u.status=0 {$cond}")->result();
if (!$offset_result) {
echo json_encode(array('result' => 'ERROR', 'message' => 'No such user found. Send failure.'));
exit;
}
$offset = $offset_result[0]->offset;
$res = $this->db->query(" SELECT u.id_user FROM " . TBL_USER . " u, " . TBL_FRIENDLIST . " f WHERE u.status=0 {$cond} LIMIT {$offset},1")->result();
if (!$res) {
echo json_encode(array('result' => 'ERROR', 'message' => 'No such user found. Send failure.'));
exit;
}
$id_user = $res[0]->id_user;
$data['id_user_from'] = getAccountUserId();
$data['id_user_to'] = $id_user;
$data['message'] = $message;
$data['sentdate'] = mysqlDate();
if ($this->online_m->checkOnlineUser($id_user)) {
//send chat message ...
$data['type_message'] = 0;
include_once './cometchat/cometchat_init.php';
sendMessageTo($data['id_user_to'], $data['message']);
} else {
//send email
$data['type_message'] = 1;
$this->email_sender->juzonSendEmail_RANDOMMESSAGEEMAIL($id_user, $message);
}
$this->mod_io_m->insert_map($data, TBL_RANDOM_MESSAGE);
echo json_encode(array('result' => 'ok', 'message' => 'Send successfully.'));
exit;
}
示例15: saveMapFlirtSearch
function saveMapFlirtSearch($input)
{
$mysearch = $this->db->where('id_user', getAccountUserId())->get(TBL_MAPFLIRT_SEARCH)->result();
$arr['id_user'] = getAccountUserId();
$arr['datetime'] = mysqlDate();
$arr['gender'] = $input['gen'];
$arr['age_from'] = $input['agefrom'];
$arr['age_to'] = $input['ageto'];
$arr['distance'] = $input['distance'];
$arr['country'] = $input['country_name'];
$arr['status'] = $input['status'];
$arr['map'] = $input['mapvalue'];
$arr['photo'] = $input['photo'];
if (!$mysearch) {
$this->mod_io_m->insert_map($arr, TBL_MAPFLIRT_SEARCH);
} else {
$this->mod_io_m->update_map($arr, array('id_mapflirt_search' => $mysearch[0]->id_mapflirt_search), TBL_MAPFLIRT_SEARCH);
}
}