Example #1
0
     $email = $_REQUEST['email'];
     $pwd = $_REQUEST['pwd'];
     if (!User::RegisterUser($_REQUEST['first_name'], $_REQUEST['last_name'], $email, $pwd, $_REQUEST['gender'])) {
         echo '{"status":"ERROR","results":{"user":"******", "mess":"Problem on the DB"}}';
     } else {
         $u = User::getByEmail($_REQUEST['email']);
         $uid = $u['uid'];
         MyAuth::setLoginAuthenticate($uid);
         unset($r['pwd']);
         echo '{"status":"OK","results":' . json_encode($u) . '}';
     }
 } else {
     if ($_REQUEST['action'] == "login") {
         $email = $_REQUEST['email'];
         $pwd = $_REQUEST['pwd'];
         $u = User::CheckUser($email, $pwd);
         $fp->log("User::CheckUser({$email}, {$pwd})");
         if ($u) {
             $uid = $u['uid'];
             $fp->log("uid:{$uid}");
             MyAuth::setLoginAuthenticate($uid);
             unset($u['pwd']);
             echo '{"status":"OK","results":' . json_encode($u) . '}';
         } else {
             echo '{"status":"ERROR","results":{"user":"******", "mess":"login failed"}}';
         }
     } else {
         if ($_REQUEST['action'] == "logoff") {
             $fp->log("user::logoff");
             MyAuth::logoff();
             echo '{"status":"OK","results":"Successfully disconnected through logoff"}';
Example #2
0
<?php

/* TODO:
 */
require_once 'include/basic.php';
require_once 'include/MyAuth.php';
require_once 'include/model_user.php';
$fp->log("login.php");
if (isset($_REQUEST['email'])) {
    if (isset($_REQUEST['login'])) {
        //login
        $fp->log("login!");
        $u = User::CheckUser($_REQUEST['email'], $_REQUEST['password']);
        $fp->log($u);
        if ($u) {
            MyAuth::setLoginAuthenticate($u['uid']);
            header("Location: {$appAfterLoginUrl}");
            die;
        } else {
            echo '<span class="error_message">Login not valid!</span>';
        }
    } else {
        //signup
        $fp->log("Signup!");
        if (!User::RegisterUser($_REQUEST['first_name'], $_REQUEST['last_name'], $_REQUEST['email'], $_REQUEST['password'], $_REQUEST['gender'])) {
            echo '<span class="error_message">Probaly the email has been already used! Plase try wih a different one</span>';
        } else {
            $u = User::getByEmail($_REQUEST['email']);
            MyAuth::setLoginAuthenticate($u['uid']);
            header("Location: {$appAfterLoginUrl}");
            die;
Example #3
0
/**
 * @package    zoneideas
 * @subpackage idea
 * @author     Serg Podtynnyi <*****@*****.**>
 */
/**
 *
 *
 */
ob_start();
include_once "../core.php";
$action = "login";
if (!empty($_POST["login"])) {
    if (!empty($_POST["user_name"]) && !empty($_POST["user_password"])) {
        $obj = User::CheckUser($_POST["user_name"], $_POST["user_password"]);
        User::$current = Session::StartUser($obj);
    } else {
        $error_message = I18n::L("Please fill all required fields.");
    }
}
if (User::Logged()) {
    header("Location:" . PREFIX . "/dashboard/");
    exit;
}
if (!empty($_POST["login"]) && !User::Logged()) {
    if (empty($error_message)) {
        $error_message = I18n::L("Wrong password.");
    }
    Viewer::AddData("error_message", $error_message);
    Viewer::AddData("user_name", $_POST["user_name"]);