PHP Method User::checkUser, codiad Code Examples

This page contains top rated real world PHP examples of method User::checkUser from package codiad extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: user.php Project: xuyintao/thindev
0
 /** 获取列表搜索信息 **/
 public function register()
 {
     $res = array();
     $user = new User();
     $user->Name = $this->Name;
     $user->Mobile = $this->Mobile;
     $user->Card = $this->Card;
     $userModel = $user->checkUser();
     if (!empty($userModel)) {
         $user->UserId = $userModel['UserId'];
         $user->OpenIdQQ = $this->OpenIdQQ;
         $re = $user->updateOpenIdQQ();
         if ($re > 0) {
             $_SESSION['userid'] = $userModel['UserId'];
             $_SESSION['username'] = $userModel['Name'];
             $_SESSION['role'] = $userModel['Role'];
             $_SESSION['level'] = $userModel['Level'];
             $_SESSION['department'] = $userModel['Department'];
             $_SESSION['team'] = $userModel['Team'];
             $res["Success"] = true;
             $res["Message"] = "恭喜,验证并注册成功!";
         } else {
             $res["Success"] = false;
             $res["Message"] = "验证成功,当注册失败";
         }
     } else {
         $res["Success"] = false;
         $res["Message"] = "可能你是新来的小伙伴,资料还没有录入系统,请迅速联系技术部陈文聪Evan同学解决此问题^_^";
     }
     echo json_encode($res);
     exit;
 }
Example #2
Show file File: Company.class.php Project: prasanthkumara/samyug_v1
0
 public function insertCompany($data)
 {
     if (isset($data['email'])) {
         $userObj = new User();
         if ($emailCheck = $userObj->checkUser($data['email']) && isset($emailCheck['error'])) {
             return $emailCheck;
         }
     }
     //check buiness details
     if ($businessCheck = $this->checkBusiness($data['business_id']) && isset($businessCheck['error'])) {
         return $emailCheck;
     }
     $result = $this->insertRow(sprintf("INSERT INTO company(name,sub_title,description,business_id,created) VALUES('%s','%s','%s','%s',NOW())", $data['name'], $data['sub_title'], $data['description'], $data['business_id']));
     if (isset($result['error'])) {
         return $result;
     }
     $result = $this->insertRow(sprintf("INSERT INTO users(email,password,role,created) VALUES ('%s','%s','COMPANY',NOW())", $data['email'], $data['password']));
     if (!$result) {
         return $this->formatError("Insert failed");
     }
     return $result;
 }
Example #3
Show file File: site_facebook_login.php Project: jaydeepsen506/jaydeep
0
 public function facebook()
 {
     $user = $this->facebook->getUser();
     if ($user) {
         try {
             // Proceed knowing you have a logged in user who's authenticated.
             $user_profile = $this->facebook->api('/me');
         } catch (FacebookApiException $e) {
             error_log($e);
             $user = null;
         }
         if (!empty($user_profile)) {
             # User info ok? Let's print it (Here we will be adding the login and registering routines)
             $username = $user_profile['name'];
             $uid = $user_profile['id'];
             $email = $user_profile['email'];
             $user = new User();
             $userdata = $user->checkUser($uid, 'facebook', $username, $email, $twitter_otoken, $twitter_otoken_secret);
             if (!empty($userdata)) {
                 session_start();
                 $_SESSION['id'] = $userdata['id'];
                 $_SESSION['oauth_id'] = $uid;
                 $_SESSION['username'] = $userdata['username'];
                 $_SESSION['email'] = $email;
                 $_SESSION['oauth_provider'] = $userdata['oauth_provider'];
                 header("Location: home.php");
             }
         } else {
             # For testing purposes, if there was an error, let's kill the script
             die("There was an error.");
         }
     } else {
         # There's no active session, let's generate one
         $login_url = $this->facebook->getLoginUrl(array('scope' => 'email'));
         header("Location: " . $login_url);
     }
 }
Example #4
Show file File: index.php Project: ddavisgraphics/ThesisFrameworkApp
0
<?php

require_once "../includes/engine.php";
templates::display('header');
if (isset($_POST['MYSQL']) && !session::has('username')) {
    $data = dbSanitize($_POST['MYSQL']);
    $username = $data['username'];
    $email = $data['email'];
    if (User::checkUser($username, $email) === true) {
        $options['timeout'] = strtotime('+2 years', time());
        session::set('username', $username, $options);
        header('Location:/welcomeback');
    } else {
        header('Location:/login?failed');
    }
}
if (isset($_GET['MYSQL']['failed'])) {
    $localvars->set('feedback', '<div class="error-message"> Login failed please check your password, or <a href="/"> register your account. </a> </div>');
}
?>
<section class="wrapper">
    <div class="container">
        <form class="registerUser" action="<?php 
print htmlspecialchars($_SERVER["PHP_SELF"]);
?>
" method="post">
            <div class="feedback">
                {local var="feedback"}
            </div>
            {csrf}
            <div class='username form-group'>
Example #5
Show file File: login-facebook.php Project: beshad/login-facebook-twitter
0
$session = $facebook->getSession();
if (!empty($session)) {
    # Active session, let's try getting the user id (getUser()) and user info (api->('/me'))
    try {
        $uid = $facebook->getUser();
        $user = $facebook->api('/me');
    } catch (Exception $e) {
    }
    if (!empty($user)) {
        # User info ok? Let's print it (Here we will be adding the login and registering routines)
        echo '<pre>';
        print_r($user);
        echo '</pre><br/>';
        $username = $user['name'];
        $user = new User();
        $userdata = $user->checkUser($uid, 'facebook', $username);
        if (!empty($userdata)) {
            session_start();
            $_SESSION['id'] = $userdata['id'];
            $_SESSION['oauth_id'] = $uid;
            $_SESSION['username'] = $userdata['username'];
            $_SESSION['oauth_provider'] = $userdata['oauth_provider'];
            header("Location: home.php");
        }
    } else {
        # For testing purposes, if there was an error, let's kill the script
        die("There was an error.");
    }
} else {
    # There's no active session, let's generate one
    $login_url = $facebook->getLoginUrl();
Example #6
Show file File: login-facebook.php Project: EarthBug/irksome-barnacle
0
     // Proceed knowing you have a logged in user who's authenticated.
     $user_profile = $facebook->api('/me');
 } catch (FacebookApiException $e) {
     error_log($e);
     $user = null;
 }
 if (!empty($user_profile)) {
     //        print_r($user_profile);
     # User info ok? Let's print it (Here we will be adding the login and registering routines)
     $firstname = $user_profile['first_name'];
     $lastname = $user_profile['last_name'];
     $uid = $user_profile['id'];
     $email = $user_profile['email'];
     $gender = $user_profile['gender'];
     $user = new User();
     $userdata = $user->checkUser($uid, 'facebook', $firstname, $lastname, $email, $twitter_otoken, $twitter_otoken_secret, $gender);
     //echo "hiihii";
     if (!empty($userdata)) {
         // if($userdata['mobile'] != "" && $userdata['current_city'] != "" && $userdata['callingcode'] != "") {
         //user step 2 done
         $_SESSION['userid'] = $userdata['id'];
         $_SESSION['user_name'] = $userdata['first_name'] . ' ' . $userdata['last_name'];
         //header("location:my-profile");
         $userid = $userdata['id'];
         // cookie handling code goes here
         include "utility/encrypt_decrypt.php";
         $year = time() + 31536000;
         $encrypteduname = encrypt($email);
         $cookie_name = "wmsrm";
         $cookie_value = $encrypteduname;
         setcookie($cookie_name, $cookie_value, $year, "/", ".wemakescholars.com");
Example #7
Show file File: login-facebook.php Project: royalswe/yas26
0
require 'config/functions.php';
$facebook = new Facebook(array('appId' => $setting['fb_app_id'], 'secret' => $setting['fb_app_secret']));
$user = $facebook->getUser();
if ($user) {
    try {
        $user_profile = $facebook->api('/me');
    } catch (FacebookApiException $e) {
        error_lxog($e);
        $user = null;
    }
    if (!empty($user_profile)) {
        $username = $user_profile['name'];
        $uid = $user_profile['id'];
        $email = $user_profile['email'];
        $user = new User();
        $userdata = $user->checkUser($uid, 'facebook', $username, $email);
        if (!empty($userdata)) {
            $_SESSION['userid'] = $userdata['id'];
            $_SESSION['oauth_id'] = $uid;
            $_SESSION['user'] = $userdata['username'];
            $_SESSION['email'] = $email;
            $_SESSION['oauth_provider'] = $userdata['oauth_provider'];
            $now = time();
            $query = yasDB_select("SELECT `id` FROM `membersonline` WHERE `memberid` = '{$userdata['id']}'");
            if ($query->num_rows == 0) {
                yasDB_insert("INSERT INTO `membersonline` (id, memberid, timeactive) VALUES ('', '{$userdata['id']}', '{$now}')", false);
            } else {
                yasDB_update("UPDATE `membersonline` SET timeactive='{$now}' WHERE `memberid`='{$userdata['id']}'");
            }
            header("Location: " . $setting['siteurl']);
            exit;
Example #8
Show file File: getTwitterData.php Project: aryalprakash/rroute
0
    $_SESSION['access_token'] = $access_token;
    // Let's get the user's info
    $user_info = $twitteroauth->get('account/verify_credentials');
    // Print user's info
    echo '<pre>';
    print_r($user_info);
    echo '</pre><br/>';
    if (isset($user_info->error)) {
        // Something's wrong, go back to square 1
        header('Location: login-twitter.php');
    } else {
        $twitter_otoken = $_SESSION['oauth_token'];
        $twitter_otoken_secret = $_SESSION['oauth_token_secret'];
        $email = '';
        $uid = $user_info->id;
        $username = $user_info->name;
        $user = new User();
        $userdata = $user->checkUser($uid, 'twitter', $username, $email, $twitter_otoken, $twitter_otoken_secret);
        if (!empty($userdata)) {
            session_start();
            $_SESSION['id'] = $userdata['id'];
            $_SESSION['oauth_id'] = $uid;
            $_SESSION['username'] = $userdata['username'];
            $_SESSION['oauth_provider'] = $userdata['oauth_provider'];
            header("Location: home.php");
        }
    }
} else {
    // Something's missing, go back to square 1
    header('Location: login-twitter.php');
}
Example #9
Show file File: chat.php Project: echmaster/data
0
		#registr{
			display:none;
		}
	</style>
</head>
<body>
	<header><a href="/">Здесь находится шапка сайта!</a></header>
	<div id="left">
		<p>Левый блок сайта</p>
<?php
		require_once getenv("DOCUMENT_ROOT")."/lib/config.php";
		require_once "User.php";
		$login = $_SESSION["login"];
		$pass = $_SESSION["pass"];
		$user=new User($login, $pass);
		if(($login != "") && ($pass != "") && ($user->checkUser() !== false)){
			echo "<h2>Привет, $login</h2>
			<a href='logout.php'>Выйти</a>";
		}else { 
		echo "<form action='login.php' method='post'>
				<table>
					<tr>
						<td>Логин: </td>
						<td><input type='text' name='login'/></td>
					</tr>
					<tr>
						<td>Пароль: </td>
						<td><input type='password' name='password'/></td>
					</tr>
					<tr>
						<td colspan='2' align='right'><input type='submit' value='Войти'/></td>
Example #10
Show file File: index.php Project: bakarisanja/slim
0
    $check_country = file_get_contents('http://ip-api.com/json/80.74.163.201');
    $check_country = json_decode($check_country);
    $check_country = $check_country->country;
    if (strtolower($check_country) !== strtolower($country)) {
        returnError('country doesn`t mach');
    }
    if (!ctype_alpha($username)) {
        returnError('All username chars must be english letters.');
    }
    if (preg_match('/\\s/', $password)) {
        returnError('Password can`t contain any whitespaces.');
    }
    if (strlen($password) < 6) {
        returnError('Password must be longer then five characters.');
    }
    if ($u->checkUser($username)) {
        returnError('Username alredy exists in database, chose anather');
    }
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        returnError('Email is not valid.');
    }
    //whriteing data in database
    $u->createUser($first_name, $last_name, $date_of_birth, $country, $ip, $username, $password, $email);
    //success message
    SuccessMessage($username);
});
//POST ROUTE LOGIN
$app->post('/login', function () {
    //check if some parrams are missing
    if (empty($_POST['username']) || empty($_POST['password'])) {
        returnError('Missing or empty post parameters.');
Example #11
Show file File: session.php Project: nashinomi/kasou_shopping
0
$cUser = new User();
// カレントディレクトリの別のページにリダイレクトします
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$url = $_POST["url"];
//	ログイン判定
if (!$_SESSION['userid']) {
    //	初期化のつもり
    unset($_SESSION['userid']);
    unset($_SESSION['sessionid']);
    $userid = $_POST["userid"];
    $pass = $_POST["pass"];
    //	ユーザー情報を取得する
    $sql = "SELECT * FROM userinfo";
    $cUser->resultSQL($sql);
    if ($cUser->checkUser($userid, $pass) == true) {
        //	セッションID保管
        $_SESSION['userid'] = $userid;
        $_SESSION['username'] = $cUser->get_userName($cUser->get_index());
        $_SESSION['sessionid'] = session_id();
        session_save_path();
        $extra = "top.php";
    } else {
        $extra = "top.php?loginerror=1";
    }
} else {
    unset($_SESSION['userid']);
    unset($_SESSION['sessionid']);
    $extra = "top.php";
}
header("Location: http://{$host}{$uri}/{$extra}");
Example #12
Show file File: reqCheckUser.php Project: JhunCabas/asset-project-system
0
<?php

include_once "../class/Config.php";
include_once "../class/User.php";
$chkUser = new User();
$dbCheck = new config();
$usname = $_GET["regUname"];
//$usname = "ramuss";
$arr = $chkUser->checkUser($usname);
$rows = $dbCheck->num_rows($arr);
$i = 0;
if ($rows > $i) {
    echo $rows;
} else {
    echo $i;
}
?>
Example #13
Show file File: login.php Project: hitoy/domai-ims
0
*/
//初始化
require_once "./init.php";
//加入登陆类
require_once ADMINROOT . "login.class.php";
//初始化模板引擎
$smarty = new Smarty();
//生产环境取消debug
$smarty->debugging = false;
//获取模板所在url并分配
$templateurl = TEMPLATEURL . str_replace(array("\\", "."), array("", ""), $smarty->template_dir[0]);
$smarty->assign("templateurl", $templateurl);
//用户请求登陆的情况
if ($_POST) {
    $cuser = new User();
    $username = trim($_POST['username']);
    $password = trim($_POST['password']);
    if ($cuser->checkUser($username, $password)) {
        $cuser->keepUser();
        header("Location:./");
    } else {
        $errormsg = $cuser->logerrormsg;
        $smarty->assign("errormsg", $errormsg);
        $smarty->display("login.htm");
    }
} else {
    //设置错误提示默认为空并分配
    $errormsg = "";
    $smarty->assign("errormsg", $errormsg);
    $smarty->display("login.htm");
}
Example #14
Show file File: login.php Project: erseco/ugr_sistemas_de_informacion_basados_en_web
0
 *
 *
 *******************************************
 *
 * Controlador de login, checkea si los valores establecidos son correctos
 * y guarda los valores en la sesion y en cookies
 *
 *******************************************/
// Bandera de error para mostrar una advertencia en la vista
$error = false;
if (isset($_POST["email"]) && trim($_POST["email"]) != "" && trim($_POST["password"]) != "") {
    // Obtenemos los campos
    $email = trim($_POST["email"]);
    $password = trim($_POST["password"]);
    // Iniciamos un nuevo objeto de la clase Users
    $user = User::checkUser($email, $password);
    if ($user) {
        // // Iniciamos la sesión PHP
        session_start();
        // Nos guardamos las variables de sesion (usamos el prefijo sess_ por motivos de seguridad)
        $_SESSION["sess_id_user"] = $user->id;
        $_SESSION["sess_name"] = $user->name;
        $_SESSION["sess_email"] = $user->email;
        $_SESSION["sess_role"] = $user->role;
        // Si tenemos marcada la opcion de recordar
        if (isset($_POST["remember"])) {
            // Establecemos la duración en una semana
            $duration = time() + 7 * 24 * 60 * 60;
            // Establecemos las cookies (usamos el prefijo cookies_ por motivos de seguridad)
            setcookie('cookie_id_user', $user->id, $duration);
            setcookie('cookie_name', $user->name, $duration);
Example #15
Show file File: index.php Project: a-melnichuk/SlimAuthTest
0
});
$app->post('/registration', function ($request, $response, $args) {
    $data = $request->getParsedBody();
    $user = new User(db::getInstance());
    $result = $user->addUser($data['username'], $data['password'], $data['email']);
    if ($result) {
        $response->write("Registration successful");
    } else {
        $response->write("Error: wrong data format");
    }
    return $response;
});
$app->post('/login', function ($request, $response, $args) {
    $data = $request->getParsedBody();
    $user = new User(db::getInstance());
    $result = $user->checkUser($data['username'], $data['password']);
    if ($result === false) {
        $response->write(json_encode(array('error' => array('message' => 'Wrong login information.'))));
    } else {
        $response->write(json_encode(array('token' => $result)));
    }
    return $response;
});
$app->get('/movies', function ($request, $response, $args) {
    $movie = new Movie(db::getInstance());
    $result = $movie->getAllMovies();
    if ($result === false) {
        $response->write(json_encode(array('error' => array('message' => 'No records found.'))));
    } else {
        $response->write(json_encode($result));
    }
Example #16
Show file File: 50 Применение знаний.php Project: echmaster/data
0
		#center{
			margin:30px 35% 30px 35%;
		}
	</style>
</head>
<body>
	<header>Здесь находится шапка сайта!</header>
	<div id="left">
		<p>Левый блок сайта</p>
<?php 
require_once getenv("DOCUMENT_ROOT") . "/lib/config.php";
require_once "User.php";
$login = $_SESSION["login"];
$pass = $_SESSION["pass"];
$user = new User($login, $pass);
if ($login != "" && $pass != "" && $user->checkUser() !== false) {
    echo "<h2>Привет, {$login}</h2>\n\t\t\t<a href='logout.php'>Выйти</a>";
} else {
    echo "<form action='login.php' method='post'>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Логин: </td>\n\t\t\t\t\t\t<td><input type='text' name='login'/></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Пароль: </td>\n\t\t\t\t\t\t<td><input type='password' name='password'/></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan='2' align='right'><input type='submit' value='Войти'/></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</form>\t\n\t\t\t<p align='left'><a href='registration.php'>Регистрация</a></p>";
    session_destroy();
}
?>
	<p style="width:100%; background:yellow;"><a href="chat.php">Чат</a></p>	
	</div>
	<div id="right">Правый блок сайта</div>
	<div id="center">
	<h1>Форма обратной связи!</h1>
	<hr />
	<form action='request.php' method='post'>
		<table cellspacing='10'>
			<tr>
Example #17
Show file File: testreg.php Project: Klym/flame
0
 */
session_start();
require "blocks/autoload.php";
require "blocks/db.php";
if (isset($_SESSION['email'])) {
    die("<html><head><meta http-equiv='refresh' content='0; url=/'></head></html>");
}
if (isset($_POST['email'])) {
    $email = $_POST['email'];
    if (empty($email)) {
        unset($email);
    }
}
if (isset($_POST['password'])) {
    $password = $_POST['password'];
    if (empty($password)) {
        unset($password);
    }
}
if (isset($email) || isset($password)) {
    $user = new User();
    $email = $user->checkUserData($email);
    $password = md5($password);
    $password = strrev($password);
    $user->email = $email;
    $user->password = $password;
    $user->db = $db;
    $user->checkUser(session_id());
} else {
    exit("Вы не ввели не всю информацию, вернитесь и заполните все поля.");
}
Example #18
Show file File: getTwitterData.php Project: hqubaisi/Fivedollarwork
0
    // Let's request the access token
    $access_token = $twitteroauth->getAccessToken($_GET['oauth_verifier']);
    // Save it in a session var
    $_SESSION['access_token'] = $access_token;
    // Let's get the user's info
    $user_info = $twitteroauth->get('account/verify_credentials');
    // Print user's info
    echo '<pre>';
    print_r($user_info);
    echo '</pre><br/>';
    if (isset($user_info->error)) {
        // Something's wrong, go back to square 1
        header('Location: login-twitter.php');
    } else {
        $uid = $user_info->id;
        $username = $user_info->name;
        $user = new User();
        $userdata = $user->checkUser($uid, 'twitter', $username);
        if (!empty($userdata)) {
            session_start();
            $_SESSION['id'] = $userdata['id'];
            $_SESSION['oauth_id'] = $uid;
            $_SESSION['username'] = $userdata['username'];
            $_SESSION['oauth_provider'] = $userdata['oauth_provider'];
            header("Location: home.php");
        }
    }
} else {
    // Something's missing, go back to square 1
    header('Location: login-twitter.php');
}
Example #19
Show file File: index.php Project: joshquila/demo2-youse
0
             $email = $profile->emails[1]->handle;
         } else {
             if (isset($profile->emails[0]->handle) && !empty($profile->emails[0]->handle)) {
                 $username = $profile->emails[0]->handle;
                 $email = $profile->emails[0]->handle;
             } else {
                 $username = $uid . '@yahoo.com';
                 $email = $uid . '@yahoo.com';
             }
         }
         $profile_user['name'] = $profile->givenName . ' ' . $profile->familyName;
     }
     /*echo $email;
     die();*/
     $user = new User();
     $userdata = $user->checkUser($uid, 'yahoo', $username, $email, $twitter_otoken, $twitter_otoken_secret, $profile_user);
     /*echo '<pre>';
     print_r($userdata);
     die();*/
     if (!empty($userdata)) {
         header("Location: ../../index.php?social_val=sitelogin&widd=" . $userdata['ID']);
     }
     // if a session does exist and the profile data was
     // fetched without error, print out a simple usercard.
     /*echo sprintf("<img src=\"%s\"/><p><h2>Hi <a href=\"%s\" target=\"_blank\">%s!</a></h2></p>\n", $profile->image->imageUrl, $profile->profileUrl, $profile->nickname);
       if(isset($profile->status->message ) && $profile->status->message != "") {
         $statusDate = date('F j, y, g:i a', strtotime($profile->status->lastStatusModified));
         echo sprintf("<p><strong>&#8220;</strong>%s<strong>&#8221;</strong> on %s</p>", $profile->status->message, $statusDate);
       }
       echo "<p><a href=\"?logout\">Logout</a></p>";*/
 }
Example #20
Show file File: common.php Project: Zerolone/soutuan8
0
    //本地调试用Config文件
    require 'include/config_local.php';
} else {
    //网络用Config文件
    require 'include/config.php';
}
//函数地址
require 'include/function.php';
//连接数据库
require 'class/' . DB_TYPE . '.php';
//声明数据库
$MyDatabase = new Database();
//抓取类
require 'class/snatch.php';
//用户类
require 'class/user.php';
///////////////////Code///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$title = '';
$forumtitle = '';
//初始化用户
$user = new User();
//检测用户,取默认的用户名
$Refresh_msg = $user->checkUser($MyDatabase, '', '');
//获取用户组信息
$group = $user->getGroupInfo($MyDatabase);
//如果Theme不为空,则
if ($user->theme) {
    define('TP', 'template/' . $user->theme . '/');
} else {
    define('TP', $TP);
}
Example #21
Show file File: login_process.php Project: KevinLegara/Testing
0
<?php

session_start();
include_once 'config/database.php';
include_once 'repository/User.php';
$database = new Database();
$db = $database->getConnection();
$user = new User($db);
$user->email = trim($_POST['email']);
$user->password = trim($_POST['password']);
try {
    $count = $user->checkUser()->rowCount();
    $row = $user->checkUser()->fetch(PDO::FETCH_ASSOC);
    if ($row['password'] == $user->password) {
        echo 'ok';
        $_SESSION['user_session'] = $row['name'];
    } else {
        echo "email or password does not exist.";
    }
} catch (PDOException $e) {
    echo $e->getMessage();
}
Example #22
Show file File: index.php Project: yariknechyporuk/granika
0
	<link rel="stylesheet" href="fancybox/jquery.fancybox.css">
	<link rel="stylesheet" href="css/style.css">
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
	<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
	<script src="js/datepicker-ru.js"></script>
	<script src="ckeditor/ckeditor.js"></script>
	<script src="fancybox/jquery.fancybox.pack.js"></script>
	<script src="js/scripts.js"></script>
</head>
<body>
	<div class="body">
		<?php 
//В зависимости от полученных данных с POST и GET выполнить нужный скрипт (что то вроде From Controller)
?>
		<?php 
if ($user->checkUser() && (!empty($_POST['action']) || !empty($_GET['action']))) {
    //Доступ к функциям администратирования есть только у авторизированного пользователя
    include 'views/form.php';
} elseif (!empty($_POST['logout']) || !empty($_POST['login']) || !empty($_GET['login'])) {
    //Дейстия касательно авторизации
    include 'views/login.php';
} else {
    //Во всех остальных случаях просто выводяться отсортированные записи
    $result = $record->getAll(array(), $_GET['sort'], $_GET['order'], '', 'array');
    include 'views/index.php';
}
?>
	</div>
</body>
</html>
Example #23
Show file File: login.php Project: echmaster/data
0
<?php

require_once getenv("DOCUMENT_ROOT") . "/lib/config.php";
require_once "User.php";
$login = $_POST["login"];
$pass = md5($_POST["password"]);
$user = new User($login, $pass);
if ($user->checkUser() !== false) {
    session_start();
    $_SESSION["login"] = $login;
    $_SESSION["pass"] = $pass;
    /*setcookie("login",$login);
    		setcookie("pass",$pass);*/
    header("Location: http://php.loc/successlogin.php?login={$login}");
} else {
    header("Location: http://php.loc/notsuccesslogin.php");
}
Example #24
Show file File: login-facebook.php Project: joshquila/demo2-youse
0
if ($user) {
    try {
        // Proceed knowing you have a logged in user who's authenticated.
        $user_profile = $facebook->api('/me');
    } catch (FacebookApiException $e) {
        error_log($e);
        $user = null;
    }
    /*echo '<pre>';print_r($user_profile);echo '</pre>';
    die();
    */
    if (!empty($user_profile)) {
        # User info ok? Let's print it (Here we will be adding the login and registering routines)
        $username = $user_profile['name'];
        $uid = $user_profile['id'];
        $email = $user_profile['email'];
        $user = new User();
        $userdata = $user->checkUser($uid, 'facebook', $username, $email, $twitter_otoken, $twitter_otoken_secret, $user_profile);
        if (!empty($userdata)) {
            header("Location: ../index.php?social_val=sitelogin&widd=" . $userdata['ID']);
        }
    } else {
        # For testing purposes, if there was an error, let's kill the script
        die("There was an error.");
    }
} else {
    # There's no active session, let's generate one
    $login_url = $facebook->getLoginUrl(array('scope' => 'email'));
    header("Location: " . $login_url);
}
?>
Example #25
Show file File: google_login.php Project: joshquila/demo2-youse
0
    $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
    header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
}
//echo $_SESSION['token'];
if (isset($_SESSION['token'])) {
    $client->setAccessToken($_SESSION['token']);
}
if ($client->getAccessToken()) {
    $me = $plus->people->get('me');
    //print "Your Profile: <pre>" . print_r($me, true) . "</pre>";
    //die();
    $uid = $me['id'];
    $username = $me['emails'][0]['value'];
    $email = $me['emails'][0]['value'];
    $user = new User();
    $userdata = $user->checkUser($uid, 'googleplus', $username, $email, $twitter_otoken, $twitter_otoken_secret, $me);
    if (!empty($userdata)) {
        header("Location: ../index.php?social_val=sitelogin&widd=" . $userdata['ID']);
    }
    /*$params = array('maxResults' => 100);
      $activities = $plus->activities->listActivities('me', 'public', $params);
      print "Your Activities: <pre>" . print_r($activities, true) . "</pre>";
      
      $params = array(
        'orderBy' => 'best',
        'maxResults' => '20',
      );
      $results = $plus->activities->search('Google+ API', $params);
      foreach($results['items'] as $result) {
        print "Search Result: <pre>{$result['object']['content']}</pre>\n";
      }*/
Example #26
Show file File: index.php Project: Perrywzp/myflow-php
0
//header('Content-type: application/x-javascript');
header('Content-Type: text/html; charset=utf-8');
//网页编码
session_start();
include_once 'config.php';
function __autoload($classname)
{
    include "class/" . strtolower($classname) . ".class.php";
}
print_r($_REQUEST['m']);
switch ($_REQUEST['m']) {
    // 验证是否登陆
    case 'cu':
        $m = new User();
        $m->checkUser();
        break;
        // 登陆
    // 登陆
    case 'l':
        $m = new User();
        $m->login();
        break;
        // 登出
    // 登出
    case 'lo':
        $m = new User();
        $m->logout();
        break;
        //注册
    //注册
Example #27
Show file File: login.php Project: VelMrnk/LaNayFerma
0
$session = $facebook->getSession();
if (!empty($session)) {
    # пробуем получить информацию о текущем пользователе
    try {
        $uid = $facebook->getUser();
        $user = $facebook->api('/me');
    } catch (Exception $e) {
    }
    if (!empty($user)) {
        # Выводим имя пользователя и проверям, есть ли такой пользователь в нашей БД
        echo '<pre>';
        print_r($user);
        echo '</pre><br/>';
        $username = $user['name'];
        $user = new User();
        $userdata = $user->checkUser($uid, $username);
        if (!empty($userdata)) {
            session_start();
            $_SESSION['id'] = $userdata['id'];
            $_SESSION['face_id'] = $uid;
            $_SESSION['username'] = $userdata['username'];
            header("Location: ?option=main");
        }
    } else {
        die("Ошибка!");
    }
} else {
    # если сессия не активна - пытаемся залогиниться в facebook
    $login_url = $facebook->getLoginUrl();
    header("Location: " . $login_url);
}