function ForgotPassword($row) { Module::Module($row); $user_id = (int) Url::get('id'); if ($user_id) { $user = DB::fetch("SELECT user_name,email FROM user WHERE id={$user_id}"); if ($user && md5($user['user_name'] . $user['email']) == Url::get('u')) { $new_password = $this->random_string(); $user_name = $user['user_name']; $subject = 'Khôi phục mật khẩu thành công!'; $messenger = file_get_contents('templates/ForgotPassword/reset_password.html'); $message = str_replace('[[|user_name|]]', $user_name, $messenger); $message = str_replace('[[|password|]]', $new_password, $message); if (System::sendEBEmail($user['email'], $subject, $message)) { DB::update('user', array('password' => User::encode_password($new_password)), "id={$user_id}"); Url::redirect_current(array('action' => 'reset_success')); } else { Url::redirect_current(array('action' => 'reset_error')); } } else { Url::redirect('home'); } } require_once 'forms/forgot_password.php'; $this->add_form(new ForgotPasswordForm()); }
function on_submit() { $reply_content = trim(Url::get('reply_content')); $subject = AZLib::stripUnicode(trim(Url::get('subject'))); if (strlen($reply_content) > 20) { //Gửi mail đã: if ($subject == '') { $subject = "Tra loi lien he cua ban... ( Reply for your feedback... )"; } $content = $reply_content . MAIL_FOOTER . "<hr />" . "<b>Nội dung ý kiến / liên hệ của bạn đã gửi cho chúng tôi vào lúc: " . date('H:i:s d/m/Y', $this->contact['time']) . ":</b><br />\n\t\t\t\t\t\t<b>"</b>" . stripslashes($this->contact['content']) . "<b>"</b>"; if (System::sendEBEmail($this->contact['email'], "[" . WEB_NAME . "] {$subject}", $content)) { $reply_content = stripslashes($this->contact['reply_content']) . "<a href='" . Url::build('profile', array('id' => User::id())) . "'>" . User::user_name() . "</a> Gửi lúc: " . date('H:i:s d/m/Y', TIME_NOW) . "<br /><b>Email Subject:</b> " . $subject . "<br /><br />" . $reply_content . '<hr />'; if (DB::update('feedback', array('reply_content' => addslashes($reply_content), 'status' => 1), 'id=' . $this->contact['id'])) { //Gửi mail cho admin System::sendEBEmail(FEEDBACK_EMAIL, "[" . WEB_NAME . "] " . 'Reply for feedback: ' . $this->contact['name'] . ' - ' . $this->contact['address'] . ' - ' . $this->contact['email'], $content); Url::redirect_current(); } else { $this->setFormError('', 'Không cập nhật được dữ liệu'); } } else { $this->setFormError('subject', 'Không gửi được email tới khách hàng!'); } //End gửi mail } else { $this->setFormError('reply_content', 'Nội dung phản hồi phải lớn hơn 20 ký tự'); } }
function on_submit() { $captcha_register = Url::get('captcha_register'); $email = Url::get('email'); if ($email && isset($_SESSION["enbac_validate"]) && $captcha_register != '' && $captcha_register == $_SESSION["enbac_validate"]) { if ($row = DB::fetch("SELECT id,user_name,email FROM user WHERE email ='{$email}'")) { $id = $row['id']; $user = $row['user_name']; $email = $row['email']; $link1 = '<a href="' . WEB_ROOT . AZRewrite::formatUrl('?page=forgot_password&u=' . md5($user . $email) . '&id=' . $id) . '"><b>Khôi phục Mật khẩu</b></a>'; $link2 = '<a href="' . WEB_ROOT . AZRewrite::formatUrl('?page=forgot_password&u=' . md5($user . $email) . '&id=' . $id) . '"><b>Khoi phuc Mat khau</b></a>'; $message = file_get_contents('templates/ForgotPassword/messenger.html'); $message = str_replace('[[|link1|]]', $link1, $message); $message = str_replace('[[|link2|]]', $link2, $message); $message = str_replace('[[|user|]]', $user, $message); if (System::sendEBEmail($email, 'Khôi phục mật khẩu!', $message)) { Url::redirect_current(array('action' => 'success')); } else { Url::redirect_current(array('action' => 'error')); } } } }
function register_service_exten() { if (!User::is_login()) { echo "not_login"; exit; } if (User::is_block()) { echo "no_permission"; exit; } //get user $user = User::$current->data; $user_name = $user['user_name']; //Kieu thanh toan $payment_types = (int) Url::get('payment_types'); //Thong tin gia han $order_service_id = (int) Url::get('order_service_id', 0); //id order service $time_exten = (int) Url::get('time_exten', 0); //thoi gian gia han (thang) $aryOrderService = array(); if ($order_service_id) { $aryOrderService = DB::select("order_services", "id={$order_service_id}"); } if ($aryOrderService) { //kiểm tra thông tin đầu vào if ($aryOrderService['user_use'] != $user_name) { echo "error"; exit; } if ($aryOrderService['active'] != 1) { echo "error"; exit; } $price = $aryOrderService['price'] / $aryOrderService['time_use'] * $time_exten; } else { echo "error"; exit; } if ($payment_types == 1) { $full_name = Url::get("full_name"); $mobile = Url::get("mobile"); if (!$full_name || !$mobile) { echo "error"; exit; } $price = $aryOrderService['price'] / $aryOrderService['time_use'] * $time_exten; $orderInfo = array("user_use" => $user_name, "type_scs" => $aryOrderService['type_scs'], "date_reg" => TIME_NOW, "up_count" => $aryOrderService['up_count'], "cpc_count" => $aryOrderService['cpc_count'], "item_count" => $aryOrderService['item_count'], "take_care" => $aryOrderService['take_care'], "price" => $price, "payment_types" => $payment_types, "time_use" => $time_exten, "active" => -4, "reg_exten_stt" => 1); //insert $id = DB::insert('order_services', $orderInfo); if ($id) { $order_code = "GH_{$order_service_id}_{$id}"; $return_url = WEB_ROOT . "payment_scs.html?cmd=complete_exten&exten_order_id={$id}&payment_types=1&order_service_id={$order_service_id}&time_exten={$time_exten}"; $transaction_info = "Thanh toán DV gia hạn Siêu Chăm Sóc {$aryOrderService['type_scs']} cho {$full_name} [ {$user['user_name']} ], số ĐT liên hệ: {$mobile}"; $order_email = $user['email']; //insert payment_scs exten $pay_info = $full_name . "," . $user['email'] . "," . $mobile . "," . $aryOrderService['type_scs']; $paymentInfo = array("order_service_id" => $id, "user_id" => $user['id'], "user_name" => $user['user_name'], "payment_types" => $payment_types, "payment_type_soha" => 0, "payment_info" => $pay_info, "order_code" => $order_code, "price" => $price, "time" => time(), "error_text" => "Đang chờ thanh toán", "payment_status" => -1, "reg_exten_stt" => 1); //insert DB::insert('payment_scs', $paymentInfo); //Tạo link thanh toán đến Soha Payment $url = SohaPay::buildCheckoutUrl($return_url, $transaction_info, $order_code, $price, $order_email, SCS_MERCHANT_SITE_CODE, SCS_SECURE_CODE); echo $url; exit; } else { echo "error_connect"; exit; } } else { if ($payment_types == 2) { global $display; if ($aryOrderService) { $orderInfo = array("user_use" => $user_name, "type_scs" => $aryOrderService['type_scs'], "date_reg" => TIME_NOW, "up_count" => $aryOrderService['up_count'], "cpc_count" => $aryOrderService['cpc_count'], "item_count" => $aryOrderService['item_count'], "take_care" => $aryOrderService['take_care'], "price" => $price, "payment_types" => $payment_types, "time_use" => $time_exten, "active" => -3, "reg_exten_stt" => 1); //insert $id = DB::insert('order_services', $orderInfo); } if ($id) { $payment_info = ""; $full_name = AZLib::getParam('ho_ten'); $dienthoai = AZLib::getParam('dien_thoai'); $dia_chi = AZLib::getParam('dia_chi'); $thanh_pho = AZLib::getParam('thanh_pho'); $ngay = AZLib::getParam('ngay'); $time = AZLib::getParam('time'); $payment_info .= $full_name . "," . $dienthoai . "," . $dia_chi . "," . $thanh_pho . "," . $ngay . "," . $time; //Send email here; $display->add('eb_url', WEB_ROOT); $display->add('user_id', $user['id']); $display->add('user_name', $user['user_name']); $display->add('full_name', $full_name); $display->add('dia_chi', $dia_chi); $display->add('thanh_pho', SohaPay::infoForUser($thanh_pho, 'tp')); $display->add('ngay', $ngay); $display->add('time', SohaPay::infoForUser($time, 'time')); $display->add('service_name', $aryOrderService['type_scs']); $display->add('price', number_format($price)); $display->add('time_exten', $time_exten); $content_email = $display->output('payment_online_exten_2', 1, 'PaymentScs'); $send_mail_stt = "-1"; if (System::sendEBEmail($user['email'], '[AzNetGroup] Gia hạn thành công dịch vụ Siêu Chăm Sóc!', $content_email)) { $send_mail_stt = "1"; } //tao mang du lieu cho bang payment scs $paymentInfo = array("order_service_id" => $id, "user_id" => $user['id'], "user_name" => $user['user_name'], "payment_types" => $payment_types, "payment_info" => $payment_info, "price" => $price, "payment_status" => 0, "send_mail_stt" => $send_mail_stt, "reg_exten_stt" => 1); //insert DB::insert('payment_scs', $paymentInfo); $url = WEB_ROOT . "payment_scs.html?cmd=payment_finish&id={$id}&exten=1"; echo $url; exit; } } else { if ($payment_types == 3) { global $display; if ($aryOrderService) { $orderInfo = array("user_use" => $user_name, "type_scs" => $aryOrderService['type_scs'], "date_reg" => TIME_NOW, "up_count" => $aryOrderService['up_count'], "cpc_count" => $aryOrderService['cpc_count'], "item_count" => $aryOrderService['item_count'], "take_care" => $aryOrderService['take_care'], "price" => $price, "payment_types" => $payment_types, "time_use" => $time_exten, "active" => -3, "reg_exten_stt" => 1); //insert $id = DB::insert('order_services', $orderInfo); } if ($id) { $payment_info = ""; if ($user['mobile_phone'] == "") { $phone = $user['home_phone']; } else { $phone = $user['mobile_phone']; } $payment_info .= $user['email'] . "," . $phone; //Send email here; $display->add('eb_url', WEB_ROOT); $display->add('user_id', $user['id']); $display->add('user_name', $user['user_name']); $display->add('service_name', $aryOrderService['type_scs']); $display->add('price', number_format($price)); $display->add('time_exten', $time_exten); $content_email = $display->output('payment_online_reg_3', 1, 'PaymentScs'); $send_mail_stt = "-1"; if (System::sendEBEmail($user['email'], '[AzNetGroup] Gia hạn thành công dịch vụ Siêu Chăm Sóc!', $content_email)) { $send_mail_stt = "1"; } //tao mang du lieu cho bang payment scs $paymentInfo = array("order_service_id" => $id, "user_id" => $user['id'], "user_name" => $user['user_name'], "payment_types" => $payment_types, "payment_info" => $payment_info, "price" => $price, "payment_status" => 0, "send_mail_stt" => $send_mail_stt, "reg_exten_stt" => 1); //insert DB::insert('payment_scs', $paymentInfo); $url = WEB_ROOT . "payment_scs.html?cmd=payment_finish&id={$id}&exten=1"; echo $url; exit; } } else { if ($payment_types == 4) { global $display; if ($aryOrderService) { $orderInfo = array("user_use" => $user_name, "type_scs" => $aryOrderService['type_scs'], "date_reg" => TIME_NOW, "up_count" => $aryOrderService['up_count'], "cpc_count" => $aryOrderService['cpc_count'], "item_count" => $aryOrderService['item_count'], "take_care" => $aryOrderService['take_care'], "price" => $price, "payment_types" => $payment_types, "time_use" => $time_exten, "active" => -3, "reg_exten_stt" => 1); //insert $id = DB::insert('order_services', $orderInfo); } if ($id) { $banking_type = Url::get('banking_type'); $banking_code = SohaPay::listBankCode($banking_type); $payment_info = ""; if ($user['mobile_phone'] == "") { $phone = $user['home_phone']; } else { $phone = $user['mobile_phone']; } $payment_info .= $user['email'] . "," . $phone . "," . $banking_code; //Send email here; $display->add('eb_url', WEB_ROOT); $display->add('user_id', $user['id']); $display->add('user_name', $user['user_name']); $display->add('service_name', $aryOrderService['type_scs']); $display->add('price', number_format($price)); $display->add('banking_type', $banking_type); $display->add('accNumber', SohaPay::listAccountNumber($banking_code)); $display->add('banking_name', SohaPay::listBanking($banking_code)); $display->add('banking_note', SohaPay::listBanking($banking_code, true)); $display->add('time_exten', $time_exten); $content_email = $display->output('payment_online_reg_4', 1, 'PaymentScs'); $send_mail_stt = "-1"; if (System::sendEBEmail($user['email'], '[AzNetGroup] Gia hạn thành công dịch vụ Siêu Chăm Sóc!', $content_email)) { $send_mail_stt = "1"; } //tao mang du lieu cho ban payment scs $paymentInfo = array("order_service_id" => $id, "user_id" => $user['id'], "user_name" => $user['user_name'], "payment_types" => $payment_types, "payment_info" => $payment_info, "price" => $price, "payment_status" => 0, "send_mail_stt" => $send_mail_stt, "reg_exten_stt" => 1); //insert DB::insert('payment_scs', $paymentInfo); $url = WEB_ROOT . "payment_scs.html?cmd=payment_finish&id={$id}&exten=1"; echo $url; exit; } } } } } }
function active_user($user, $active_code) { $active = DB::select('user_active', 'user_id=' . $user['id']); if ($active) { //Nếu user chưa được kích hoạt $success = false; if (USER_ACTIVE_ON) { //Nếu bật chế độ active tài khoản if ($active['active_code'] == $active_code && $active_code) { DB::query('UPDATE user SET is_active=0 WHERE id=' . $user['id']); DB::delete('user_active', 'user_id=' . $user['id']); User::getUser($user['id'], 0, 1); $success = true; } else { $this->setFormError('', 'Mã kích hoạt không đúng!'); } } else { if ($active['active_code'] == $active_code && $active_code) { DB::query('UPDATE user SET is_active=0 WHERE id=' . $user['id']); DB::delete('user_active', 'user_id=' . $user['id']); User::getUser($user['id'], 0, 1); $success = true; } else { DB::query('UPDATE user SET is_active=0 WHERE id=' . $user['id']); DB::delete('user_active', 'user_id=' . $user['id']); User::getUser($user['id'], 0, 1); Url::redirect('sign_in'); } } if ($success) { //Đăng nhập cho user, gửi mail thông báo đã kích hoạt! $_SESSION['is_load_page_first'] = 1; User::LogIn($user['id']); if (USER_ACTIVE_ON) { //Gửi mail thông báo thành công global $display; $display->add('eb_url', WEB_ROOT); $display->add('user_id', $user['id']); $display->add('user_name', $user['user_name']); $content_email = $display->output('send_activated_mail', 1); System::sendEBEmail($user['email'], 'Kích hoạt tài khoản thành công!', $content_email); } Url::redirect_current(array('cmd' => 'activated')); } } else { if ($this->user['is_active'] == 1) { //Nếu chưa kích hoạt DB::query('UPDATE user SET is_active=0 WHERE id=' . $user['id']); User::getUser($user['id'], 0, 1); Url::redirect('sign_in'); } else { $this->show_active = 0; $this->setFormError('', 'Tài khoản đã được kích hoạt rồi!'); } } }
function on_submit() { if (User::checkLock4Ever(1)) { Url::redirect_current(); } //check bảo mật $just_registed_s = 0; $just_registed_c = 0; if (isset($_SESSION['just_registed'])) { $just_registed_s = $_SESSION['just_registed']; } if (isset($_COOKIE['just_registed'])) { $just_registed_c = $_COOKIE['just_registed']; } if ($just_registed_s > TIME_NOW - 120 || $just_registed_c > TIME_NOW - 120 || !REG_ON) { Url::redirect_current(); } //END check bảo mật // check de ban IP $ip = AZLib::ip(); $arr_badwords = AZLib::checkBadWord($ip, true); if ($arr_badwords["bad"] != "" && $arr_badwords["bad_key"] != "") { $this->setFormError('ban_ip', "Có lỗi xẩy ra"); } // end check de ban IP $full_name = Url::get('full_name'); $email = Url::get('email'); $user_name = Url::get('register_user_name'); $mobile_phone = AZLib::trimSpace(Url::get('mobile_phone')); $password = AZLib::trimSpace(Url::get('register_password')); $confirm_password = AZLib::trimSpace(Url::get('confirm_password')); $this->checkFormInput('Tên đầy đủ', 'full_name', $full_name, 'str', false, '', 0, 50); $this->checkFormInput('Email', 'email', $email, 'email', true, '', 6, 50); $this->checkFormInput('Tên truy cập', 'user_name', $user_name, 'uname', true, '', 4, 50); $this->checkFormInput('Điện thoại di động', 'mobile_phone', $mobile_phone, 'str', false, '', 0, 50); $this->checkFormInput('Mật khẩu truy cập', 'register_password', $password, 'str', true, '', 6, 50); $this->checkFormInput('Nhập lại mật khẩu', 'confirm_password', $confirm_password, 'str', true, '', 6, 50); if (!$this->errNum) { if ($password != $confirm_password) { $this->setFormError('captcha_register', "Nhập lại Mật khẩu truy cập không khớp!"); return; } } $captcha_register = Url::get('captcha_register'); if ($mobile_phone && !AZLib::is_mobile($mobile_phone)) { $mobile_phone = ""; } if ($captcha_register == '') { $this->setFormError('captcha_register', "Bạn chưa nhập <b>Mã bảo mật</b>!"); } else { if (!isset($_SESSION["enbac_validate"]) || $captcha_register != $_SESSION["enbac_validate"]) { $this->setFormError('captcha_register', "<b>Mã bảo mật</b> không chính xác!"); } } if ((int) Url::get('confirm_register') != 1) { $this->setFormError('confirm_register', "Bạn phải đọc và đồng ý với những <a target=\"_blank\" href=\"http://help.enbac.com/content/4/5/en/Quy-che-thanh-vien.html\" >điều khoản của Enbac.com</a>!"); } if (!$this->errNum) { if (DB::exists('SELECT id FROM `user` WHERE `email`="' . $email . '"')) { $this->setFormError('email', "<b>Email</b> bạn chọn đã tồn tại, hãy chọn lại một <b>Email</b> khác!"); } elseif (DB::exists('SELECT id FROM `user` WHERE `user_name`="' . $user_name . '"')) { $this->setFormError('email', "<b>Tên truy cập</b> bạn chọn đã tồn tại, hãy chọn lại một <b>Tên truy cập</b> khác!"); } else { $user_info = array('user_name' => $user_name, 'email' => $email, 'password' => User::encode_password($password), 'full_name' => $full_name, 'mobile_phone' => $mobile_phone, 'create_time' => TIME_NOW, 'is_active' => (int) (bool) USER_ACTIVE_ON, 'reg_ip' => AZLib::ip()); $id = DB::insert('user', $user_info); if ($id) { $_SESSION['just_registed'] = TIME_NOW; AZLib::my_setcookie('just_registed', TIME_NOW); if (USER_ACTIVE_ON && $user_info['is_active'] == 1) { global $display; $active = DB::select('user_active', 'user_id=' . $id); $active_code = md5(TIME_NOW . $user_info['password']); if ($active) { $active = array('id' => $active['id'], 'user_id' => $id, 'active_code' => $active_code, 'time' => TIME_NOW); } else { $active = array('user_id' => $id, 'active_code' => $active_code, 'time' => TIME_NOW); } DB::insert('user_active', $active, true); $display->add('eb_url', WEB_ROOT); $display->add('user_id', $id); $display->add('user_name', $user_info['user_name']); $display->add('active_code', $active_code); $display->add('WEB_NAME', WEB_NAME); $display->add('MAIL_FOOTER', MAIL_FOOTER); $content_email = $display->output('send_active_mail', 1, 'RegisterSuccess'); //Send email here; if (System::sendEBEmail($user_info['email'], 'Kích hoạt tài khoản!', $content_email)) { //$this->setFormSucces('','<b>Chúc mừng bạn đã đăng ký tài khoản thành công!</b><br /><br />Mã kích hoạt đã được gửi đi tới E-mail: "'.$user_info['email'].'"<br />Bạn hãy check lại Email để kích hoạt tài khoản của mình!'); Url::redirect('reg_success', array('cmd' => 'notify')); } else { $this->setFormError('', '<b>Chúc mừng bạn đã đăng ký tài khoản thành công!</b><br /><br />Tuy nhiên hệ thống chưa gửi được Mã kích hoạt tới E-mail: "' . $user_info['email'] . '"!<br />Bạn có thể <a href="' . Url::build('reg_success', array('cmd' => 'active')) . '">click vào đây</a> để hệ thống gửi lại mã kích hoạt vào Email của mình!'); } $this->show_form = false; } else { User::Login($id); Url::redirect('reg_success'); } } else { $this->setFormError('', "Chưa đăng ký được, mời bạn thử lại!"); } } } }
function on_submit() { $name = Url::get('name'); $address = Url::get('address'); $email = strtolower(Url::get('email')); $content = trim(Url::get('content', '')); $this->checkFormInput("Tên của bạn", 'name', $name, 'str', false, '', false, 255); $this->checkFormInput("Địa chỉ của bạn", 'address', $address, 'str', false, '', false, 500); $this->checkFormInput("Email của bạn", 'email', $email, 'email', true); $this->checkFormInput("Nội dung", 'content', $content, 'str', true, '', 20, 10000); if (!$this->errNum) { $result = DB::insert('feedback', array('name' => $name, 'address' => $address, 'email' => $email, 'content' => addslashes($content), 'time' => TIME_NOW)); if (MAIL_ON) { $admin_mail = System::sendEBEmail(FEEDBACK_EMAIL, "[Feedback] " . $name . ' - ' . $address . ' - ' . $email, $content); //Gửi mail cảm ơn cho người dùng $msg = "Chào {$name} [{$email}],<br />\n\t\t\t\t\t\t\t\tCảm ơn bạn đã gửi ý kiến và thông tin liên hệ tới chúng tôi<br />\n\t\t\t\t\t\t\t\t chúng tôi sẽ gửi phản hồi hoặc liên hệ cho bạn sớm nhất có thể!<br />\n\t\t\t\t\t\t\t\t Chúc bạn thành công, sức khỏe, hạnh phúc!...<br /><br />\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t Thanks for your feedback to us<br />\n\t\t\t\t\t\t\t\t " . MAIL_FOOTER; if (!System::sendEBEmail($email, "[" . WEB_NAME . "] Cam on ban da lien he (Thanks For Your Feedback...)", $msg)) { Url::redirect_js(false, 'Ý kiến của bạn đã được gửi tới chúng tôi. Cảm ơn bạn rất nhiều!!' . ($admin_mail ? '' : '!')); return; } } Url::redirect_js(false, 'Ý kiến của bạn đã được gửi tới chúng tôi. Cảm ơn bạn rất nhiều!'); } }
function fn_send_email_active() { if (!User::is_login()) { echo "not_login"; exit; } if (!User::have_permit(ADMIN_USER)) { echo "no_perm"; exit; } $user_id = EClassApi::getParam('user_id'); if ($user_id) { $user_info = DB::fetch('SELECT a.is_active, a.user_name,a.email,aa.active_code FROM account a, account_active aa WHERE a.id="' . $user_id . '" AND aa.user_id="' . $user_id . '"'); if ($user_info['is_active'] == 1) { global $display; $display->add('eb_url', WEB_ROOT); $display->add('user_id', $user_id); $display->add('user_name', $user_info['user_name']); $display->add('active_code', $user_info['active_code']); $content_email = $display->output('send_active_mail', 1, 'RegisterSuccess'); if (System::sendEBEmail($user_info['email'], 'Kích hoạt tài khoản', $content_email, 'Enbac.com')) { echo "success"; exit; } else { echo "unsuccess"; exit; } } } else { echo "unsuccess"; exit; } }
function on_submit() { $item_id = (int) Url::get("item_id", 0); $category = (int) Url::get("category", 0); $num_contract = Url::get("num_contract", ''); $time_s = Url::get("time_start", ''); $time_e = Url::get("time_end", ''); if ($item_id <= 0) { $this->setFormError('item_id', 'Bạn chưa nhập vào ID tin!'); return; } $item = Item::get_item($item_id); if (!$item || $item && $item['status'] == -1) { $this->setFormError('item_id', 'Tin bạn nhập vào không tồn tại!'); return; } if (!$this->errNum) { $time_start = 0; if ($time_s != '') { $arr = explode('-', $time_s); if (count($arr) == 3) { $time_start = mktime(0, 0, 0, $arr[1], $arr[0], $arr[2]); } } if (!$time_start) { $time_start = mktime(0, 0, 0, date('m', TIME_NOW), date('d', TIME_NOW), date('Y', TIME_NOW)); } $time_end = 0; if ($time_e != '') { $arr = explode('-', $time_e); if (count($arr) == 3) { $time_end = mktime(23, 59, 59, $arr[1], $arr[0], $arr[2]); } } if (!$time_end) { $this->setFormError('time_end', 'Bạn chưa nhập vào thời gian kết thúc!'); return; } if ($time_end < $time_start) { $this->setFormError('time_end', 'Thời gian kết thúc phải lớn hơn thời gian bắt đầu!'); return; } // xac dinh xem co hien thi o danh muc cha khong $top_cat = 0; $cat_id = 0; if ($category == 1) { $top_cat = $item['level_1_catid']; } else { if ($category == 2) { $cat_id = $item['category_id']; } } $id = DB::insert("bookings_vip", array('item_id' => $item_id, 'cat_id' => $cat_id, 'top_cat' => $top_cat, 'note' => AZLib::getParam('note'), 'time_start' => $time_start, 'time_end' => $time_end, 'time_add' => TIME_NOW, 'user_add' => User::user_name(), 'time_edit' => TIME_NOW, 'user_edit' => User::user_name(), 'num_contract' => $num_contract)); if ($id) { $content_email = "Có tin vip mới, id={$id}"; $email_managa_vip = '*****@*****.**'; if (System::sendEBEmail($email_managa_vip, 'Có booking vip mới', $content_email)) { // DB::update('bookings_vip', array('note' => 'Gửi mail thành công'), "id=$id"); } } Url::redirect_current(); } }
function on_submit() { $full_name = Url::get('full_name'); $email = Url::get('email'); $user_name = Url::get('register_user_name'); $mobile_phone = AZLib::trimSpace(Url::get('mobile_phone')); $home_phone = AZLib::trimSpace(Url::get('home_phone')); $password = AZLib::trimSpace(Url::get('register_password')); $confirm_password = AZLib::trimSpace(Url::get('confirm_password')); $gender = (int) Url::get('gender'); $yahoo_id = AZLib::trimSpace(Url::get('yahoo_id')); $skype_id = AZLib::trimSpace(Url::get('skype_id')); $address = AZLib::trimSpace(Url::get('address')); $website = AZLib::trimSpace(Url::get('website')); $this->checkFormInput('Tên đầy đủ', 'full_name', $full_name, 'str', false, '', 0, 50); $this->checkFormInput('Email', 'email', $email, 'email', true, '', 6, 50); $this->checkFormInput('Tên truy cập', 'user_name', $user_name, 'uname', true, '', 4, 50); $this->checkFormInput('Điện thoại di động', 'mobile_phone', $mobile_phone, 'str', false, '', 0, 50); $this->checkFormInput('Điện thoại bàn', 'home_phone', $home_phone, 'str', false, '', 0, 50); $this->checkFormInput('Mật khẩu truy cập', 'register_password', $password, 'str', true, '', 6, 50); $this->checkFormInput('Nhập lại mật khẩu', 'confirm_password', $confirm_password, 'str', true, '', 6, 50); if ($password != $confirm_password) { $this->setFormError('confirm_password', "Nhập lại Mật khẩu truy cập không khớp!"); return; } if ($mobile_phone && !AZLib::is_mobile($mobile_phone)) { $mobile_phone = ""; } if (!$this->errNum) { if (DB::exists('SELECT id FROM `user` WHERE `email`="' . $email . '"')) { $this->setFormError('email', "<b>Email</b> bạn chọn đã tồn tại, hãy chọn lại một <b>Email</b> khác!"); } elseif (DB::exists('SELECT id FROM `user` WHERE `user_name`="' . $user_name . '"')) { $this->setFormError('email', "<b>Tên truy cập</b> bạn chọn đã tồn tại, hãy chọn lại một <b>Tên truy cập</b> khác!"); } else { $user_info = array('user_name' => $user_name, 'email' => $email, 'password' => User::encode_password($password), 'full_name' => $full_name, 'mobile_phone' => $mobile_phone, 'home_phone' => $home_phone, 'create_time' => TIME_NOW, 'gender' => $gender == 1 ? 0 : 1, 'yahoo_id' => $yahoo_id, 'skype_id' => $skype_id, 'address' => $address, 'website' => $website, 'is_active' => (int) (bool) USER_ACTIVE_ON, 'reg_ip' => AZLib::ip()); $id = DB::insert('user', $user_info); if ($id) { if (USER_ACTIVE_ON && $user_info['is_active'] == 1) { global $display; $active = DB::select('user_active', 'user_id=' . $id); $active_code = md5(TIME_NOW . $user_info['password']); if ($active) { $active = array('id' => $active['id'], 'user_id' => $id, 'active_code' => $active_code, 'time' => TIME_NOW); } else { $active = array('user_id' => $id, 'active_code' => $active_code, 'time' => TIME_NOW); } DB::insert('user_active', $active, true); $display->add('eb_url', WEB_ROOT); $display->add('user_id', $id); $display->add('user_name', $user_info['user_name']); $display->add('active_code', $active_code); $content_email = $display->output('send_active_mail', 1, 'RegisterSuccess'); //Send email here; if (System::sendEBEmail($user_info['email'], 'Kích hoạt tài khoản!', $content_email)) { Url::redirect_current(); } else { $this->setFormError('', '<b>Tạo mới tài khoản thành công!</b><br /><br />Tuy nhiên hệ thống chưa gửi được Mã kích hoạt tới E-mail: "' . $user_info['email'] . '"!'); } $this->show_form = false; } else { Url::redirect_current(); } } else { $this->setFormError('', "Chưa đăng ký được, mời bạn thử lại!"); } } } }
function regist_account() { global $display; if (User::checkLock4Ever(1)) { Url::redirect_current(); } //check bảo mật $just_registed_s = 0; $just_registed_c = 0; if (isset($_SESSION['just_registed'])) { $just_registed_s = $_SESSION['just_registed']; } if (isset($_COOKIE['just_registed'])) { $just_registed_c = $_COOKIE['just_registed']; } if ($just_registed_s > TIME_NOW - 120 || $just_registed_c > TIME_NOW - 120 || !REG_ON) { Url::redirect_current(); } //END check bảo mật // check de ban IP $ip = EClassApi::ip(); $arr_badwords = EClassApi::checkBadWord($ip, true); if ($arr_badwords["bad"] != "" && $arr_badwords["bad_key"] != "") { echo -1; exit; } // end check de ban IP $full_name = Url::get('full_name'); $email = Url::get('email'); $user_name = Url::get('register_user_name'); $mobile_phone = EClassApi::trimSpace(Url::get('mobile_phone')); $password = EClassApi::trimSpace(Url::get('register_password')); $confirm_password = EClassApi::trimSpace(Url::get('confirm_password')); /*gen avatar tự động cho người dùng khi đăng ký*/ /*$url_gen = WEB_ROOT."includes/identicon.php?size=100&hash=" . md5($email).""; $avatar = EClassApi::upload_avatar($url_gen);*/ $user_info = array('user_name' => $user_name, 'email' => $email, 'password' => User::eat_encode_password($password, SALTAUTH), 'full_name' => $full_name, 'mobile_phone' => $mobile_phone, 'create_time' => TIME_NOW, 'is_active' => (int) (bool) USER_ACTIVE_ON, 'reg_ip' => EClassApi::ip()); $id = DB::insert('account', $user_info); if ($id) { $_SESSION['just_registed'] = TIME_NOW; EClassApi::my_setcookie('just_registed', TIME_NOW); if (USER_ACTIVE_ON && $user_info['is_active'] == 1) { global $display; $active = DB::select('account_active', 'user_id=' . $id); $active_code = md5(TIME_NOW . $user_info['password']); if ($active) { $active = array('id' => $active['id'], 'user_id' => $id, 'active_code' => $active_code, 'time' => TIME_NOW); } else { $active = array('user_id' => $id, 'active_code' => $active_code, 'time' => TIME_NOW); } DB::insert('account_active', $active, true); $display->add('eb_url', WEB_ROOT); $display->add('user_id', $id); $display->add('user_name', $user_info['user_name']); $display->add('active_code', $active_code); $content_email = $display->output('send_active_mail', 1, 'RegisterSuccess'); System::sendEBEmail($user_info['email'], 'Kích hoạt tài khoản!', $content_email); echo 1; } } else { echo 0; } exit; }