当前位置: 首页>>代码示例>>PHP>>正文


PHP User::checkUser方法代码示例

本文整理汇总了PHP中User::checkUser方法的典型用法代码示例。如果您正苦于以下问题:PHP User::checkUser方法的具体用法?PHP User::checkUser怎么用?PHP User::checkUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在User的用法示例。


在下文中一共展示了User::checkUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: register

 /** 获取列表搜索信息 **/
 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;
 }
开发者ID:xuyintao,项目名称:thindev,代码行数:33,代码来源:user.php

示例2: insertCompany

 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;
 }
开发者ID:prasanthkumara,项目名称:samyug_v1,代码行数:22,代码来源:Company.class.php

示例3: facebook

 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);
     }
 }
开发者ID:jaydeepsen506,项目名称:jaydeep,代码行数:37,代码来源:site_facebook_login.php

示例4: dbSanitize

<?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'>
开发者ID:ddavisgraphics,项目名称:ThesisFrameworkApp,代码行数:31,代码来源:index.php

示例5: id

$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();
开发者ID:beshad,项目名称:login-facebook-twitter,代码行数:31,代码来源:login-facebook.php

示例6: catch

     // 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");
开发者ID:EarthBug,项目名称:irksome-barnacle,代码行数:31,代码来源:login-facebook.php

示例7: Facebook

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;
开发者ID:royalswe,项目名称:yas26,代码行数:31,代码来源:login-facebook.php

示例8: header

    $_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');
}
开发者ID:aryalprakash,项目名称:rroute,代码行数:31,代码来源:getTwitterData.php

示例9: getenv

		#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>
开发者ID:echmaster,项目名称:data,代码行数:31,代码来源:chat.php

示例10: returnError

    $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.');
开发者ID:bakarisanja,项目名称:slim,代码行数:31,代码来源:index.php

示例11: User

$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}");
开发者ID:nashinomi,项目名称:kasou_shopping,代码行数:31,代码来源:session.php

示例12: User

<?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;
}
?>

开发者ID:JhunCabas,项目名称:asset-project-system,代码行数:17,代码来源:reqCheckUser.php

示例13: Smarty

*/
//初始化
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");
}
开发者ID:hitoy,项目名称:domai-ims,代码行数:31,代码来源:login.php

示例14: trim

 *
 *
 *******************************************
 *
 * 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);
开发者ID:erseco,项目名称:ugr_sistemas_de_informacion_basados_en_web,代码行数:31,代码来源:login.php

示例15: function

});
$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));
    }
开发者ID:a-melnichuk,项目名称:SlimAuthTest,代码行数:31,代码来源:index.php


注:本文中的User::checkUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。