public function login()
 {
     if ($this->post) {
         $login = User::Login($this->PostData('nickname'), $this->PostData('password'));
         if ($login['code'] == 200) {
             // Successful Login
             $this->site['user'] = $login['user'];
             $_SESSION['user'] = $login['user']->id;
             if ($this->PostData('remember') == 1) {
                 setcookie("userkey", $login['user']->cookie, time() + 31536000, "/");
             }
             // Get a new Session ID
             session_regenerate_id(true);
             Site::Flash("notice", "You have been logged in");
             if (Site::GetFlash('redirect')) {
                 Redirect($this->site['flash']['redirect']);
             } else {
                 Redirect("");
             }
         } else {
             $this->site['flash']['error'] = $login['error'];
         }
     }
     if (Site::GetFlash('redirect')) {
         Site::Flash("redirect", Site::GetFlash('redirect'));
     }
     $this->title = "Login";
     $this->render("user/login.tpl");
 }
Example #2
0
function doLogin($user, $pass)
{
    header('Content-type: application/json');
    $res = User::Login($user, $pass);
    $ret = $res ? $res->id_user : false;
    echo json_encode($ret);
}
Example #3
0
 /**
  * Login
  * Return Values:
  * 0 = invalid credentials
  * 1 = success
  * 2 = wrong password
  * 3 = email not found
  * 4 = banned
  *
  * @param string $Email
  * @param string $Password
  * @return int
  */
 function UserLogin($credentials)
 {
     $result = User::Login($credentials);
     if ($result['userid']) {
         //Sessions only work on the declared server handle class :'(
         $_SESSION['userid'] = $result['userid'];
     }
     return $result['res'];
 }
Example #4
0
 public function Index($params)
 {
     if (isset($params['login']) && ($user = User::Login($params['login'], $params['password']))) {
         $_SESSION['user'] = $user;
     } else {
         unset($_SESSION['user']);
     }
     header('Location: ' . (isset($params['uri']) ? $params['uri'] : '/'), TRUE, 307);
 }
Example #5
0
 private function ShowLogin()
 {
     if (isset($_POST['submit']) && isset($_POST['name']) && isset($_POST['pass'])) {
         if (User::Login($_POST['name'], $_POST['pass'])) {
             return $this->ReturnTemplate("user_login_success");
         } else {
             return $this->ReturnTemplate("user_login_failed");
         }
     }
     return $this->ReturnTemplate("user_login");
 }
Example #6
0
 /**
  * Process the login, create the user session and then redirect to 
  * the appropriate page
  */
 public function Login()
 {
     $user = new User($this->Phreezer);
     if ($user->Login(RequestUtil::Get('username'), RequestUtil::Get('password'))) {
         // login success
         $this->SetCurrentUser($user);
         $this->Redirect('Secure.UserPage');
     } else {
         // login failed
         $this->Redirect('Secure.LoginForm', 'Usuario e senha invalidos.');
     }
 }
Example #7
0
 public function consumePost($command, $params, $user)
 {
     if (!isset($_POST['username']) || !isset($_POST['password'])) {
         return false;
     }
     User::Login($_POST['username'], $_POST['password']);
     if (User::Current()->type == User::USERTYPE_NONE) {
         $this->error = true;
         return false;
     }
     if (count($params) > 0) {
         return './' . $command . '/' . implode('/', $params);
     } else {
         return './' . $command;
     }
 }
 public function start()
 {
     session_start();
     User::Login();
     $this->Template = new TemplateEngine();
     if (!User::LoggedIn()) {
         $this->Template->setVar('%%PAGETITLE%%', 'Kein Zugriff - Keyword-Tracker');
         $this->Template->setVar('%%NAVIGATION%%', '');
         $this->Template->showLoginForm();
         $this->Template->setVar('%%PROJECTS%%', '');
     }
     if (User::LoggedIn()) {
         User::setProject();
         self::showRequestedContent();
     }
     $this->Template->displayTemplate();
 }
Example #9
0
 public function __construct()
 {
     $this->Infos['Title'] = Language::Get('com.sbb.page.login');
     // If logged in, redirect to start page
     if (isset($_COOKIE['sbb_Token']) || session::Read('UserID')) {
         header("Location: index.php");
     }
     $Message = '';
     if (isset($_POST['Login'])) {
         if (Login::Check($_POST)) {
             SBB::SQL()->Select('users', 'ID', 'Username = \'' . mysql_real_escape_string($_POST['Username']) . '\'', '', 1);
             $UserID = SBB::SQL()->FetchObject()->ID;
             User::Login($UserID, $_POST['StayLoggedIn']);
             $Message = Language::Get('com.sbb.login.success');
             header('Location: index.php');
         } else {
             $Message = '<b>' . Language::Get('com.sbb.error') . ':</b><ul><li>' . implode('</li><li>', Login::GetError()) . '</li></ul>';
         }
     }
     SBB::Template()->Assign(array('Page' => 'Login', 'Message' => $Message));
 }
Example #10
0
<?php

header('Content-Type: application/json');
/* This is develop by Juan Huertas */
require_once dirname(__FILE__) . '/assets/core/init.php';
// get content from url post
$foo = file_get_contents("php://input");
// Decode json result into array
$json = json_decode($foo, true);
// Extract values that you need from array.
$User_email = $json['User_email'];
$User_pass = $json['User_pass'];
// Result array will store all information to later print like json
$results = array();
$Login_User = new User();
$Result_Login_User = $Login_User->Login($User_email, $User_pass);
if ($Result_Login_User == 0) {
    $results['Result']['Status'] = 0;
    // Error  -- Not inserted user //
    print json_encode($results);
} else {
    if ($Result_Login_User == 1) {
        $Login_User->get_User_Info_by_Email($User_email);
        $results['User']['User_Id'] = $Login_User->User_Id;
        $results['User']['User_name'] = $Login_User->User_name;
        $results['User']['User_email'] = $Login_User->User_email;
        $results['User']['Effective_Date'] = $Login_User->Effective_Date;
        $results['User']['Lat'] = $Login_User->Lat;
        $results['User']['Lon'] = $Login_User->Lon;
        $results['User']['Role_Id'] = $Login_User->Role_Id;
        $results['Result']['Status'] = 1;
Example #11
0
define('GROK', TRUE);
define('iEMS_PATH', '');
require_once iEMS_PATH . 'displayEventSummary.inc.php';
require_once iEMS_PATH . 'Connections/crsolutions.php';
require_once iEMS_PATH . 'includes/clsInterface.inc.php';
require_once iEMS_PATH . 'iEMSLoader.php';
$Loader = new iEMSLoader();
//arg: bool(true|false) enables/disables logging to iemslog.txt
//to watch log live, from command-line: tail logpath/logfilename -f
$oInterface = new userInterface();
$mdrUser = new User();
$connection = $mdrUser->sqlConnection();
//passing the return from the local connection doc into a generic name$connection = $mdrUser->sqlConnection(); //passing the return from the local connection doc into a generic name
if (empty($_SESSION['UserObject'])) {
    //echo "REFRESH: In UserObject empty...<br>\n";
    $mdrUser->Login($_SESSION["iemsName"], $_SESSION["iemsPW"]);
    $_SESSION['UserObject'] = $mdrUser;
} else {
    //echo "REFRESH: In UserObject NOT empty...<br>\n";
    $mdrUser = $_SESSION['UserObject'];
}
$meterSummary = '';
$tabTipScript = '';
if (isset($_SESSION['viewEventSummary'])) {
    $meterSummary = viewEventSummary($_SESSION['iemsDID'], $_SESSION['evtSummaryDate'], false, true);
} else {
    if ($_SESSION['formUsed'] == 'eventsForm') {
        if (isset($_SESSION['evtBaseDate'])) {
            $meterSummary = $oInterface->gatherEvent($_SESSION['action'], $_SESSION['currentSelection'], $_SESSION['baseDate'], $_SESSION['dateSpan'], $_SESSION['selectedPresentation'], $_SESSION['selectedView'], $connection, $_SESSION['formUsed'], $mdrUser, $_SESSION['evtBaseDate'], true);
        }
    } else {
<?php

require dirname(__DIR__) . "/domain/User.php";
$mail = $_POST["mail"];
$pass = $_POST["pass"];
if (!$mail || !$pass) {
    header('location: ../../index.php?error=1s');
    exit;
}
if (preg_match("/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,4})+\$/", $mail) and preg_match("/[\\w]{6,15}/", $pass)) {
    $user = new User();
    $user->Login($mail, $pass);
} else {
    header('location: ../../index.php?error=4');
    exit;
}
Example #13
0
<?php

include_once 'user.php';
if (isset($_POST['submit'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $object = new User();
    $object->Login($username, $password);
} else {
    echo "Fields can not be empty<br><br>\n\n<html>\n<body>\n<form method=\"post\" action=\"index.php\">\nUsername: <input type=\"text\" name=\"username\"/><br><br>\nPassword: <input type=\"text\" name=\"password\"/><br><br>\n<button class=\"btn btn-large btn-danger\" id=\"alertMe\" input type=\"submit\" name=\"submit\" value=\"login\">Login</button>\n\n</form>\n</body>\n</html>";
}
Example #14
0
    
    <?php 
if (isset($_GET['required'])) {
    ?>
        <div class="alert alert-danger" role="alert">
            Per accedere al contenuto richiesto è necessario autenticarsi.
            Oppure <a href="register.php" class="alert-link">Registrati qui</a>
        </div>
    <?php 
}
?>

    <div class="container">
        <?php 
if (!empty($_POST['login']) && !empty($_POST['password'])) {
    $regResult = User::Login($_POST);
    if ($regResult === TRUE) {
        ?>
                    <h1>Login effettuato per l'utente <?php 
        echo $_POST['login'];
        ?>
</h1>
                    <script>setTimeout("location='index.php'", 1000);</script>
        <?php 
    } else {
        ?>
            <div class="alert alert-danger" role="alert">
            Sono stati riscontrati dei problemi nel login  <a href="login.php" class="alert-link">Riprova qui</a>
            </div>
        <?php 
    }
Example #15
0
<?php

include_once 'User.php';
if (isset($_POST['submit'])) {
    $name = $_POST['user'];
    $pass = $_POST['password'];
    $object = new User();
    $object->Login($name, $pass);
}
Example #16
0
 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!");
             }
         }
     }
 }
Example #17
0
<?php

include_once 'user.php';
if (isset($_POST['submit'])) {
    $name = $_POST['user'];
    $password = $_POST['password'];
    $user = new User();
    $user->Login($name, $password);
} else {
    //print_r($_POST);
    echo "string";
}
?>
<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
	<form method="post" action="index.php">
		Username:<input type="text" name="user"><br>
		Password:<input type="text" name="password">
		<input type="submit" value="Submit" name="submit" />
	</form>
</body>
</html>
Example #18
0
<?php

error_reporting(E_ALL);
/*
 * Creating the logic for the login and the registration process
 */
if (isset($_POST['login-form-btn']) && !empty($_POST['login-form-btn'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $user = new User();
    $message = "";
    $message = $user->Login($username, $password);
    if ($message == "User found") {
        $_SESSION['username'] = $username;
        $base = get_basename();
        header('Location: ' . $base);
    }
}
if (isset($_POST['register-form-btn']) && !empty($_POST['register-form-btn'])) {
    $reg_array = array();
    array_push($reg_array, $_POST['username'], $_POST['password'], $_POST['firstName'], $_POST['lastName'], $_POST['phonenumber'], $_POST['email'], $_POST['academicID'], $_POST['academicPass']);
    $user = new User();
    $username = $_POST['username'];
    $message = $user->RegisterUser($reg_array);
    if ($message == "registered") {
        $_SESSION['username'] = $username;
        $base = get_basename();
        header('Location: ' . $base);
    } else {
        $message_error = "Η εγγραφη σας δεν ολοκληρώθηκε σωστά";
        echo "<script>error_messages('{$message_error}');</script>";
Example #19
0
<?php

# Подключение инициализационного файла
require_once 'inc/core/init.php';
# Если пользователь авторизован - переход к главной странице
if (Session::exists('user')) {
    header('Location: /index.php');
} else {
    # Проверка входных данных
    $em = Input::getPost('email');
    $pa = Input::getPost('pass');
    if (!empty($em) && !empty($pa)) {
        # Клас пользователь
        $us = new User();
        # Авторизация
        $us->Login();
        # Проверка наличия ошибок при регистрации
        if (empty($us->error)) {
            # Создание сессионных переменных
            Session::put('user', $us->status);
            Session::put('email', Input::getPost('email'));
            #переход к главной странице
            header('Location: /index.php');
            exit;
        } else {
            $er = "Некорректные данные!";
        }
    }
}
?>
<!DOCTYPE html>
Example #20
0
<?php

/*
 *	@author: Tomáš Mičulka
 *	@version: 2.0
 *	@last_update: 22.4.2014 
 */
defined('IN_INNE') or die("Acces denied!");
if (isset(InneAdm::$postData['login'])) {
    $user = new User();
    $user->Login(InneAdm::$postData['nick'], InneAdm::$postData['password']);
    Admin::Refresh("?token={$user->userToken}", 0);
}
Example #21
0
<?php

require_once '../bootstrap.php';
$username = $_POST['username'];
$password = $_POST['password'];
$uid = null;
if (!Validate::Username($username) && !Validate::Password($password)) {
    echo json_encode(false);
    exit;
}
$user = new User();
$user->setUsername($username);
$user->setPassword($password);
if ($user->Login()) {
    //redirect to home
    echo json_encode(true);
    exit;
}
// redirect to home
echo json_encode(false);
Example #22
0
<?php

if ($_POST['email']) {
    switch (User::Login($_POST['email'], $_POST['password'], $_POST['rememberme'])) {
        case ERR_LOGIN_OK:
            unset($_SESSION['LoginMessage']);
            if ($_SESSION['LoginRequest']) {
                $path = $_SESSION['LoginRequest'];
                unset($_SESSION['LoginRequest']);
                Response::Redirect($path);
            } else {
                Response::Redirect('/');
            }
            break;
        case ERR_LOGIN_BADUSER:
            $ERROR['BAD_USERNAME'] = "******";
            break;
        case ERR_LOGIN_BADPASS:
            $ERROR['BAD_PASSWORD'] = "******";
            break;
    }
}
$page = new pSubPage();
$page->addClass('Login');
$page->start();
?>

	<form action="/login" method="post" accept-charset="utf-8" class="login" id="login_form">
		<?php 
if ($_SESSION['LoginMessage']) {
    ?>
Example #23
0
// objects asthey are needed so we don't need to load everything
// all at once so that we can maintain sub-second logins no matter
// how big the client.
$Loader = new iEMSLoader(false);
// true|false indicates whether we will send troubleshooting
//  output to iEMS' log/
$User = new User();
// instantiate the iEMS User object. Capital camel case naming for
// objects, lower camel case for functions & variables.
$responseString = '';
if (!empty($_SESSION['iemsID'])) {
    //header('location: legal.php');
    header('location: index.php');
} else {
    if (isset($_POST['username']) && isset($_POST['password'])) {
        if ($User->Login($_POST['username'], $_POST['password'])) {
            //$responseString = '<strong>Welcome. You have successfully authenticated.</strong><br />If you are not redirected in a few seconds, please <a href="legal.php">click here to proceed.</a>';
            $responseString = '<strong>Welcome. You have successfully authenticated.</strong><br />If you are not redirected in a few seconds, please <a href="index.php">click here to proceed.</a>';
            $_SESSION['UserObject'] = $User;
            $_SESSION['iemsName'] = $_POST['username'];
            $_SESSION['iemsID'] = $User->id();
            $_SESSION['iemsDID'] = $User->Domains(0)->id();
            $_SESSION['iemsPW'] = $_POST['password'];
            //header('location: legal.php');
            header('location: index.php');
        } else {
            $responseString = '<div style="color: #2B2B47;">
                    <p>There was a problem with login.</p>
                    <p>Please retype your username and password and try again.</p>
                    <p>If the problem persists contact your Demand Response Provider.</p>
                    </div>';
Example #24
0
<?php

session_start();
echo "Hello World</br>";
echo "Login script in progress...</br>";
echo $_POST['login-key'] . '</br>';
echo $_POST['login-pass'] . '</br>';
include_once 'UserHandler.php';
if (isset($_POST['login-key']) && $_POST['login-pass'] != "") {
    $login = User::Login($_POST['login-key'], $_POST['login-key']);
    if ($login != null) {
        $_SESSION['login'] = $login;
    } else {
        $_SESSION['login'] = '******';
    }
    header('Location: ../index.php?page=comunity');
    exit;
    //echo $_SESSION['login'];
}
Example #25
0
<?php

require_once '../bootstrap.php';
// get the registration arguments
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
$password_repeat = $_POST['password_repeat'];
$conditions = $_POST['conditions'];
$prename = $_POST['prename'];
$lastname = $_POST['lastname'];
$user = new User();
$user->setUsername($username);
$user->setEmail($email);
$user->setPassword($password);
$user->setPasswordRepeat($password_repeat);
$user->setConditions($conditions);
$user->setPrename($prename);
$user->setLastname($lastname);
try {
    if ($user->Register()) {
        $user->Login();
        echo json_encode(true);
        exit;
    }
} catch (Exception $e) {
    echo json_encode($e->getMessage());
}
Example #26
0
File: User.php Project: hqd276/bigs
    static function check_cookie_login($user_id, $password)
    {
        $user_data = DB::fetch('SELECT id, user_name, password, block_time, gids FROM account WHERE id=' . (int)$user_id, false, false, __LINE__ . __FILE__);

        if ($user_data && $user_data['password'] == $password) {
            if ($user_data['block_time'] > TIME_NOW) { //Nếu User bị khóa chưa hết hạn!
                self::LogOut();
            } else { //TuanNK sửa check quyền đăng nhập, nếu thuộc nhóm quản trị ==>> không cho đăng nhập tự động
                $in_group_admin = false;
                if ($user_data['gids'] && $user_data['gids'] != '0') {
                    //$in_group_admin=(preg_match("/(".$user_data['gids'].")/is","2") || preg_match("/(".$user_data['gids'].")/is","1"));
                    $in_group_admin = (preg_match("/(" . $user_data['gids'] . ")/is", "3") || preg_match("/(" . $user_data['gids'] . ")/is", "2") || preg_match("/(" . $user_data['gids'] . ")/is", "1") || preg_match("/(" . $user_data['gids'] . ")/is", "9"));
                }

                if (!$in_group_admin) {
                    User::Login($user_data);
                    Url::redirect_url(Url::build_all());
                } else {
                    EClassApi::my_setcookie('suma_id', "", TIME_NOW - 3600);
                    EClassApi::my_setcookie('password', "", TIME_NOW - 3600);
                }
            }
        } else {
            self::LogOut();
        }
    }
Example #27
0
 $connection = $mdrUser->sqlConnection();
 //passing the return from the local connection doc into a generic name
 $master_connection = $mdrUser->sqlMasterConnection();
 //passing the return from the master connection doc into a generic name
 if (empty($_SESSION['UserObject'])) {
     //echo "INDEX: In UserObject empty...<br>\n";
     $mdrUser->Login($username, $password);
     $_SESSION['UserObject'] = $mdrUser;
 } else {
     //echo "INDEX: In UserObject NOT empty...<br>\n";
     $mdrUser = $_SESSION['UserObject'];
 }
 if (isset($_GET['action'])) {
     //echo "index: Refreshing the user object...<br>\n";
     $mdrUser = new User();
     $mdrUser->Login($username, $password);
     $_SESSION['UserObject'] = $mdrUser;
 }
 //manual entries that need to be replaced
 $index = 0;
 /** ****************************************************************
 ***                       Page Preparation                       ***
 **************************************************************** **/
 $logFlag = $logged ? '&logged' : '';
 $logoutString = '<a href="logout.php" style="font-weight: bold;">:: Log Out ::</a>';
 $zipcode = $mdrUser->primaryZipCode();
 $prefs = $oControlPanel->gatherDefaultPresentation($connection, $mdrUser);
 $sp = $oControlPanel->gatherDefaultPoints($connection, $mdrUser);
 if (isset($_POST['presentation']) && $_POST['presentation'] != 'comparison') {
     $selectedPresentation = $_POST['presentation'];
 } else {
Example #28
0
    }
}
$controllerPath = $controller . "Controller";
include_once 'Controller/' . $controllerPath . '.php';
$obj = new $controllerPath();
if (strtolower($view) == "logout") {
    unset($_SESSION['username']);
    unset($_SESSION['usertype']);
    unset($_SESSION['userid']);
}
if (isset($_POST['btnLogin'])) {
    include_once 'Model/user.php';
    $model = new User();
    $model->Email = $_POST['Email'];
    $model->Password = $_POST['Password'];
    if ($model->Login()) {
        $_SESSION['username'] = $model->Name;
        $_SESSION['usertype'] = $model->Type;
        $_SESSION['userid'] = $model->Id;
        include_once 'Model/loginhistoty.php';
        $lh = new Loginhistory();
        $lh->UserId = $model->Id;
        if (!$lh->Insert()) {
        }
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
Example #29
0
    unset($_SESSION['check_TSV']);
}
if (!empty($_POST['s']) && !empty($_POST['p']) && !empty($_POST['u'])) {
    $errors = array();
    $u = strtolower(trim($_POST['u']));
    $p = $_POST['p'];
    if (empty($u)) {
        $errors[] = L\get('Specify_username');
    }
    if (empty($p)) {
        $errors[] = L\get('Specify_password');
    }
    if (empty($errors)) {
        DB\connect();
        $user = new User();
        $r = $user->Login($u, $p);
        if ($r['success'] == false) {
            $errors[] = L\get('Auth_fail');
        } else {
            $cfg = $user->getTSVConfig();
            if (!empty($cfg['method'])) {
                $_SESSION['check_TSV'] = time();
            } else {
                $_SESSION['user']['TSV_checked'] = true;
            }
        }
    }
    $_SESSION['message'] = array_shift($errors);
} elseif (!empty($_SESSION['check_TSV']) && !empty($_POST['c'])) {
    $u = new User();
    $cfg = $u->getTSVConfig();
Example #30
0
<?php

session_start();
include_once 'user.php';
$errormsg = '';
if (isset($_POST['submit'])) {
    // moved here para maka redirect sa securedpage.php
    $name = $_POST['user'];
    $pass = $_POST['pass'];
    $object = new User();
    $errormsg = $object->Login($name, $pass);
}
if (isset($_SESSION['username'])) {
    header("Location: securedpage.php");
}
?>


<!DOCTYPE html>
<html lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <title>Bootstrap, from Twitter</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le styles -->
    <link href="Bootstrap,%20from%20Twitter_files/bootstrap.css" rel="stylesheet">
    <style type="text/css">
      body {