Exemplo n.º 1
0
function user_info_change($arr)
{
    $row = $arr;
    $num = user_exits($arr['name']);
    $row['name'] = $arr['name'] . "_" . $arr['uid'] . "_zuowen" . "_" . $num;
    $row['mail'] = $row['name'] . "@example.com";
    return $row;
}
Exemplo n.º 2
0
<title>Login | Shoppcart</title>
<?php 
include 'core/init.php';
logged_in_redirect();
?>

<?php 
if (empty($_POST) === false) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    if (empty($username) === true || empty($password) === true) {
        $errors[] = 'You need to enter a Username and Password';
    } elseif (user_exits($username) === false) {
        $errors[] = 'We can\'t find that username. Have you registered?';
    } elseif (user_active($username) === false) {
        $errors[] = 'You haven\'t activated your account!.Please check your Email.';
    } else {
        $login = login($username, $password);
        if ($login === false) {
            $errors[] = 'Username/Password combination is incorrect';
        } else {
            $_SESSION['user_id'] = $login;
            header('Location: /');
            exit;
        }
    }
}
?>


Exemplo n.º 3
0
<title>Register | Shoppcart</title>
 <?php 
include 'core/init.php';
logged_in_redirect();
if (empty($_POST) === false) {
    $required_fields = array('username', 'password', 'password_again', 'first_name', 'address', 'email', 'mobile_number');
    foreach ($_POST as $key => $value) {
        if (empty($value) && in_array($key, $required_fields) === true) {
            $errors[] = 'Fields marked with an * are required';
            break 1;
        }
    }
    if (empty($errors) === true) {
        if (user_exits($_POST['username']) === true) {
            $errors[] = 'Sorry, The username \'' . $_POST['username'] . '\' is already taken.';
        }
        if (preg_match("/\\s/", $_POST['username']) == true) {
            $errors[] = 'Your Username must not contain space.';
        }
        if (strlen($_POST['password']) < 6) {
            $errors[] = 'Your password must be at least 6 characters';
        }
        if ($_POST['password'] != $_POST['password_again']) {
            $errors[] = 'Password do not match.';
        }
        if (email_exits($_POST['email']) === true) {
            $errors[] = 'Sorry, The Email \'' . $_POST['email'] . '\' is already in use.';
        }
        if (mobile_number_exits($_POST['mobile_number']) === true) {
            $errors[] = 'Sorry, The Mobile Number \'' . $_POST['mobile_number'] . '\' is already in use.';
        }