private function generate_coupon() { $this->loadS_model('discount'); $token = random_token(6); $is_exists = $this->Model_discount->get_discount($token); if ($is_exists) { $token = $this->generate_coupon(); } die(strtoupper($token)); }
header("location: ../index.php?e=expired"); exit; } } if (isset($_SESSION['ip']) && $_SESSION['ip'] != retrive_ip()) { session_unset(); session_destroy(); header("location: ../index.php?e=local"); exit; } if (!isset($_SESSION['status']) || $_SESSION['status'] > 2) { header("location: ../index.php"); exit; } if (!isset($_SESSION['token']['act'])) { $_SESSION['token']['act'] = random_token(7); } include_once '../php/config/database.php'; if (is_file('../php/config/setting.txt')) { $setting = file('../php/config/setting.txt', FILE_IGNORE_NEW_LINES); } include_once '../php/mobileESP.php'; $uagent_obj = new uagent_info(); $isMob = $uagent_obj->DetectMobileQuick(); try { $DBH = new PDO("mysql:host={$Hostname};dbname={$DatabaseName}", $Username, $Password); $DBH->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); if ($_SESSION['status'] == 2 || $_SESSION['status'] == 1) { $query = "SELECT \n\t\t\t\t\t\t\ta.id,\n\t\t\t\t\t\t\ta.enabled,\n\t\t\t\t\t\t\ta.ref_id,\n\t\t\t\t\t\t\ta.title,\n\t\t\t\t\t\t\ta.user_id,\n\t\t\t\t\t\t\ta.operator_id,\n\t\t\t\t\t\t\ta.ticket_status,\n\t\t\t\t\t\t\ta.department_id,\n\t\t\t\t\t\t\ta.website,\n\t\t\t\t\t\t\ta.contype,\n\t\t\t\t\t\t\ta.ftp_user,\n\t\t\t\t\t\t\ta.ftp_password,\n\t\t\t\t\t\t\ta.enc_key,\n\t\t\t\t\t\t\tb.rate,\n\t\t\t\t\t\t\tb.note,\n\t\t\t\t\t\t\tc.reason,\n\t\t\t\t\t\t\td.free,\n\t\t\t\t\t\t\tIF(d.free=0,a.support_time,NULL) AS support_time\n\t\t\t\t\t\tFROM " . $SupportTicketsTable . " a\n\t\t\t\t\t\tLEFT JOIN " . $SupportRateTable . " b\n\t\t\t\t\t\t\tON b.id=a.id\n\t\t\t\t\t\tLEFT JOIN " . $SupportFlagTable . " c\n\t\t\t\t\t\t\tON (c.tk_id=a.id AND c.usr_id='" . $_SESSION['id'] . "')\n\t\t\t\t\t\tLEFT JOIN " . $SupportDepaTable . " d\n\t\t\t\t\t\t\tON d.id=a.department_id\n\t\t\t\t\t\tWHERE a.id=? LIMIT 1"; } else { $query = "SELECT \n\t\t\t\t\t\t\ta.id,\n\t\t\t\t\t\t\ta.enabled,\n\t\t\t\t\t\t\ta.ref_id,\n\t\t\t\t\t\t\ta.title,\n\t\t\t\t\t\t\ta.user_id,\n\t\t\t\t\t\t\ta.operator_id,\n\t\t\t\t\t\t\ta.ticket_status,\n\t\t\t\t\t\t\ta.department_id,\n\t\t\t\t\t\t\ta.website,\n\t\t\t\t\t\t\ta.contype,\n\t\t\t\t\t\t\ta.ftp_user,\n\t\t\t\t\t\t\ta.ftp_password,\n\t\t\t\t\t\t\ta.enc_key,\n\t\t\t\t\t\t\tb.rate,\n\t\t\t\t\t\t\tb.note,\n\t\t\t\t\t\t\tc.reason,\n\t\t\t\t\t\t\td.free,\n\t\t\t\t\t\t\tIF(d.free=0,a.support_time,NULL) AS support_time\n\t\t\t\t\t\tFROM " . $SupportTicketsTable . " a\n\t\t\t\t\t\tLEFT JOIN " . $SupportRateTable . " b\n\t\t\t\t\t\t\tON b.id=a.id\n\t\t\t\t\t\tLEFT JOIN " . $SupportFlagTable . " c\n\t\t\t\t\t\t\tON (c.tk_id=a.id AND c.usr_id=" . $_SESSION['id'] . ")\n\t\t\t\t\t\tLEFT JOIN " . $SupportDepaTable . " d\n\t\t\t\t\t\t\tON d.id=a.department_id\n\t\t\t\t\t\tWHERE a.id=? AND a.user_id=" . $_SESSION['id'] . " LIMIT 1";
function create_tokens($file, $howmany, $uses, $expire) { $tokens = array(); for ($i = 1; $i <= $howmany; $i++) { do { $token = random_token(); $skip = is_numeric($token) or query("SELECT token FROM tokens WHERE token = %s", $token, QUERY_SINGLEVALUE); } while ($skip); query("INSERT INTO tokens (token, file, uses_remaining, initial_uses, created, expires) VALUES (%s, %d, %d, %d, NOW(), %s)", array($token, $file, $uses, $uses, $expire), QUERY_NONE); $tokens[] = array($token, $uses, $expire); } return $tokens; }
public function get_unique_invice_id($length = 8) { $randomString = random_token($length); if ($this->getData(TBL_BOOKING, array('invoice_id' => $randomString))) { return $this->get_unique_invice_id($length); } return strtoupper($randomString); }
unset($_SESSION['update_token']); $_SESSION['update_token'] = ''; } } $_SESSION['update_token'] = ''; $show_form = 0; } } else { // START SHOW MESSAGE COMPOSE FORM // Get to_id $show_form = 1; $to_uid = (int) mysql_real_escape_string($_GET['uid']); $message_id = (int) mysql_real_escape_string($_GET['id']); unset($_SESSION['update_token']); $_SESSION['update_token'] = ''; $update_token = random_token(); $_SESSION['update_token'] = $update_token; //Check if member exists if ($to_uid != "") { $sql = "SELECT user_name FROM member_profile WHERE user_id = {$to_uid} AND account_status = 'active'"; $result = @mysql_query($sql); //Check if members is active if (@mysql_num_rows($result) == 0 && $proceed == true) { $blk_notification = 1; $message_type = $config['word_error']; $error_message = $config['error_2']; //user could not be found } else { $sql = "SELECT * FROM privacy WHERE user_id = {$to_uid}"; $result = @mysql_fetch_array(@mysql_query($sql)); if ($result['privatemessage'] == 'no') {
public function request_password_reset_driver() { $email_id = $this->request('email_id', true); $this->loadS_model('driver'); $driver = $this->Model_driver->get_driver($email_id); if (!$driver) { $this->_die("The driver does not exists."); } $random_token = random_token(5); $this->Model_driver->update(array('token' => $random_token), $driver['id']); $this->setSuccess("Request has been registered."); $this->setData('token', $random_token); $this->response(); }