function checkType() { if (!strcmp("register", $_POST[type])) { registerUser(); } else { if (!strcmp("login", $_POST[type])) { login(); } else { echo "You've arrived at this page in error."; redir("../login.html"); } } }
* Crea un nuevo usuario en Acceso > usuarios con role de invitado (guest) * * $http({ * method: 'POST', * url: 'api/registerUser/', * data: { 'NAME': 'usuario', * 'email': $scope.email, * 'email2': '', * 'password': $scope.password, * 'password2': $scope.password2 }, * }) * .success(function (result) { console.log("Si", result); }) * .error(function(data){ console.log("error",data) }); */ case "registerUser": registerUser($d["name"], $d["email"], $d["email2"], $d["password"], $d["password2"]); break; default: throw new Wire404Exception(); } // // $http.post('http://ip/web-service/', {action: 'getPage', pageId: 1046 }) // case "sendEmail": // $event->return = $this->sendEmail( $d["from"], $d["to"], $d["subject"], $d["message"] ); // break; // // $http.post('http://ip/web-service/', {action: 'getPage', pageId: 1046 }) // case "searchPages": // $event->return = $this->searchPages( $d["selector"] ); // break; // // $http.post('http://ip/web-service/', {action: 'getPage', pageId: 1046 }) // case "getFieldsets": // $event->return = $this->getFieldsets($d["page"]);
<?php if (isset($do) && $do == "send") { if (!isset($_POST['register'])) { header('Location:' . createUrl(array("action" => "register"))); } else { $error = registerUser($db); } }
<?php require_once 'includes/header.php'; require_once DIR_APP . 'users.php'; if (!empty($_SESSION['logged_in'])) { redirect('home.php'); } $msg = ''; //if (isset($_POST["signup"]) && !empty($_POST["signup"])) if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (registerUser($_POST)) { //redirect('home.php'); $msg = 'Confirmation email has been sent to your email address.'; echo '<script> $(function() { $( "#dialog-message" ).dialog({ modal: true, buttons: { Ok: function() { $( this ).dialog( "close" ); } } }); });</script>'; } } ?> <div class="home-page content"> <div id="dialog-message" title="Confirm Your Email"> <h3><?php
function displayInsertUser() { if (isset($_POST['submit'])) { $ID = $_POST['ID']; $pass1 = $_POST['pass1']; $pass2 = $_POST['pass1']; $adminLvl = $_POST['adminLvl']; $msg = registerUser($ID, $pass1, $pass2, $adminLvl); if (empty($msg)) { echo "New user <b>" . strtoupper($ID) . "</b> added successfully."; } } ?> <form name="insert" method="post" action="/?newuser=true"> <p>Add a new user:</p> <p>Login ID:<input type="text" name="ID"></p> <p>Password:<input type="password" name="pass1"></p> <p>Re-type password:<input type="password" name="pass2"></p> <p>Admin Level:<input type="text" name="adminLvl"></p> <p><input type="submit" name="submit" value="Submit"></p> </form> <?php }
$registerErrors['password'][] = 'Bitte geben Sie ein Passwort ein.'; } elseif (!filterPassword($pw)) { $registerErrors['password'][] = 'Ihr Passwort muss mind. sechs Zeichen lang und einen Groß-, einen Kleinbuchstaben, sowie mind. eine Zahl enthalten.'; } if (empty($pwConfirm)) { $registerErrors['pwConfirm'][] = 'Bitte bestätigen Sie Ihr Passwort.'; } if ($pw !== $pwConfirm) { $registerErrors['pwConfirm'][] = 'Die Passwörter stimmen nicht überein.'; } if (!isset($agb)) { $registerErrors['agb'][] = 'Um ein Händlerkonto zu erstellen müssen Sie unsere AGB akzeptieren.'; } } if (empty($registerErrors)) { $success = registerUser($mail, $pw, $db); if ($success) { unset($_POST); $successMsg = 'Ihr Händlerkonto wurde erstellt. Sie erhalten in Kürze eine E-Mail. Sollten Sie diese nicht erhalten, stellen Sie bitte sicher auch im Spam-Ordner Ihres E-Mail Programms nachgeschaut zu haben.'; } } break; case 'login': if (isset($_POST['login_mail'], $_POST['login_password']) && !empty($_POST['login_mail']) && !empty($_POST['login_password'])) { $data = getUserData($_POST['login_mail'], $db); if ($data !== false) { // create the password $typedPassword = hash('sha512', $_POST['login_password'] . $data['user_salt']); if ($typedPassword == $data['user_hash']) { // Fill Session $_SESSION['user_id'] = $data['user_id'];
function main($registerKey) { require '../includes/connect.php'; createUsersTable(); if (isset($_GET['register']) && $_GET['register'] == true) { registerUser($registerKey); } elseif (isset($_GET['username']) && isset($_GET['password'])) { autheticateUser(); } //end of issets }
<?php include_once 'database/connection.php'; include_once 'database/users.php'; $referer; if (isset($_COOKIE['redirect'])) { $referer = $_COOKIE['redirect']; } else { $referer = './index.php'; } if (isset($_POST['confirm_btn'])) { if (!registerUser($_POST['username'], $_POST['password'])) { echo "<script>alert('User is already registered!')</script>"; } else { echo "<script>alert('Successfully registered')</script>"; } header('Location: ' . $referer); } else { if (isset($_POST['cancel_btn'])) { header('Location: ' . $referer); } else { echo "<h1>You shouldn't be here</h1>"; } }
<?php require_once $_SERVER['DOCUMENT_ROOT'] . 'includes/common.php'; if (isset($_POST['submitBtn'])) { // Get user input $username = isset($_POST['username']) ? $_POST['username'] : ''; $password1 = isset($_POST['password1']) ? $_POST['password1'] : ''; $password2 = isset($_POST['password2']) ? $_POST['password2'] : ''; // Try to register the user $error = registerUser($username, $password1, $password2); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>Register with Stint</title> <link href="css/styles.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main"> <?php if (!isset($_POST['submitBtn']) || $error != '') { ?> <br/> <div class="image/loginlogo"> <img src="image/stint500.jpg" alt="Stint Ireland Logo" > </div> <form action="<?php echo $_SERVER['PHP_SELF']; ?>
function userRegister($mobileNum, $SMS, $md5Password) { if (isValidMobileNum($mobileNum)) { if (!isUserNameRegister($mobileNum)) { if (isSMSCorrect($mobileNum, $SMS)) { if (registerUser($mobileNum, $md5Password)) { die(urldecode(json_encode(array('success' => '注册成功')))); //registered } die(urldecode(json_encode(array('error' => '验证码错误')))); //wrong SMS } die(urldecode(json_encode(array('error' => '验证码错误')))); } die(urldecode(json_encode(array('error' => '号码已经被注册')))); } die(urldecode(json_encode(array('error' => '号码已经被注册')))); }
if (empty($_POST['rPassword'])) { $loginError .= C_LANG2 . "<br>"; } if (empty($_POST['rEmail'])) { $loginError .= C_LANG3 . "<br>"; } else { $loginError .= validEmail($_POST['rEmail']); } if (empty($_POST['terms'])) { $loginError .= C_LANG4 . "<br>"; } if ($loginError) { include "templates/" . $CONFIG['template'] . "/login.php"; die; } else { $loginError = registerUser($_POST['rUsername'], $_POST['rPassword'], $_POST['rEmail']); include "templates/" . $CONFIG['template'] . "/login.php"; die; } } /* * reset eCredit sessions * */ if ($_SESSION['eCreditsInit']) { unset($_SESSION['eCreditsInit']); unset($_SESSION['eCreditsAwardTo']); unset($_SESSION['eCredits_start']); } /* * logout user
if ($event["nonmember_price"] > 0) { // user has just signed up for a paid event $registrants = $_POST["registrants"]; $actual_price = $actual_price * $registrants; $price_in_cents = intval($actual_price * 100); // create a customer (if required) and charge the user if (isset($_POST["type"])) { if ($_POST["type"] == "new") { $token = $_POST['stripeToken']; $user["stripe_cust_id"] = createStripeCustomer($token, $user); } } $stripe_charge_id = createEventCharge($user, $event, $price_in_cents, $registrants); $_SESSION["payment"] = $actual_price; } $register = registerUser($_GET["id"], $_SESSION["user_id"], $registrants, $stripe_charge_id); $_SESSION["registered"] = true; header("Location:/events/" . $event["event_id"] . "/"); } else { ?> <html> <?php include ROOT_PATH . "inc/head.php"; ?> <body> <?php include ROOT_PATH . "inc/header.php"; ?> <main class="wrapper content"> <div class="inner-wrap"> <div class="breadcrumb"><a href="/events/">Events</a> > <?php
var pass = document.forms["myLoginForm"]["password"].value; if (pass == null || pass == "") { alert("Password must be filled out"); return false; } } </script> </head> <?php if (isset($_REQUEST['submit'])) { if ($_REQUEST['type'] == 'signUp') { $registerUserMessage = registerUser(); } if ($_REQUEST['type'] == 'logIn') { $logInUserMessage = logIn(); } } ?> <?php if (!empty($_SESSION['id'])) { $sessionId = $_SESSION['id']; $sessionEmail = $_SESSION['email']; } ?>
function requestToken($username, $password, $description = null) { if (loginPortal($username, $password)) { if (!getUser($username)) { registerUser($username, $password); } $token = generateToken(256); if (insertToken($username, $token, $description)) { return $token; } else { return false; } } else { // Incorrect login return false; } }
} } $averagePerSteps[$key][$numKey][] = $stepAv; } } $retVal = (object) array('groupedData' => $group, 'averageData' => $average, 'averageDataSteps' => $averagePerSteps, 'averageGeneral' => $groupAverage); return $retVal; } connectToDB(); if (isset($_POST['register_form_btn'])) { if (isset($_POST['username']) && isset($_POST['email']) && isset($_POST['password']) && isset($_POST['repassword'])) { if ($_POST['password'] === $_POST['repassword']) { $userName = $_POST['username']; $userPass = $_POST['password']; $userEmail = $_POST['email']; $reg = registerUser($userName, $userPass, $userEmail); if ($reg === true) { loginUser($userName, $userPass); } else { //not registered } } else { //wrong re-pass } } else { //not all set } $_POST['register_form_btn']; } if (isset($_POST['login_form_btn'])) { if (isset($_POST['username']) && isset($_POST['password'])) {
function associateGroupWithForm($groupId, $formId) { global $sourceFolder, $moduleFolder; require_once "{$sourceFolder}/{$moduleFolder}/form.lib.php"; $existsQuery = 'SELECT `group_id` FROM `' . MYSQL_DATABASE_PREFIX . 'groups` WHERE `form_id` = \'' . $formId . "'"; $existsResult = mysql_query($existsQuery); if (!$existsResult) { displayerror($existsQuery . ' ' . mysql_error()); } if (mysql_num_rows($existsResult)) { displayerror('The given form is already associated with another group.'); return false; } $isFormEmpty = form::getRegisteredUserCount($formId) == 0; if (!isGroupEmpty($groupId) && !$isFormEmpty) { displayerror('The group cannot be associated with the form because neither the given group, nor the selected form is empty.'); return false; } if (!form::isGroupAssociable($formId)) { displayerror('The selected form cannot be associated with a group because it either allows anonymous users to register, and does not allow users to unregister.'); return false; } if ($isFormEmpty) { /// Copy group users to form $groupUsers = getUsersRegisteredToGroup($groupId); $groupUsersCount = count($groupUsers); require_once "{$sourceFolder}/{$moduleFolder}/form/registrationformsubmit.php"; for ($i = 0; $i < $groupUsersCount; $i++) { registerUser($formId, $groupUsers[$i]); } } else { $registeredUsers = form::getRegisteredUserArray($formId); if (count($registeredUsers) > 0) { $insertQuery = 'INSERT INTO `' . MYSQL_DATABASE_PREFIX . 'usergroup` (`user_id`, `group_id`) VALUES '; $registeredUserCount = count($registeredUsers); for ($i = 0; $i < $registeredUserCount; $i++) { $registeredUsers[$i] = "({$registeredUsers[$i]}, {$groupId})"; } $insertQuery .= implode($registeredUsers, ', '); if (!mysql_query($insertQuery)) { displayerror('Could not move registered users to group.'); return false; } } } /// Update group table, copy all users to group $updateQuery = 'UPDATE `' . MYSQL_DATABASE_PREFIX . "groups` SET `form_id` = '{$formId}' WHERE `group_id` = '{$groupId}'"; if (!mysql_query($updateQuery)) { displayerror('Could not associate the given group with the selected form.'); return false; } return true; }
$errors[] = 'Please enter a username.'; } $password = trim($_POST['password']); if (empty($password)) { $errors[] = 'Please enter a password'; } if (empty($_POST['password2'])) { $errors[] = 'Please confirm a password'; } if (empty($errors) && $_POST['password'] != $_POST['password2']) { $errors[] = 'Your passwords do not match'; } else { if (strlen($password) < 5) { $errors[] = 'Password must be at least 5 characters.'; } else { $member = registerUser($username, $password); if ($member) { $_SESSION['member_id'] = $member['member_id']; redirect('members.php'); } else { $errors[] = 'This username already exists'; } } } } ?> <?php require_once 'head.php'; ?>
<?php include 'db.php'; error_reporting(E_ALL); ini_set('display_errors', 1); $type = $_POST['type']; $data = $_POST['data']; if ($type == "loadStates") { loadStates($data); } if ($type == "loadCounties") { loadCounties($data); } if ($type == "registerUser") { registerUser($data); } if ($type == "login") { login($data); } if ($type == "loadOrganization") { loadOrganization(); } if ($type == "saveCoachOrganization") { saveCoachOrganization($data); } if ($type == "loadCoachOrganization") { loadCoachOrganization($data); } if ($type == "saveChallenge") { saveChallenge($data); }
<?php include_once 'procedures.php'; if (isset($_POST['submitReg'])) { $reason = registerUser($_POST['login'], $_POST['password']); echo '<meta http-equiv="refresh" content="0; url=redirectIndex.php?reason=' . $reason . '">'; exit; } ?> <?php include "top.php"; ?> <div class = "container content"> <div class="titleName">Регистрация</div> <form class="form-signin" role="form" method="POST"> <input type="login" class="form-control" name="login" placeholder="Login"> <input class="form-control" type="password" name="password" required="" placeholder="Password"></input> <br> <button type="submit" class="btn btn-lg btn-primary btn-block" name="submitReg">Зарегистрироваться</button> </form> </div> <?php include "bottom.php";
<?php require_once "functions.php"; if ($isLoggedIn) { header("Location:index.php"); exit; } $submitted = isset($_POST['registerUser']) ? true : false; $fullName = $submitted ? $_POST['fullName'] : NULL; $username = $submitted ? validatedInput($_POST['username']) : NULL; $password = $submitted ? $_POST['password'] : NULL; $email = $submitted ? $_POST['email'] : NULL; $responseMsg = NULL; if ($submitted) { $registered = registerUser($fullName, $username, $password, $email); if ($registered['success']) { header("Location:login.php"); } else { $responseMsg = $registered['response'] . "<br><br>"; } } ?> <!DOCTYPE html> <html lang="en-US"> <head> <title>Register</title> <meta charset="utf-8" /> <link rel="stylesheet" href="css/main.css" type="text/css" /> <!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
if (empty($user["stripe_cust_id"])) { // create a new customer $stripe_cust_id = createStripeCustomer($token, $user); $user["stripe_cust_id"] = $stripe_cust_id; } else { // update a customer's source $cu = \Stripe\Customer::retrieve($user["stripe_cust_id"]); $cu->source = $token; $cu->save(); } $_SESSION["new-card"] = true; } if ($_POST["action"] == "modify") { $registrants = $_POST["registrants"]; $price_in_cents = $unit_price * $registrants * 100; $modify = registerUser($event["event_id"], $user["user_id"], $registrants, $stripe_charge_id, true); $_SESSION["modified"] = $registrants; } // // if a charge exists refund it if ($paid) { $refund = \Stripe\Refund::create(array("charge" => $stripe_charge_id)); $_SESSION["refund"] = $refund["amount"] / 100; } // if a charge existed before the refund, or if a new card was just accepted, or if an existing card is to be charged, create a new charge if ($paid || $_POST["action"] == "new-card" || $_POST["action"] == "cc-on-file") { createEventCharge($user, $event, $price_in_cents, $registrants); $_SESSION["payment"] = $price_in_cents / 100; $_SESSION["registrants"] = $registrants; } }
// Connecter utilisateur if (isset($_POST['login-submit'])) { $userid = checkUser($_POST['email'], $_POST['password']); if ($userid == false) { $errorLogin = 1; } else { if ($userid) { setLogged($_POST['email']); $errorLogin = 0; } else { $errorLogin = 2; } } } if (isset($_POST['register-submit'])) { $errorRegister = registerUser($_POST['email'], $_POST['password'], $_POST['username'], 'http://findicons.com/files/icons/1072/face_avatars/300/a02.png'); } ?> <!DOCTYPE html> <html lang="fr"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>PublicInsta</title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> <!--<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Pacifico' type='text/css'>-->> <link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Indie+Flower' type='text/css'>
function displayPassChange($useAdmin, $addUser) { $error = ''; $adminLvl = 75; if (isset($_POST['submitBtn'])) { // Get user input $username = isset($_POST['username']) ? $_POST['username'] : ''; $password1 = isset($_POST['password1']) ? $_POST['password1'] : ''; $password2 = isset($_POST['password2']) ? $_POST['password2'] : ''; $admin = isset($_POST['admin']) ? $_POST['admin'] : ''; if (!$addUser) { $error .= resetPass($username, $password1, $password2, $admin); } else { $error .= registerUser($username, $password1, $password2, $admin); } } if (!isset($_POST['submitBtn']) || $error != '') { if (!$addUser) { echo '<h3>Change Password or Admin Level</h3>'; } else { echo '<div class="caption">Add User</div>'; } ?> <div id="icon"> </div> <div id="results"></div> <form action="<?php echo $_SERVER['REQUEST_URI']; ?> " method="post" name="registerform"> <table width="100%"><a href="<?php echo $_SERVER['PHP_SELF']; ?> ">Back</a><br /><br /><?php if ($useAdmin && $addUser) { ?> <tr><td>Username:</td><td> <input class="text" name="username" type="text" value="<?php if (!$addUser) { echo $_SESSION['userName']; } ?> " /> <?php } if ($_SESSION['admin'] >= $adminLvl && $useAdmin && !$addUser) { echo '<tr><td>Username:</td><td><SELECT name="username">'; showAllUsers(); echo ' </SELECT>'; } if (!$useAdmin && !$addUser) { ?> <input name="username" type="hidden" value="<?php echo $_SESSION['userName']; ?> " /> <input name="admin" type="hidden" value="<?php echo $_SESSION['admin']; ?> " /> <tr><td>Username:</td><td><?php echo $_SESSION['userName']; ?> <?php } ?> </td></tr> <tr><td>Password:</td><td> <input class="text" name="password1" type="password" /></td></tr> <tr><td>Confirm password:</td><td> <input class="text" name="password2" type="password" /></td></tr><?php if ($_SESSION['admin'] >= $adminLvl && $useAdmin) { ?> <tr><td>Admin Level:</td><td> <?php showAdminLvls(); ?> </td></tr> <?php } ?> <tr><td colspan="2" align="center"> <input class="text" type="submit" name="submitBtn" value="<?php if (!$addUser) { echo "Change Password"; } else { echo "Add User"; } ?> " /> </td></tr> </table> </form> <?php } if (isset($_POST['submitBtn'])) { ?> <div class="caption">Result:</div> <div id="icon2"> </div> <div id="result"> <table width="100%"><tr><td><br/> <?php if (empty($error) && !$addUser) { echo " Password was successfully changed!<br/><br/>"; //history('Changed Password'); } else { if ($empty($error) && $useAdmin && $addUser) { echo "User Added!!!<br/><br/>"; ?> <a href="<?php echo $_SERVER['REQUEST_URI']; ?> ">Add Another User</a><br /><?php //history('Changed Password'); echo ' <a href="/">Home</a>'; } else { echo $error; } } ?> <br/><br/><br/></td></tr></table> </div> <?php } }
$name = stripslashes(trim($_POST['name'])); $school = stripslashes(trim($_POST['school'])); $picture = stripslashes(trim($_POST['picture'])); $password = stripslashes(trim($_POST['password'])); $description = stripslashes(trim($_POST['description'])); require_once 'functions.php'; // Validate inputed fields validateNewUser($username, $name, $school, $password); // Set default icon if ($picture == "") { $picture = 'pictures/icon_default.png'; } require_once 'connect.php'; require_once 'passwordLib.php'; // Encrypt the password $hash = password_hash($password, PASSWORD_BCRYPT); // Create connection global $conn; $result = checkUniqueUsername($conn, $username); if ($result == 0) { // Unique user // Register the user registerUser($conn, $username, $name, $school, $picture, $hash, $description); $response = ["success" => "User registered"]; echo json_encode($response); } else { $response = ["Error" => "Username taken"]; echo json_encode($response); } $conn->close(); die;
function checkCode($code, $smscode = null) { $sql = "select id, name, cell_phone_nr, email from user_registration where status = 1 and code_email = '{$code}'"; if ($smscode) { $sql .= " and code_cell_phone = '{$smscode}'"; } $result = query($sql); if ($row = pg_fetch_row($result)) { if ($smscode) { registerUser($row, $smscode); } return TRUE; } return FALSE; }
$cmd = $_REQUEST['cmd']; switch ($cmd) { case 1: signIn(); break; case 2: getUserDetails(); break; case 3: getProducts(); break; case 4: getProductById(); break; case 5: registerUser(); break; case 6: addProduct(); break; case 7: addSale(); break; case 8: signOut(); break; default: echo '{"result":0, message:"unknown command"}'; break; } //shopkeeper sign in
function clear_database() { $folds = array_diff(scandir("database/users"), array('.', '..')); foreach ($folds as $item) { rmdir_and_contents("database/users/{$item}"); } $tasks = array_diff(scandir("database/done"), array('.', '..')); foreach ($tasks as $item) { unlink("database/done/{$item}"); } $tasks = array_diff(scandir("database/wip"), array('.', '..')); foreach ($tasks as $item) { unlink("database/wip/{$item}"); } $tasks = array_diff(scandir("database/dead"), array('.', '..')); foreach ($tasks as $item) { unlink("database/dead/{$item}"); } $tasks = array_diff(scandir("database/todo"), array('.', '..')); foreach ($tasks as $item) { unlink("database/todo/{$item}"); } unlink("database/email"); unlink("database/passwd"); touch("database/email"); touch("database/passwd"); unlink("database/config"); $file = fopen("database/config", "w"); fprintf($file, "1\n"); fclose($file); registerUser("root", "root@admin", "azertyuiop", "@68s?qed"); }
<?php session_start(); include_once '../validation/validateRegisterForm.php'; include_once '../connection/connection.php'; //include_once '../mail/mail.php'; if (isset($_POST['register'])) { if (ValidateRegisterForm($_POST)) { $conn = connect(); if ($conn->connect_error) { die("Connection failed:" . $conn->connect_error); } else { registerUser($_POST); } } else { //redirect to same page } } ?> <html> <head> <title> Sign Up Form </title> <link rel="stylesheet" type="text/css" href="../css/style.css"> <link rel="stylesheet" href="../css/bootstrap.min.css"> <script src="http://code.jquery.com/jquery-1.11.2.min.js"></script> <script src="../validation/clientvalidation.js"></script> </head> <body> <div class=upperHeader> SIGN UP </div> <form method='post' action="">
unset($_POST['user']); global $USER; global $APPLICATION; $USER->Authorize($ID); LocalRedirect($APPLICATION->GetCurPageParam('', array('user[name]', 'user[email]', 'ELEMENT_CODE', 'code'))); } else { $errors[] = $user->LAST_ERROR; } } return $errors; } $userInfo = null; $eventSent = $forgetError = false; if (isset($_POST['user'])) { $userInfo = $_POST['user']; $errors = registerUser($_POST['user']); } elseif (isset($_GET['user'])) { $userInfo = $_GET['user']; } elseif (isset($_POST['forget'])) { if (!$_POST['forget']['email']) { $forgetError = 'Неверно указан почтовый адрес'; } else { $user = CUser::GetList($by = "id", $order = "desc", array('EMAIL' => $_POST['forget']['email'], 'ACTIVE' => 'Y'))->Fetch(); if (!$user) { $forgetError = 'Неверно указан почтовый адрес'; } else { $objUser = new CUser(); $password = make_password(8); $objUser->Update($user['ID'], array('PASSWORD' => $password, 'CONFIRM_PASSWORD' => $password)); $eventFields = array('NAME' => $user['NAME'], 'PASSWORD' => $password, 'EMAIL' => $user['EMAIL']); $eventSent = CEvent::Send('FORGET_PASS', 's1', $eventFields);
<?php include "db.php"; if (isset($_POST['submit'])) { $username = $_POST['username-reg']; $password = $_POST['password-reg']; $rptPassword = $_POST['password-repeat-reg']; $email = $_POST['email-reg']; $date = new DateTime(); $date = $date->format('y-m-d'); if (passwordsMatch($password, $rptPassword) && registerUser($username, $password, $email, $date)) { session_start(); $_SESSION['username'] = $username; header("Location: ../home.php"); } } function passwordsMatch($pass, $rptPass) { return $pass == $rptPass; }