/** * To register a user * * @param RegistrationRequest $request * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function postRegister(RegistrationRequest $request) { $user = $this->userRepo->register($request); if ($user->save()) { $this->userRepo->sendConfirmationEmail($user); $this->flash->success('Your confirmation email has been sent.'); } return redirect('/auth/register'); }
function userHandler($action) { $user = new user($_GET); switch ($action) { case 'login': $user->login(); break; case 'register': $user->register(); break; case 'searchUserName': $user->searchUserName(); break; case 'upload': $user->upload($_FILES); break; } }
/** * Regsiters a new user * @global array $__in * @global array $__out * @return boolean */ function register() { global $__in, $__out; if ($__in['__is_form_submitted']) { // if form is submitted try { $user = new user(); $user->register($__in['user']); return dispatcher::redirect("getall", "registered_successfully"); } catch (ValidationException $ex) { $ex->publish_errors(); $__out['user'] = $__in['user']; return false; } catch (Exception $ex) { throw $ex; } } else { // if form is not submitted $__out['user'] = array(); return true; } // end if form submitted }
<?php require_once __DIR__ . '/user.php'; $user = new user(); $user->sec_session_start(); if ($user->login_check()) { header("location: userpage.php"); } if (isset($_POST['username'], $_POST['email'], $_POST['password'], $_POST['confpassword'], $_POST['p'])) { $status = $user->register($_POST['username'], $_POST['email'], $_POST['p']); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <title>Home</title> <!-- Bootstrap Core CSS --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- Custom CSS --> <link href="css/style.css" rel="stylesheet"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]-->
<?php //remember submitted values in case of error $_username = ''; $_firstname = ''; $_lastname = ''; $_address = ''; $_city = ''; $_zipcode = ''; $_email = ''; //Registration form was submitted if (isset($_POST['submit'])) { include_once 'php/user_class.php'; $newuser = new user(); $newuser->createFromPost($_POST); $error = $newuser->register(); //did registration succeed? if ($error == NULL) { session_start(); $_SESSION['msg_registered'] = "Registered"; header("Location: index.php"); die; } else { if (isset($_POST['username'])) { $_username = $_POST['username']; } if (isset($_POST['firstname'])) { $_firstname = $_POST['firstname']; } if (isset($_POST['lastname'])) { $_lastname = $_POST['lastname'];
session_start(); include_once "user.inc.php"; //changed 12/1 to get around log-back-in bug if (isset($_SESSION["user"])) { $localuser = unserialize($_SESSION["user"]); if ($localuser->isLoggedIn() == true) { header("Refresh: 0; URL=userProfile.php"); } } if (isset($_POST["username"], $_POST["password"], $_POST["verify_password"], $_POST["email"], $_POST["class"])) { $thisPass = $_POST["password"]; $thisPassVerify = $_POST["verify_password"]; if ($thisPass == $thisPassVerify) { $newuser = new user("", ""); if (!$newuser->register($_POST["username"], $thisPass, $_POST["class"], $_POST["email"])) { echo "Some Error in creating your character! Be sure all fields are filled out and that your user name has not been used already."; } else { $_SESSION["user"] = serialize($newuser); session_write_close(); header("Refresh: 0; URL=userProfile.php"); } } } else { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link rel="stylesheet" type="text/css" href="style.css" /><title>Register a new account with me! Please, I'm begging you!</title></head> <body>Please fill out <em>all</em> information! <form action="newAccount.php" method="post">
function ___onTarget() { if ($_REQUEST['action'] == 'register') { $GLOBALS['core']->event('register'); //validation if (empty($_REQUEST['username'])) { $GLOBALS['err']->add("Name can't be blank.", array('username', 'register')); } if (user::exists($_REQUEST['username'])) { $GLOBALS['err']->add("Name already exists. choose another.", array('username', 'register')); } if (empty($_REQUEST['password1'])) { $GLOBALS['err']->add("Password can't be blank.", array('password1', 'register')); } elseif ($_REQUEST['password1'] != $_REQUEST['password2']) { $GLOBALS['err']->add("Passwords don't match.", array('password2', 'register')); } elseif ($_REQUEST['password1'] == $_REQUEST['password2'] && $GLOBALS['err']->none()) { //logout first, just in case if (user::whoAmI() == 'temp') { user::logout(); } if (user::register($_REQUEST['username'], $_REQUEST['password1'])) { session_regenerate_id(); //sort of prevent session-hijacking $_REQUEST['password'] = $_REQUEST['password1']; $_REQUEST['action'] = 'login'; $GLOBALS['state'] = 'successful registration'; $GLOBALS['core']->event('registrationSuccess'); } else { $GLOBALS['err']->add("Unable to register for some reason. Please let us know about it.", 'registration'); $GLOBALS['core']->event('registrationFailure'); } } } if ($_REQUEST['action'] == 'login') { $GLOBALS['core']->event('login'); if (empty($_REQUEST['username'])) { $GLOBALS['err']->add("You left out the name.", array('username', 'login')); } if (empty($_REQUEST['password'])) { $GLOBALS['err']->add("You left out the password.", array('password', 'login')); } if (!empty($_REQUEST['username']) && !empty($_REQUEST['password'])) { if (!user::login($_REQUEST['username'], $_REQUEST['password'])) { $GLOBALS['err']->add("Wrong.", 'login'); } else { $loginSuccess = true; session_regenerate_id(); //prevent session hijacking. } } $GLOBALS['core']->event($loginSuccess ? 'loginSuccess' : 'loginFailure'); } if ($_REQUEST['action'] == 'logout') { $GLOBALS['core']->event('logout'); session_regenerate_id(true); //kill old session. user::logout(); header("Location: /"); exit; } if (!user::loggedIn()) { //login as temp user //user::loginTemp(); } }
function login_by_qq() { include INCLUDES_PATH . 'qqapi/qqConnectAPI.php'; global $_db, $_cache, $_user; $qc = new QC(); $access_token = $qc->qq_callback(); $qq_uid = $qc->get_openid(); if ($qq_uid) { $_user = user::get_one(array('qq_uid' => $qq_uid)); $user_id = $_user->user_id; $qc = new QC($access_token, $qq_uid); $user_info = $qc->get_user_info(); //获取用户等基本信息 if (!$user_id) { $user_id = user::register(array('screen_name' => $user_info['nickname'], 'qq_uid' => $qq_uid, 'avatar_url' => $user_info['figureurl_qq_1'])); $_user = user::get_one(array('user_id' => $user_id)); $res = 'new_user'; } else { $res = $_user; } $_SESSION['uid'] = $user_id; //set_cookie('uid',$user_id); return $res; } else { //授权失败 } return false; }
$json = $user->register('First User', '*****@*****.**', 'test', 'test'); //Pass, activate, make admin var_dump($user); $user = ''; $user = new user(); $json .= $user->register('Duplicate Email', 'test@test', 'test', 'test'); //Fail var_dump($user); $user = ''; $user = new user(); $json .= $user->register('Password Mismatch', '*****@*****.**', 'test', 'tset'); //Fail var_dump($user); $user = ''; $user = new user(); $json .= $user->register('Second User', '*****@*****.**', 'test', 'test'); //Pass var_dump($user); $user = ''; $user = new user(); $json .= $user->login('First User', 'tset'); //Fail var_dump($user); $user = ''; $user = new user(); $json .= $user->login('First', 'tset'); //Fail var_dump($user); $user = ''; $user = new user(); $json .= $user->login('Stupid', 'test');
<?php require_once 'user_class.php'; $user = new user(); $user->createFromPost($_POST); $error = $user->register(); if ($error == NULL) { session_start(); $_SESSION['msg_registered'] = "Registered"; $response = $_SESSION; } else { $response = $error; } echo json_encode($response);
$error = false; if (config::get('user_regpass')) { if ($_POST['regpass'] != config::get('user_regpass')) { $smarty->assign('error', 'Registration password does not match.'); $error = true; } } if (!$_POST['usrlogin']) { $smarty->assign('error', 'You missed to specify a login.'); $error = true; } if (!$_POST['usrpass']) { $smarty->assign('error', 'You missed to specify a password.'); $error = true; } if (strlen($_POST['usrpass']) < 3) { $smarty->assign('error', 'Your password needs to have at least 4 chars.'); $error = true; } if (!$error) { $pilot = null; $id = null; user::register(slashfix($_POST['usrlogin']), slashfix($_POST['usrpass']), $pilot, $id); $page->setContent('Account registered.'); $page->generate(); return; } } $smarty->assign('actionURL', edkURI::page('register')); $page->setContent($smarty->fetch(get_tpl('user_register'))); $page->generate();
<?php if (isset($_SESSION['userid'])) { header('Location: ?page=profile&id=' . $_SESSION['userid']); die; } if (isset($_POST['submit'])) { $user = new user(); if ($user->register($_POST['username'], $_POST['email'], 0, $_POST['password'])) { header('Location: ?page=profile&id=' . $_SESSION['userid']); die; } else { $message = $_SESSION['message']; unset($_SESSION['message']); } } echo $twig->render('register.html', array('message' => isset($message) ? $message : null));
//But just in case it isn't... if (!$user) { $user = new user(); } if (isset($_GET['action'])) { $action = $_GET['action']; } else { $msg = returnError("No action specified."); } if (!$user->isLoggedIn()) { switch ($action) { default: $msg = returnError("Action not found: {$action}"); break; case 'register': $msg = $user->register($_POST['username'], $_POST['email'], $_POST['password'], $_POST['password2']); break; case 'login': $msg = $user->login($_POST['username'], $_POST['password']); break; } } else { if ('register' == $action) { die("You are already registered"); } switch ($action) { default: $msg = returnError("Action not found: {$action}"); break; case 'logout': $msg = $user->logout();
<?php require_once "src/connection.php"; session_start(); if (isset($_SESSION['user']) != false) { header("location: main.php"); } if ($_SERVER["REQUEST_METHOD"] == "POST") { $newUser = user::register($_POST['email'], $_POST['password'], $_POST['password2'], $_POST['description']); if ($newUser != false) { $_SESSION['user'] = $newUser; header('location: main.php'); } echo "register error"; } ?> <form method="POST" action="register.php"> <input type= "text" name="email" placeholder="enter mail"><br> <input type= "text" name="password" placeholder="enter password"><br> <input type= "text" name="password2" placeholder="repeat password"><br> <input type= "text" name="description" placeholder="napisz cos o sobie"><br> <input type= "submit" value ="register"> </form>
<?php require_once "../apps/User.php"; $u = new user(); if (!empty($_POST['email']) && !empty($_POST['password']) && !empty($_POST['cn']) && !empty($_POST['c']) && !empty($_POST['st']) && !empty($_POST['l']) && !empty($_POST['o']) && !empty($_POST['ou']) && !empty($_POST['tel'])) { if ($u->register($_POST['email'], $_POST['password'], $_POST['c'], $_POST['st'], $_POST['l'], $_POST['o'], $_POST['ou'], $_POST['cn'], $_POST['tel'])) { header("refresh:2;url=login.php"); echo "Register With success"; } else { header("Location: register.html?error=yes"); } } elseif (isset($_POST['email']) && isset($_POST['password'])) { if ($u->login($_POST['email'], $_POST['password'])) { header("Location: index.php"); } else { header("Location: login.php?error=yes"); } } elseif (!empty($_POST['cn']) && !empty($_POST['c']) && !empty($_POST['st']) && !empty($_POST['l']) && !empty($_POST['o']) && !empty($_POST['ou']) && !empty($_POST['tel'])) { if ($u->updateUser($_POST['c'], $_POST['st'], $_POST['l'], $_POST['o'], $_POST['ou'], $_POST['cn'], $_POST['tel'])) { header("Location: profile.php?update=ok"); } else { header("Location: profile.php?error=yes"); } } elseif (!empty($_POST['subj']) && !empty($_POST['type']) && !empty($_POST['len']) && !empty($_POST['d']) && !empty($_POST['hash'])) { if ($u->demande($_POST['hash'], $_POST['len'], $_POST['subj'], $_POST['type'], $_POST['d'])) { header("Location: demande.php?add=ok"); } else { header("Location: demande.php?error=yes"); } }
<?php include 'classes.php'; $a = new mysqldatabase(); $a->connect(); session::construct(); if (isset($_POST['logout'])) { session::destruct(); session::construct(); } if (isset($_POST['user_register'])) { $b = new user(); $b->assign($_POST['fname'], $_POST['email'], $_POST['pass'], $_POST['cpass']); $b->register(); } if (isset($_POST['user_login'])) { $c = new user(); $c->assign('', $_POST['email'], $_POST['pass'], ''); $c->login(); } if (isset($_SESSION['set_user'])) { $set_user = $_SESSION['set_user']; } ?> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8">
<div id="bar"> <div id="login">LOGIN</div> <div id="reg">NOT REGISTERED?</div> <div id="panel"> <form action="submit2.php" name="frm1" method="post"> Username: <input type="text" name="uname"><br> Password: <input type="password" name="pwd"><br> <input type="submit" name="go"> </form> </div> <div id="panel1"> <?php include 'user.php'; $user_obj = new user(); $user_obj->register(); ?> </div> </div> <!--<div class="wrapper"> <div id="slider"> <img id="1" src="1.jpeg"> <img id="2" src="2.jpeg"> <img id="3" src="3.jpeg"> </div> --> <div id="container"> <div class="controller" id="prev"></div>
<?php // register page if (user::is_logged()) { redirect('?p=interests'); } if (!empty($_POST['login']) && !empty($_POST['password']) && !empty($_POST['email'])) { $login = $_POST['login']; $password = $_POST['password']; $password2 = $_POST['password2']; $email = $_POST['email']; if ($password !== $password2) { redirect("?p=register&error=3"); // not same password } $registered = user::register($login, $password, $email); if ($registered == 0) { redirect("?p=connect"); } elseif ($registered == -2) { redirect("?p=register&error=2"); // duplication } else { redirect("?p=register&error=1"); // unknown error } die; } else { // display registration form ?> <h2>Registration</h2>