Exemplo n.º 1
0
 /**
  * handles the entire registration process. checks all error possibilities
  * and creates a new user in the database if everything is fine
  */
 private function registerNewUser()
 {
     if (empty($_POST['user_name'])) {
         $this->error = "USERNAME_EMPTY";
     } elseif (empty($_POST['user_password_new']) || empty($_POST['user_password_repeat'])) {
         $this->error = "PASSWORD_EMPTY";
     } elseif ($_POST['user_password_new'] !== $_POST['user_password_repeat']) {
         $this->error = "PASSWORDS_NOT_MATCH";
     } elseif (strlen($_POST['user_password_new']) < 6) {
         $this->error = "PASSWORD_HELP";
     } elseif (strlen($_POST['user_name']) > 64 || strlen($_POST['user_name']) < 2) {
         $this->error = "USERNAME_INVALID_SIZE";
     } elseif (!preg_match('/^[a-z\\d]{2,64}$/i', $_POST['user_name'])) {
         $this->error = "USERNAME_HELP";
     } elseif (empty($_POST['user_email'])) {
         $this->error = "EMAIL_EMPTY";
     } elseif (strlen($_POST['user_email']) > 64) {
         $this->error = "EMAIL_INVALID_SIZE";
     } elseif (!filter_var($_POST['user_email'], FILTER_VALIDATE_EMAIL)) {
         $this->error = "EMAIL_INVALID_FORMAT";
     } else {
         // escaping, additionally removing everything that could be (html/javascript-) code
         $user_name = $_POST['user_name'];
         $user_email = $_POST['user_email'];
         $user_password = $_POST['user_password_new'];
         $user = new User();
         $query_check_user_name = $user->search($user_name, $user_email);
         if ($query_check_user_name->num_rows == 1) {
             $this->error = "REGISTRATION_EXISTENT_USER";
         } else {
             $query_new_user_insert = $user->register($user_name, $user_password, $user_email);
             if ($query_new_user_insert) {
                 $this->successful = true;
                 $login = new Login();
                 $login->doLogin($user_name, $user_password);
             } else {
                 $this->error = "REGISTRATION_FAILURE";
             }
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Login to the WhatsApp server with your password
  *
  * If you already know your password you can log into the Whatsapp server
  * using this method.
  *
  * @param  string  $password         Your whatsapp password. You must already know this!
  */
 public function loginWithPassword($password)
 {
     $this->password = $password;
     if (is_readable($this->challengeFilename)) {
         $challengeData = file_get_contents($this->challengeFilename);
         if ($challengeData) {
             $this->challengeData = $challengeData;
         }
     }
     $login = new Login($this, $this->password);
     $login->doLogin();
 }
Exemplo n.º 3
0
<?php

require_once 'classes/_loader.php';
require_once 'classes/init.php';
$id = $_GET['id'];
$timeunit = TimeUnit::get_by_id($id);
if (!is_object($timeunit)) {
    $ret = array('error' => 'Invalid timeunit id');
} else {
    if ($timeunit->is_prereserveable()) {
        $login = new Login('users');
        $logined_user = $login->doLogin() == 1 ? $login->obj : null;
        $basket->add($timeunit, $logined_user);
        $ret = $basket->get_basket();
    } else {
        $ret = array('error' => 'Már foglalt időpont!');
    }
}
echo json_encode($ret);
require_once 'classes/close.php';
Exemplo n.º 4
0
 * 登陆后发邮件
 */
class LoginAndEmail implements Observer
{
    /**
     * 观察者动作
     */
    public function handle()
    {
        var_dump("login and emailing...");
    }
}
/**
 * 登陆后推送信息
 */
class LoginAndNotify implements Observer
{
    /**
     * 观察者动作
     */
    public function handle()
    {
        var_dump("login and notifying...");
    }
}
$login = new Login();
$email = new LoginAndEmail();
$notify = new LoginAndNotify();
$login->attach([$email, $notify]);
$login->doLogin();
Exemplo n.º 5
0
<?php

require $base_path . 'classes/checkframework.php';
$login = new Login('admin');
$doLogin = $login->doLogin();
if ($doLogin == 1) {
    $admin_username = $login->username;
    $smarty->assign('admin_username', $login->username);
    switch ($_GET['aid']) {
        case "migration":
            require_once 'admin-migration.php';
            break;
        case "reservations":
            require_once 'admin-reservations.php';
            break;
        case "users":
            require_once 'admin-users.php';
            break;
        case "courts":
            require_once 'admin-courts.php';
            break;
        case "timeline":
            require_once 'admin-timeline.php';
            break;
        case "logout":
            require_once 'admin-logout.php';
            break;
        case "report":
            require_once 'admin-report.php';
            break;
        default:
Exemplo n.º 6
0
<?php

session_start();
require_once "conf/top.php";
require_once "models/class.login.php";
$login = new Login();
if ($login->is_loggedin() != "") {
    echo "logged";
    $login->redirect('index.php');
}
if (isset($_REQUEST['mail']) && isset($_REQUEST['password'])) {
    $umail = $_REQUEST['mail'];
    $upass = $_REQUEST['password'];
    if ($login->doLogin($umail, $upass)) {
        $login->redirect('index.php');
    } else {
        $error = "Wrong Details !";
    }
}
echo $twig->render("login.html.twig");
?>

Exemplo n.º 7
0
<?php

// check duplicate logins to see if another person (with same user/pass) has access then undeny access
if (is_array($rs_logins)) {
    foreach ($rs_logins as $person) {
        if (auth_person($access_groups, $person['person_id'])) {
            $access_denied = false;
            $o = new Login();
            $o->person = new person($person['person_id']);
            $o->post_password = $_POST['login_password'];
            $o->post_remember_me = $_POST['remember_me'];
            if ($o->_checkLogin()) {
                $o->doLogin();
                break;
            }
        }
    }
}
Exemplo n.º 8
0
<?php

//登陆
//过滤GET和POST,不符合要求也返回404
//http://localhost/dx2app/app2/login.php?type=onlinedo&useracc=admin&userpw=21232f297a57a5a743894a0e4a801fc3
$acc = trim($_POST['useracc']);
$pw = trim($_POST['userpw']);
//md5($pw)
//
//验证表单
if ($_GET['type'] == 'onlinedo' && !empty($acc) && !empty($pw)) {
    require_once './class/login.class.php';
    $login = new Login();
    $login->doLogin($acc, $pw);
}
Exemplo n.º 9
0
<?php

include_once 'include/common.php';
include_once 'include/Login.php';
$_SESSION["formInput"] = $_POST;
$errorMessage = isset($_REQUEST["message"]) ? $_REQUEST["message"] : "";
$formValid = true;
$errorMessage .= isset($_REQUEST["errorMessage"]) ? $_REQUEST["errorMessage"] : "";
if (isset($_REQUEST["loginas"]) && $_REQUEST["loginas"] == "") {
    $errorMessage = "Please select on Login As";
    $formValid = false;
}
if (isset($_POST["login"]) && $formValid) {
    $login = new Login();
    $loginResult = $login->doLogin($_POST);
    if ($loginResult[0]) {
        header("Location: User.php");
    } elseif (LOGIN_INACTIVE == $loginResult[1]) {
        $errorMessage = LOGIN_INACTIVE;
        header('Location: ' . $_SERVER['PHP_SELF'] . '?message=' . $errorMessage);
    } else {
        $errorMessage = LOGIN_FAILED;
        header('Location: ' . $_SERVER['PHP_SELF'] . '?message=' . $errorMessage);
    }
}
?>


<!DOCTYPE html>
<html>
<head>
Exemplo n.º 10
0
<?php

//require_once('engine.php');
require 'hx_config.php';
require PATH . '/modules/login/classes/login.class.php';
fetchtemplate();
$login = new Login();
if (isset($_POST["login"])) {
    $username = $_POST["username"];
    $password = $_POST["password"];
    $han = $login->doLogin($username, $password);
    if ($han == true) {
        echo 'Login successful!';
    } else {
        echo 'Login invalid!';
    }
}