function login() { //xu ly cookie if (isset($_COOKIE['user_id'])) { $_SESSION['user_id'] = $_COOKIE['user_id']; setcookie("user_id", $_SESSION['user_id'], time() + 60 * 60 * 24 * 7); redirect("index.php"); } // Xy ly login if (isset($_POST['ok'])) { if ($_POST['username'] == "") { $error = "Chưa nhập username"; } else { if ($_POST['password'] == "") { $error = "Chưa nhập mật khẩu"; } else { $login_ok = checkUserLogin($_POST['username'], $_POST['password']); if ($login_ok) { $error = "Đăng nhập thành công"; if (isset($_POST['remember'])) { setcookie("user_id", $_SESSION['user_id'], time() + 60 * 60 * 24 * 7); } redirect("index.php?controller=product"); } else { $error = "Tài khoản hoặc mật khẩu không đúng"; } } } } include "view/user/login.php"; }
function addUser($username, $email, $password, $avatar, $steamid) { //Check if user exists $checkLogin = checkUserLogin($username); if ($checkLogin == FALSE) { //Loginname doesn't exist //Check if email exists $checkEmail = checkEmail($email); if ($checkEmail == FALSE) { //Email doesn't exist $thisUser = new User(); $thisUser->username = $username; $thisUser->loginname = $username; $thisUser->password = encryptPassword($password); $thisUser->email = $email; $thisUser->avatar = $avatar; $thisUser->steamid = $steamid; $thisUser->save(); return TRUE; } else { //Email exists return FALSE; } } else { //Loginname exists return FALSE; } }
function loginUser($d) { //are they someone who should be able to do this? (check token, ip, etc) //split $d - would probably hold null if just looking for latest chat, $userId|$message if a new message... (split like we are doing in game) //go to the data layer and actually get the data I want return checkUserLogin($d); }
function step2() { $checkout = JSFactory::getModel('checkout', 'jshop'); $checkout->checkStep(2); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onLoadCheckoutStep2', array()); $jshopConfig = JSFactory::getConfig(); $checkLogin = JRequest::getInt('check_login'); if ($checkLogin) { JSFactory::getModel('userlogin', 'jshop')->setPayWithoutReg(); checkUserLogin(); } JshopHelpersMetadata::checkoutAddress(); $adv_user = JSFactory::getUser()->loadDataFromEdit(); $config_fields = $jshopConfig->getListFieldsRegisterType('address'); $count_filed_delivery = $jshopConfig->getEnableDeliveryFiledRegistration('address'); $checkout_navigator = $checkout->showCheckoutNavigation(2); $small_cart = $checkout->loadSmallCart(2); $select_countries = JshopHelpersSelects::getCountry($adv_user->country); $select_d_countries = JshopHelpersSelects::getCountry($adv_user->d_country, null, 'd_country'); $select_titles = JshopHelpersSelects::getTitle($adv_user->title); $select_d_titles = JshopHelpersSelects::getTitle($adv_user->d_title, null, 'd_title'); $select_client_types = JshopHelpersSelects::getClientType($adv_user->client_type); filterHTMLSafe($adv_user, ENT_QUOTES); if ($config_fields['birthday']['display'] || $config_fields['d_birthday']['display']) { JHTML::_('behavior.calendar'); } $view = $this->getView("checkout"); $view->setLayout("adress"); $view->assign('select', $jshopConfig->user_field_title); $view->assign('config', $jshopConfig); $view->assign('select_countries', $select_countries); $view->assign('select_d_countries', $select_d_countries); $view->assign('select_titles', $select_titles); $view->assign('select_d_titles', $select_d_titles); $view->assign('select_client_types', $select_client_types); $view->assign('live_path', JURI::base()); $view->assign('config_fields', $config_fields); $view->assign('count_filed_delivery', $count_filed_delivery); $view->assign('user', $adv_user); $view->assign('delivery_adress', $adv_user->delivery_adress); $view->assign('checkout_navigator', $checkout_navigator); $view->assign('small_cart', $small_cart); $view->assign('action', JSFactory::getModel('checkoutStep', 'jshop')->getCheckoutUrl('step2save', 0, 0)); $dispatcher->trigger('onBeforeDisplayCheckoutStep2View', array(&$view)); $view->display(); }
function checkStep($step) { $mainframe = JFactory::getApplication(); $jshopConfig = JSFactory::getConfig(); $session = JFactory::getSession(); if ($step < 10) { if (!$jshopConfig->shop_user_guest) { checkUserLogin(); } $cart = JSFactory::getModel('cart', 'jshop'); $cart->load(); if ($cart->getCountProduct() == 0) { $mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=cart&task=view', 1, 1)); exit; } if ($jshopConfig->min_price_order && $cart->getPriceProducts() < $jshopConfig->min_price_order * $jshopConfig->currency_value) { JError::raiseNotice("", sprintf(_JSHOP_ERROR_MIN_SUM_ORDER, formatprice($jshopConfig->min_price_order * $jshopConfig->currency_value))); $mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=cart&task=view', 1, 1)); exit; } if ($jshopConfig->max_price_order && $cart->getPriceProducts() > $jshopConfig->max_price_order * $jshopConfig->currency_value) { JError::raiseNotice("", sprintf(_JSHOP_ERROR_MAX_SUM_ORDER, formatprice($jshopConfig->max_price_order * $jshopConfig->currency_value))); $mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=cart&task=view', 1, 1)); exit; } } if ($step > 2) { $jhop_max_step = $session->get("jhop_max_step"); if (!$jhop_max_step) { $session->set('jhop_max_step', 2); $jhop_max_step = 2; } if ($step > $jhop_max_step) { if ($step == 10) { $mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=cart&task=view', 1, 1)); } else { JError::raiseWarning("", _JHOP_ERROR_STEP); $mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step2', 1, 1, $jshopConfig->use_ssl)); } exit; } } }
function myaccount() { $jshopConfig = JSFactory::getConfig(); checkUserLogin(); $user = JFactory::getUser(); $adv_user = JSFactory::getUserShop(); $lang = JSFactory::getLang(); $country = JTable::getInstance('country', 'jshop'); $country->load($adv_user->country); $field_country_name = $lang->get("name"); $adv_user->country = $country->{$field_country_name}; $group = JTable::getInstance('userGroup', 'jshop'); $group->load($adv_user->usergroup_id); $adv_user->groupname = $group->usergroup_name; $adv_user->discountpercent = floatval($group->usergroup_discount); $seo = JTable::getInstance("seo", "jshop"); $seodata = $seo->loadData("myaccount"); if ($seodata->title == "") { $seodata->title = _JSHOP_MY_ACCOUNT; } setMetaData($seodata->title, $seodata->keyword, $seodata->description); $tmp_fields = $jshopConfig->getListFieldsRegister(); $config_fields = $tmp_fields['editaccount']; JPluginHelper::importPlugin('jshoppingcheckout'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onBeforeDisplayMyAccount', array()); $view_name = "user"; $view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name); $view = $this->getView($view_name, getDocumentType(), '', $view_config); $view->setLayout("myaccount"); $view->assign('config', $jshopConfig); $view->assign('user', $adv_user); $view->assign('config_fields', $config_fields); $view->assign('href_user_group_info', SEFLink('index.php?option=com_jshopping&controller=user&task=groupsinfo')); $view->assign('href_edit_data', SEFLink('index.php?option=com_jshopping&controller=user&task=editaccount', 0, 0, $jshopConfig->use_ssl)); $view->assign('href_show_orders', SEFLink('index.php?option=com_jshopping&controller=user&task=orders', 0, 0, $jshopConfig->use_ssl)); $view->assign('href_logout', SEFLink('index.php?option=com_jshopping&controller=user&task=logout')); $dispatcher->trigger('onBeforeDisplayMyAccountView', array(&$view)); $view->display(); }
function step2() { $checkout = JModelLegacy::getInstance('checkout', 'jshop'); $checkout->checkStep(2); JPluginHelper::importPlugin('jshoppingcheckout'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onLoadCheckoutStep2', array()); $session = JFactory::getSession(); $user = JFactory::getUser(); $jshopConfig = JSFactory::getConfig(); $country = JTable::getInstance('country', 'jshop'); $checkLogin = JRequest::getInt('check_login'); if ($checkLogin) { $session->set("show_pay_without_reg", 1); checkUserLogin(); } appendPathWay(_JSHOP_CHECKOUT_ADDRESS); $seo = JTable::getInstance("seo", "jshop"); $seodata = $seo->loadData("checkout-address"); if ($seodata->title == "") { $seodata->title = _JSHOP_CHECKOUT_ADDRESS; } setMetaData($seodata->title, $seodata->keyword, $seodata->description); $cart = JModelLegacy::getInstance('cart', 'jshop'); $cart->load(); $cart->getSum(); if ($user->id) { $adv_user = JSFactory::getUserShop(); } else { $adv_user = JSFactory::getUserShopGuest(); } $adv_user->birthday = getDisplayDate($adv_user->birthday, $jshopConfig->field_birthday_format); $adv_user->d_birthday = getDisplayDate($adv_user->d_birthday, $jshopConfig->field_birthday_format); $tmp_fields = $jshopConfig->getListFieldsRegister(); $config_fields = $tmp_fields['address']; $count_filed_delivery = $jshopConfig->getEnableDeliveryFiledRegistration('address'); $checkout_navigator = $this->_showCheckoutNavigation(2); if ($jshopConfig->show_cart_all_step_checkout) { $small_cart = $this->_showSmallCart(2); } else { $small_cart = ''; } $view_name = "checkout"; $view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name); $view = $this->getView($view_name, getDocumentType(), '', $view_config); $view->setLayout("adress"); $view->assign('select', $jshopConfig->user_field_title); if (!$adv_user->country) { $adv_user->country = $jshopConfig->default_country; } if (!$adv_user->d_country) { $adv_user->d_country = $jshopConfig->default_country; } $option_country[] = JHTML::_('select.option', '0', _JSHOP_REG_SELECT, 'country_id', 'name'); $option_countryes = array_merge($option_country, $country->getAllCountries()); $select_countries = JHTML::_('select.genericlist', $option_countryes, 'country', 'class = "inputbox" size = "1"', 'country_id', 'name', $adv_user->country); $select_d_countries = JHTML::_('select.genericlist', $option_countryes, 'd_country', 'class = "inputbox" size = "1"', 'country_id', 'name', $adv_user->d_country); foreach ($jshopConfig->user_field_title as $key => $value) { $option_title[] = JHTML::_('select.option', $key, $value, 'title_id', 'title_name'); } $select_titles = JHTML::_('select.genericlist', $option_title, 'title', 'class = "inputbox"', 'title_id', 'title_name', $adv_user->title); $select_d_titles = JHTML::_('select.genericlist', $option_title, 'd_title', 'class = "inputbox"', 'title_id', 'title_name', $adv_user->d_title); $client_types = array(); foreach ($jshopConfig->user_field_client_type as $key => $value) { $client_types[] = JHTML::_('select.option', $key, $value, 'id', 'name'); } $select_client_types = JHTML::_('select.genericlist', $client_types, 'client_type', 'class = "inputbox" onchange="showHideFieldFirm(this.value)"', 'id', 'name', $adv_user->client_type); filterHTMLSafe($adv_user, ENT_QUOTES); if ($config_fields['birthday']['display'] || $config_fields['d_birthday']['display']) { JHTML::_('behavior.calendar'); } $view->assign('config', $jshopConfig); $view->assign('select_countries', $select_countries); $view->assign('select_d_countries', $select_d_countries); $view->assign('select_titles', $select_titles); $view->assign('select_d_titles', $select_d_titles); $view->assign('select_client_types', $select_client_types); $view->assign('live_path', JURI::base()); $view->assign('config_fields', $config_fields); $view->assign('count_filed_delivery', $count_filed_delivery); $view->assign('user', $adv_user); $view->assign('delivery_adress', $adv_user->delivery_adress); $view->assign('checkout_navigator', $checkout_navigator); $view->assign('small_cart', $small_cart); $view->assign('action', SEFLink('index.php?option=com_jshopping&controller=checkout&task=step2save', 0, 0, $jshopConfig->use_ssl)); $dispatcher->trigger('onBeforeDisplayCheckoutStep2View', array(&$view)); $view->display(); }
<!DOCTYPE html> <?php include "includes/app_top.php"; $getid = getid('rid'); checkUserLogin(); include "includes/styles.php"; include "../includes/colorbox.php"; ?> <script type="text/javascript"> function validatefilter() { if(document.getElementById('keyword').value=='') { alert("Enter keyword"); document.getElementById('keyword').focus(); return false; } } </script> <link rel="stylesheet" href="../css/styles.css" type="text/css" /> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> </head> <body> <?php include "includes/header.php"; ?> <div class="division-1"> <h1>LEADERBOARDS</h1>
<?php header('Content-type: application/json'); chdir(".."); chdir("database"); require_once "users.php"; if (isset($_GET["email"]) and isset($_GET["password"]) and userExists((string) $_GET["email"]) and getUserStatus((string) $_GET["email"]) == "active") { $email = (string) $_GET["email"]; $password = (string) $_GET["password"]; if (checkUserLogin($email, $password)) { echo json_encode(array("result" => "ok")); } else { echo json_encode(array("result" => "invalidLogin")); } } else { echo json_encode(array("result" => "missingParams")); }
protected function initialize() { parent::initialize(); checkUserLogin(); }
function getfile() { $jshopConfig = JSFactory::getConfig(); $db = JFactory::getDBO(); $user = JFactory::getUser(); $id = JRequest::getInt('id'); $oid = JRequest::getInt('oid'); $hash = JRequest::getVar('hash'); $rl = JRequest::getInt('rl'); $order = JSFactory::getTable('order', 'jshop'); $order->load($oid); if ($order->file_hash != $hash) { JError::raiseError(500, "Error download file"); return 0; } if (!in_array($order->order_status, $jshopConfig->payment_status_enable_download_sale_file)) { JError::raiseWarning(500, _JSHOP_FOR_DOWNLOAD_ORDER_MUST_BE_PAID); return 0; } if ($rl == 1) { //fix for IE $newurl = JURI::root() . "index.php?option=com_jshopping&controller=product&task=getfile&oid=" . $oid . "&id=" . $id . "&hash=" . $hash; print "<script type='text/javascript'>location.href='" . $newurl . "';</script>"; die; } if ($jshopConfig->user_registered_download_sale_file && $order->user_id > 0 && $order->user_id != $user->id) { checkUserLogin(); } if ($jshopConfig->max_day_download_sale_file && time() > $order->getStatusTime() + 86400 * $jshopConfig->max_day_download_sale_file) { JError::raiseWarning(500, _JSHOP_TIME_DOWNLOADS_FILE_RESTRICTED); return 0; } $items = $order->getAllItems(); $filesid = array(); if ($jshopConfig->order_display_new_digital_products) { $product = JSFactory::getTable('product', 'jshop'); foreach ($items as $item) { $product->product_id = $item->product_id; $product->setAttributeActive(unserialize($item->attributes)); $files = $product->getSaleFiles(); foreach ($files as $_file) { $filesid[] = $_file->id; } } } else { foreach ($items as $item) { $arrayfiles = unserialize($item->files); foreach ($arrayfiles as $_file) { $filesid[] = $_file->id; } } } if (!in_array($id, $filesid)) { JError::raiseError(500, "Error download file"); return 0; } $stat_download = $order->getFilesStatDownloads(); if ($jshopConfig->max_number_download_sale_file > 0 && $stat_download[$id]['download'] >= $jshopConfig->max_number_download_sale_file) { JError::raiseWarning(500, _JSHOP_NUMBER_DOWNLOADS_FILE_RESTRICTED); return 0; } $file = JSFactory::getTable('productFiles', 'jshop'); $file->load($id); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onAfterLoadProductFile', array(&$file, &$order)); $downloadFile = $file->file; if ($downloadFile == "") { JError::raiseWarning('', "Error download file"); return 0; } $file_name = $jshopConfig->files_product_path . "/" . $downloadFile; if (!file_exists($file_name)) { JError::raiseWarning('', "Error. File not exist"); return 0; } $stat_download[$id]['download'] = intval($stat_download[$id]['download']) + 1; $stat_download[$id]['time'] = getJsDate(); $order->setFilesStatDownloads($stat_download); $order->store(); ob_end_clean(); @set_time_limit(0); $fp = fopen($file_name, "rb"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); header("Content-Type: application/octet-stream"); header("Content-Length: " . (string) filesize($file_name)); header('Content-Disposition: attachment; filename="' . basename($file_name) . '"'); header("Content-Transfer-Encoding: binary"); while (!feof($fp) && connection_status() == 0) { print fread($fp, 1024 * 8); flush(); } fclose($fp); die; }
function getfile() { $id = JRequest::getInt('id'); $oid = JRequest::getInt('oid'); $hash = JRequest::getVar('hash'); $rl = JRequest::getInt('rl'); $model = JSFactory::getModel('productDownload', 'jshop'); $model->setId($id); $model->setOid($oid); $model->setHash($hash); if ($rl == 1) { //fix for IE print "<script type='text/javascript'>location.href='" . $model->getUrlDownload() . "';</script>"; die; } if (!$model->checkHash()) { JError::raiseError(500, "Error download file"); return 0; } if (!$model->checkOrderStatusPaid()) { JError::raiseWarning(500, _JSHOP_FOR_DOWNLOAD_ORDER_MUST_BE_PAID); return 0; } if (!$model->checkUser()) { checkUserLogin(); } if (!$model->checkTimeDownload()) { JError::raiseWarning(500, _JSHOP_TIME_DOWNLOADS_FILE_RESTRICTED); return 0; } if (!$model->checkFileId()) { JError::raiseError(500, "Error download file"); return 0; } if (!$model->checkNumberDownload()) { JError::raiseWarning(500, _JSHOP_NUMBER_DOWNLOADS_FILE_RESTRICTED); return 0; } $name = $model->getFileName(); if ($name == "") { JError::raiseWarning('', "Error download file"); return 0; } $file_name = $model->getFile($name); $model->storeStatDownloads(); ob_end_clean(); @set_time_limit(0); $model->downloadFile($file_name); die; }
function myaccount() { $jshopConfig = JSFactory::getConfig(); checkUserLogin(); $adv_user = JSFactory::getUserShop(); $adv_user->prepareUserPrint(); JshopHelpersMetadata::userMyaccount(); $config_fields = $jshopConfig->getListFieldsRegisterType('editaccount'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onBeforeDisplayMyAccount', array(&$adv_user, &$config_fields)); $view = $this->getView('user'); $view->setLayout("myaccount"); $view->assign('config', $jshopConfig); $view->assign('user', $adv_user); $view->assign('config_fields', $config_fields); $view->assign('href_user_group_info', SEFLink('index.php?option=com_jshopping&controller=user&task=groupsinfo')); $view->assign('href_edit_data', SEFLink('index.php?option=com_jshopping&controller=user&task=editaccount', 0, 0, $jshopConfig->use_ssl)); $view->assign('href_show_orders', SEFLink('index.php?option=com_jshopping&controller=user&task=orders', 0, 0, $jshopConfig->use_ssl)); $view->assign('href_logout', SEFLink('index.php?option=com_jshopping&controller=user&task=logout')); $dispatcher->trigger('onBeforeDisplayMyAccountView', array(&$view)); $view->display(); }
function isLogin($next_page = '') { global $_conf_vars, $db; $clt_id = checkUserLogin(); if (isEmpty($clt_id)) { if (!isEmpty($next_page)) { $_SESSION['NEXT_PAGE'] = $next_page; } Redirect_To($_conf_vars['USER'] . "/" . $_conf_vars['LOGIN'] . $_conf_vars['FILE_EXTN']); } else { return $clt_id; } }
<?php /* Funciones para determinar inicio de sesión */ require_once 'functions.php'; if (isset($_POST['idlogin']) and isset($_POST['passlogin'])) { $user = $_POST['idlogin']; $pass = $_POST['passlogin']; $registerNo = stripslashes($user); $password = stripslashes($pass); $user = checkUserLogin($registerNo, $password); if (count($user)) { session_start(); $_SESSION['id'] = $user['id']; $_SESSION['username'] = $registerNo; $_SESSION['name'] = $user['name']; $_SESSION['type'] = $user['type']; //header("Location:home.php"); echo 1; } else { echo 0; } }
/** * * 投诉建议do */ public function do_advice() { checkUserLogin(); $data = array(); $data = $this->input->post(); $this->load->model('MIS_Feedback'); $data['user_id'] = $this->userId; $this->load->model('MIS_User'); $userInfo = $this->MIS_User->getInfo($data['user_id']); $data['user_name'] = $userInfo['user_name']; $data['add_time'] = time(); $this->MIS_Feedback->add($data); redirect(formatUrl('home/index')); }