public function actionProfile() { $name = ''; $sname = ''; $phone = ''; $country = ''; $region = ''; $city = ''; $address = ''; $index = ''; $userId = ''; $user = new User(); $result = false; if (isset($_POST['add_profile'])) { $name = $_POST['u_name']; $sname = $_POST['u_sname']; $phone = $_POST['u_phone']; $country = $_POST['u_country']; $region = $_POST['u_region']; $city = $_POST['u_city']; $address = $_POST['u_address']; $index = $_POST['u_index']; $userId = $user->getUserById($user->isUser()); $errors = false; if (!User::checkName($name)) { $errors[] = 'Имя должно быть более 2-х символов'; } if (!User::checkSname($sname)) { $errors[] = 'Фамилия должна быть более 2-х символов'; } if (!User::checkPhone($phone)) { $errors[] = 'Телефон должен быть более 7-ми символов'; } if (!User::checkCountry($country)) { $errors[] = 'Страна должна быть более 2-х символов'; } if (!User::checkRegion($region)) { $errors[] = 'Область должна быть более 2-х символов'; } if (!User::checkCity($city)) { $errors[] = 'Город должен быть более 2-х символов'; } if (!User::checkAddress($address)) { $errors[] = 'Адрес должен быть более 5-ти символов'; } if (!User::checkIndex($index)) { $errors[] = 'Индекс должен быть более 4-х символов'; } if ($errors == false) { $result = $user->addProfile($name, $sname, $phone, $country, $region, $city, $address, $index, $userId['id']); header("Location: /"); } } require_once ROOT . '/views/user/profile.php'; return true; }
public function profile() { $user = new User(); $user->id = Param::get('user_id'); $user->getProfile(); $user->isUser($_SESSION['userid']); if (!isset($user->username)) { redirect('notfound/pagenotfound'); } $user->getFollowedThreads($_SESSION['userid']); $user->getCreatedThreads($_SESSION['userid']); $this->set(get_defined_vars()); }
public function createPM($array) { if (empty($array)) { return false; } if (parent::isUser($array[0]) && parent::isUser($array[1])) { $query = 'INSERT INTO ' . $this->prefix . 'personalmessage(mittente, destinatario, data, ora, oggetto, contenuto, letto) VALUES('; foreach ($array as $var) { $query .= "'{$var}', "; } $query = trim($query, ', '); $query .= ')'; return parent::query($query) ? true : false; } return false; }
public static function _edit() { $user = User::find(intval($_SESSION['userid'])); $member = Member::findByMemberId($_POST['member_id']); $platoons = Platoon::find_all($member->game_id); // if user role lower than plt ld, show only own platoon's squads $platoon_id = $user->role >= 2 && !User::isDev() ? $member->platoon_id : false; $squads = Squad::findAll($member->game_id, $platoon_id); $positionsArray = Position::find_all(); $rolesArray = Role::find_all(); $memberGames = MemberGame::get($member->id); if (User::isUser($member->id)) { $userInfo = User::findByMemberId($member->id); } else { $userInfo = null; } Flight::render('modals/view_member', array('user' => $user, 'member' => $member, 'userInfo' => $userInfo, 'platoons' => $platoons, 'memberGames' => $memberGames, 'squads' => $squads, 'positionsArray' => $positionsArray, 'rolesArray' => $rolesArray)); }
if (strlen($_POST['password']) < 4) { $output['code'] = 502; $output['type'] = 'danger'; $output['message'] = 'Password must be of at least 4 chars'; } else { if ($auth->checkAdmin($_POST['username'], $_POST['password'], true)) { $output['code'] = 200; $output['type'] = 'success'; $output['message'] = 'Logged in successfully.'; } else { Requests::register_autoloader(); $responce = Requests::post("https://www.psit.in/psit/loginlist.php", array(), array('username' => $_POST['username'], 'password' => $_POST['password'], 'rand' => '5266')); $data = $responce->body; if ($data == "164") { $output['code'] = 200; $output['type'] = 'success'; $output['message'] = 'Logged in successfully.'; if (!$user->isUser($_POST['username'])) { $user->makeUser($_POST['username']); } $auth->letHimGainAccess($_POST['username']); } else { $output['code'] = 404; $output['type'] = 'danger'; $output['message'] = 'Username/Password is wrong'; } } } } } echo json_encode($output);
<?php session_start(); if (Login::isLogged(Login::$_login_front)) { Helper::redirect(Login::$_dashboard_front); } $objForm = new Form(); $objValid = new Validation($objForm); $objUser = new User(); // login form if ($objForm->isPost('login_email')) { if ($objUser->isUser($objForm->getPost('login_email'), $objForm->getPost('login_password'))) { Login::loginFront($objUser->_id, Url::getReferrerUrl()); } else { $objValid->add2Errors('login'); } } // registration form if ($objForm->isPost('first_name')) { $objValid->_expected = array('first_name', 'last_name', 'address_1', 'address_2', 'town', 'county', 'post_code', 'country', 'email', 'password', 'confirm_password'); $objValid->_required = array('first_name', 'last_name', 'address_1', 'town', 'county', 'post_code', 'country', 'email', 'password', 'confirm_password'); $objValid->_special = array('email' => 'email'); $objValid->_post_remove = array('confirm_password'); $objValid->_post_format = array('password' => 'password'); // validate password $pass_1 = $objForm->getPost('password'); $pass_2 = $objForm->getPost('confirm_password'); if (!empty($pass_1) && !empty($pass_2) && $pass_1 != $pass_2) { $objValid->add2Errors('password_mismatch'); } $email = $objForm->getPost('email');
function undeleteCalendar() { global $error; global $obj_smarty; $arr_submit = array(array('cid', 'int', true, '')); $frm_submitted = validate_var($arr_submit); if (User::isUser() || User::isAdmin() || User::isSuperAdmin()) { $arr_user = User::getUser(); $bln_success = Calendar::undeleteCalendar($frm_submitted['cid']); if ($bln_success) { $obj_smarty->assign('msg', 'Calendar is back again'); } $language = Settings::getSetting('language', $arr_user['user_id']); $obj_smarty->assign('language', $language); $arr_calendars = Calendar::getCalendarsOfUser($arr_user['user_id']); $obj_smarty->assign('calendars', $arr_calendars); $obj_smarty->assign('active', 'calendars'); } else { $obj_smarty->assign('error', 'NO rights to undelete this calendar'); } $obj_smarty->display(FULLCAL_DIR . '/view/user_panel.tpl'); exit; }
function login($user, $pass, $cypher, $vector) { //session_regenerate_id(true); $authorized = false; $userObj = new User("root", $user); $data = $userObj->isUser($pass); if ($data != false && $data != "") { $_SESSION['start'] = $cypher; $_SESSION['vector'] = $vector; $_SESSION['nameUser'] = $user; $_SESSION['idUser'] = $data; $authorized = true; } return $authorized; }
<?php $user = new User(); $userEmail = $user->getUserById($user->isUser()); ?> <!DOCTYPE html> <html> <head> <?php function Head($p1) { echo '<title>' . $p1 . '</title>'; } ?> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <link rel="stylesheet" href="/template/style/style.css"> </head> <body> <a id ="home-link" href="#"></a> <div id="wrapper"> <div class="panel-top"> <div class="center clearfix"> <div class="social"> <a href="#" class="s-fb"> </a> <a href="#" class="s-dribble"> </a> <a href="#" class="s-tw"> </a> <a href="#" class="s-mail"> </a> <a href="#" class="s-vimeo"> </a> </div> <div class="basket">
<?php /* * Created on 14-sep-2014 * * To change the template for this generated file go to * Window - Preferences - PHPeclipse - PHP - Code Templates */ require_once '../../include/default.inc.php'; if (User::isLoggedIn()) { header("Cache-Control: no-cache, must-revalidate"); $arr_user = User::getUser(); $bln_user = User::isUser(); $bln_admin = User::isAdmin(); $bln_superadmin = User::isSuperAdmin(); if ($bln_superadmin) { $obj_smarty->assign('active', 'admin'); $obj_smarty->display(FULLCAL_DIR . '/view/admin_panel.tpl'); exit; } $obj_smarty->assign('name', $arr_user['firstname'] . ' ' . (!empty($arr_user['infix']) ? $arr_user['infix'] : '') . $arr_user['lastname']); $obj_smarty->assign('user', $_SESSION['calendar-uid']['username']); $obj_smarty->assign('user_id', $_SESSION['calendar-uid']['uid']); $obj_smarty->assign('is_user', $bln_user); $obj_smarty->assign('is_admin', $bln_admin); $obj_smarty->assign('is_super_admin', $bln_superadmin); $language = Settings::getLanguage($arr_user['user_id']); $obj_smarty->assign('language', $language); $obj_smarty->assign('current_languages', $current_languages); // global var if (User::isAdmin()) {
public static function getAdminSetting($name, $int_user_id = -1) { global $obj_db; $arr_user = array(); $str_query = ''; if ($int_user_id > 0) { // get user $arr_user = User::getUserById($int_user_id); } else { $arr_user = User::getUser(); } $setting = ''; $bln_one_admin = User::onlyOneAdmin(); if (!empty($arr_user)) { $str_query = ' SELECT * ' . ' FROM `settings` s' . ' LEFT JOIN users u ON ( s.user_id = u.user_id )' . ' WHERE s.name = "' . $name . '"' . ' AND u.usertype = "admin"'; if (User::isAdmin()) { $str_query .= ' AND user_id = ' . $arr_user['user_id']; } else { if (User::isUser()) { $str_query .= ' AND user_id = ' . $arr_user['admin_group']; } } $str_query .= ' LIMIT 1 '; } else { if ($bln_one_admin) { $str_query = ' SELECT * ' . ' FROM `settings` s' . ' LEFT JOIN users u ON ( s.user_id = u.user_id )' . ' WHERE s.name = "' . $name . '"' . ' AND u.usertype = "admin"'; $str_query .= ' LIMIT 1 '; } } if (!empty($str_query)) { $obj_result = mysqli_query($obj_db, $str_query); if ($obj_result !== false) { $arr_line = mysqli_fetch_array($obj_result, MYSQLI_ASSOC); if ($arr_line !== false && !empty($arr_line)) { if (!empty($arr_line['value'])) { $setting = $arr_line['value']; } } } } if (empty($setting)) { switch ($name) { case 'language': if (defined('LANGUAGE')) { $setting = LANGUAGE; } else { $setting = 'EN'; } break; case 'timezone': if (defined('TIMEZONE')) { $setting = TIMEZONE; } else { $setting = ''; } break; case 'show_am_pm': if (defined('SHOW_AM_PM')) { $setting = SHOW_AM_PM; } else { $setting = 'off'; } break; case 'default_view': if (defined('DEFAULT_VIEW')) { $setting = DEFAULT_VIEW; } else { $setting = 'month'; } break; case 'show_view_type': if (defined('SHOW_VIEW_TYPE')) { $setting = SHOW_VIEW_TYPE; } else { $setting = 'none'; } break; case 'show_description_field': if (defined('SHOW_DESCRIPTION_FIELD')) { $setting = SHOW_DESCRIPTION_FIELD; } else { $setting = 'on'; } break; case 'show_location_field': if (defined('SHOW_LOCATION_FIELD')) { $setting = SHOW_LOCATION_FIELD; } else { $setting = 'on'; } break; case 'show_phone_field': if (defined('SHOW_PHONE_FIELD')) { $setting = SHOW_PHONE_FIELD; } else { $setting = 'off'; } break; case 'show_url_field': if (defined('SHOW_URL_FIELD')) { $setting = SHOW_URL_FIELD; } else { $setting = 'off'; } break; case 'week_view_type': if (defined('WEEK_VIEW_TYPE')) { $setting = WEEK_VIEW_TYPE; } else { $setting = 'agendaWeek'; } break; case 'day_view_type': if (defined('DAY_VIEW_TYPE')) { $setting = DAY_VIEW_TYPE; } else { $setting = 'agendaDay'; } break; case 'show_delete_confirm_dialog': if (defined('SHOW_DELETE_CONFIRM_DIALOG')) { $setting = SHOW_DELETE_CONFIRM_DIALOG; } else { $setting = 'on'; } break; case 'show_weeknumbers': if (defined('SHOW_WEEKNUMBERS')) { $setting = SHOW_WEEKNUMBERS; } else { $setting = 'on'; } break; case 'truncate_title': if (defined('TRUNCATE_TITLE')) { $setting = TRUNCATE_TITLE; } else { $setting = 'off'; } break; case 'truncate_length': if (defined('TRUNCATE_LENGTH')) { $setting = TRUNCATE_LENGTH; } else { $setting = '50'; } break; case 'editdialog_colorpicker_type': if (defined('EDITDIALOG_COLORPICKER_TYPE')) { $setting = EDITDIALOG_COLORPICKER_TYPE; } else { $setting = 'spectrum'; } break; case 'show_notallowed_messages': if (defined('SHOW_NOTALLOWED_MESSAGES')) { $setting = SHOW_NOTALLOWED_MESSAGES; } else { $setting = 'off'; } break; case 'editdialog_timepicker_type': if (defined('EDITDIALOG_TIMEPICKER_TYPE')) { $setting = EDITDIALOG_TIMEPICKER_TYPE; } else { $setting = 'ui'; } break; case 'hourcalculation_workday_hours': if (defined('HOURCALCULATION_WORKDAY_HOURS')) { $setting = HOURCALCULATION_WORKDAY_HOURS; } else { $setting = 8; } break; case 'hourcalculation_default_period': if (defined('HOURCALCULATION_DEFAULT_PERIOD')) { $setting = HOURCALCULATION_DEFAULT_PERIOD; } else { $setting = 6; } break; case 'send_activation_mail': if (defined('SEND_ACTIVATION_MAIL')) { $setting = SEND_ACTIVATION_MAIL; } else { $setting = 'on'; } break; // case 'users_can_register': // if(defined('USERS_CAN_REGISTER')) { // $setting = USERS_CAN_REGISTER; // } else { // $setting = 'off'; // } // break; // case 'users_can_register': // if(defined('USERS_CAN_REGISTER')) { // $setting = USERS_CAN_REGISTER; // } else { // $setting = 'off'; // } // break; case 'show_public_and_private_separately': if (defined('SHOW_PUBLIC_AND_PRIVATE_SEPARATELY')) { $setting = SHOW_PUBLIC_AND_PRIVATE_SEPARATELY; } else { $setting = 'on'; } break; default: break; } } return $setting; }
?> </select> </div> <?php } else { ?> <p class="text-muted">This division has no sub-games to select.</p> <?php } ?> <div class="margin-top-50"></div> </div> <?php if (User::isUser($member->id) && $user->role > 1 || !is_null($userInfo) && $userInfo->id == $user->id) { ?> <div class="tab-pane" id="userinfo"> <div class="margin-top-20"></div> <form id='user-form'> <input type='hidden' name='id' value="<?php echo $userInfo->id; ?> " /> <div class='form-group user-group'> <label for='username' class='control-label'>Account Name</label> <input type='text' class='form-control user-form-control' value='<?php echo $userInfo->username; ?> ' disabled> </div>
public function actionOrder() { $categories = Category::getCategoriesList(); if (!$categories) { $categories = array(); } $name = ''; $phone = ''; $comment = ''; $userName = ''; $sessionProducts = Cart::getSessionProducts(); if ($sessionProducts) { $productsIdsArray = array_keys($sessionProducts); $products = Product::getProductsByIds($productsIdsArray); $totalPrice = Cart::getTotalPrice($products); $totalProductCount = Cart::countProductsInCart(); } if (isset($_POST['submit'])) { $name = FunctionLibrary::clearStr($_POST['name']); $phone = FunctionLibrary::clearStr($_POST['phone']); $comment = nl2br(FunctionLibrary::clearStr($_POST['comment'])); $errors = array(); if (!User::checkName($name)) { $errors[] = 'Имя не может быть пустым.'; } if (!User::checkPhone($phone)) { $errors[] = 'Невалидный номер телефона.'; } if (!User::checkName($comment)) { $errors[] = 'Комментарий не может быть пустым.'; } if (empty($errors)) { if (User::isUser()) { $email = User::isLogged(); $user = User::getUserByEmail($email); $userId = htmlentities($user['id']); } else { $userId = false; } $result = Order::save($name, $phone, $comment, $userId, $sessionProducts); if ($result) { $_SESSION['message'] = 'Заказ оформлен!'; Cart::annul(); FunctionLibrary::redirectTo('/cart'); } } } else { if (!$sessionProducts) { FunctionLibrary::redirectTo('/'); } if (User::isUser()) { $email = User::isLogged(); $user = User::getUserByEmail($email); $userName = htmlentities($user['name']); } } require_once ROOT . '/views/cart/order.php'; return true; }
</div> </div> <div class="col-sm-8"> <div class="shop-menu pull-right"> <ul class="nav navbar-nav"> <li> <a href="/cart"> <i class="fa fa-shopping-cart"></i> Корзина [ <strong class="my-orange-color my-cart"><?php echo (int) Cart::countProductsInCart(); ?> </strong> ] </a> </li> <?php if (User::isUser()) { ?> <li><a href="/cabinet"><i class="fa fa-user"></i> Аккаунт</a></li> <li><a href="/user/logout"><i class="fa fa-unlock"></i> Выход</a></li> <?php } else { ?> <li><a href="/user/register"><i class="fa fa-user-plus"></i> Регистрация</a></li> <li><a href="/user/login"><i class="fa fa-lock"></i> Вход</a></li> <?php } ?> </ul> </div> </div> </div>
public function actionOrder() { $categories = Category::getCategoryList(); if (!$categories) { $categories = array(); } $name = ''; $phone = ''; $message = ''; $result = ''; if (isset($_POST['submit'])) { $name = FunctionLibrary::clearStr($_POST['name']); $phone = FunctionLibrary::clearStr($_POST['phone']); $message = FunctionLibrary::clearStr($_POST['message']); $errors = array(); if (!User::checkName($name)) { $errors[] = 'Имя должно быть больше 1 символа.'; } if (!User::checkPhone($phone)) { $errors[] = 'Невалидный телефон.'; } if (!User::checkName($message)) { $errors[] = 'Сообщение не может быть пустым.'; } $sessionProducts = Cart::returnSessionProducts(); if ($sessionProducts) { $idsArray = array_keys($sessionProducts); $products = Product::getProductsInCart($idsArray); $totalPrice = Cart::getTotalPrice($products); $totalCount = Cart::countProductsInCart(); if (User::isUser()) { $email = User::isLogged(); $user = User::getUserByEmail($email); $userName = $user['name']; $userId = $user['id']; } else { $userName = ''; $userId = 0; } } if (empty($errors)) { $result = Order::save($name, $phone, $message, $userId, $sessionProducts); if ($result) { $adminEmail = '*****@*****.**'; $sub = "Новый заказ"; $mess = "{$message}"; mail($adminEmail, $sub, $mess); $_SESSION['message'] = 'Заказ оформлен'; Cart::deleteProductsInCart(); FunctionLibrary::redirectTo('/cart'); } } } else { /* Выясняем есть ли товары в корзине */ $sessionProducts = Cart::returnSessionProducts(); if (!$sessionProducts) { FunctionLibrary::redirectTo('/'); } else { $idsArray = array_keys($sessionProducts); $products = Product::getProductsInCart($idsArray); $totalPrice = Cart::getTotalPrice($products); $totalCount = Cart::countProductsInCart(); } /* Выясняем зарегистрирован ли покупатель */ if (User::isUser()) { $email = User::isLogged(); $user = User::getUserByEmail($email); $userName = $user['name']; } else { $userName = ''; } } require_once ROOT . '/views/cart/order.php'; return true; }
<?php require_once "../core/includes.php"; $connection = new ConnectionDB(); $user = new User($connection, "byEmail", "*****@*****.**"); Commons::print_r($user); // if($user->isUser())Commons::print_r($user); // $password = "******"; // $user = new User($connection,"byPass", "*****@*****.**", $password); // Commons::print_r($user); $newUser = new User($connection, "byEmail", "*****@*****.**"); if (!$newUser->isUser()) { $newUser->setEmail("*****@*****.**"); $newUser->setPassword("locoporvos"); $newUser->setName("Carlos"); $newUser->setLastName("Molina"); $newUser->create($connection); } else { Commons::print_r("The user already exits"); } // if($user->isUser()){$user->setEnabled($connection ,0);}; // Commons::print_r($user); // if(!$user->isEnabled()){$user->setEnabled($connection ,1);}; // Commons::print_r($user); // $user-> updatePassword($connection, $password); // Commons::print_r($user); // $newUser = new User($connection,"byPass", "*****@*****.**", $password); // Commons::print_r($newUser); function writeGetter($value) { $tittle = ucfirst($value);
<?php //Imports require_once 'session.php'; require_once 'variables_site.php'; require_once 'db/db_conn.php'; require_once 'db/SELECT.php'; require_once 'email.php'; require_once 'classes/User.php'; $con = connect_db(); $ADK_USER = new User(); $ADK_USER->username = $_POST['username']; $ADK_USER->email = $_POST['email']; $ADK_USER->isUser($con); if ($ADK_USER->name == '') { header('Location: ../forgot?ue'); exit; } $con->close(); sendPWResetLinkEmail($ADK_USER); header('Location: ../forgot?s=' . $ADK_USER->email);