示例#1
0
 public function testCreateUserWithShortPassword()
 {
     // If password is shorter than 6 chars, the user should not be created
     $username = '******';
     $password = '******';
     $this->db->expects($this->never())->method('insert');
     NewUser($this->db, $username, $password);
 }
示例#2
0
function SignUp()
{
    if (!empty($_POST['user'])) {
        $query = mysql_query("SELECT * FROM kayttaja WHERE kayttajanimi = '{$_POST['user']}' AND salasana = '{$_POST['pass']}'") or die(mysql_error());
        if (!($row = mysql_fetch_array($query)) or die(mysql_error())) {
            NewUser();
        } else {
            echo "Talla nimella on jo rekisteroity.";
        }
    }
}
示例#3
0
function SignUp($conn)
{
    if (!empty($_POST['signupusername'])) {
        $query = mysqli_query($conn, "SELECT * FROM users WHERE username = '******'signupusername']}' AND password = '******'signuppassword']}'") or die(mysqli_error($conn));
        if (!($row = mysqli_fetch_array($query)) or die(mysqli_error($conn))) {
            NewUser($conn);
        } else {
            echo "SORRY...YOU ARE ALREADY REGISTERED USER...";
        }
    }
}
示例#4
0
function SignUp()
{
    if (!empty($_POST['element_1'])) {
        $query = mysql_query("SELECT * FROM bakici WHERE tc_no = '{$_POST['element_1']}'");
        if (!($row = mysql_fetch_array($query)) or die(mysql_error())) {
            NewUser();
        } else {
            echo "zaten kayıtlısınız...";
        }
    }
}
示例#5
0
function SignUp($mysqli)
{
    if (!empty($_POST['username'])) {
        $query = $mysqli->query("SELECT * FROM users WHERE email = '{$_POST['username']}'");
        if (!($row = $query->fetch_array(MYSQLI_BOTH))) {
            NewUser($mysqli);
        } else {
            echo "SORRY...YOU ARE ALREADY REGISTERED USER...";
        }
    }
}
示例#6
0
function SignUp()
{
    $email = $_POST['email'];
    $query = mysql_query("SELECT Email FROM Customers WHERE Email='{$email}';") or die(mysql_error());
    //print '1'.mysqli_fetch_row($query)[0];
    //print '2'.mysqli_fetch_row($query);
    if (strcmp(mysqli_fetch_row($query)[0], $email)) {
        echo "SORRY...YOU ARE ALREADY REGISTERED USER...";
    } else {
        NewUser();
    }
}
function SignUp()
{
    global $err;
    global $userexist;
    global $success;
    if (empty($_POST['username'])) {
        $err = "Name is required";
        return false;
    }
    if (empty($_POST['email'])) {
        $err = "Email is required";
        return false;
    }
    $email = $_POST['email'];
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $err = "Email is invalid";
        return false;
    }
    if (empty($_POST['password'])) {
        $err = "Password is required";
        return false;
    }
    if (empty($_POST['confirmpassword'])) {
        $err = "Confirm password in required";
        return false;
    }
    if ($_POST['password'] != $_POST['confirmpassword']) {
        $err = "Error passwors do nott match";
        return false;
    }
    if ($err == "") {
        $queryexist = "SELECT * FROM users WHERE email = '{$_POST['email']}' ";
        $query = mysql_query($queryexist) or die(mysql_error());
        $row = mysql_fetch_array($query);
        if (!$row) {
            NewUser();
        } else {
            $userexist = "Sorry you are already registered user";
        }
    }
}
function SignUp()
{
    if (empty($_POST['rname']) || empty($_POST['rfname']) || empty($_POST['runame']) || empty($_POST['rpass']) || empty($_POST['rrpass']) || empty($_POST['rnumber']) || empty($_POST['remail'])) {
        die(msg(0, "لطفا ابتدا فرم را تکمیل کرده سپس دکمه ثبت نام را فشار دهید."));
    }
    if (!preg_match("/^[\\.A-z0-9_\\-\\+]+[@][A-z0-9_\\-]+([.][A-z0-9_\\-]+)+[A-z]{1,4}\$/", $_POST['remail'])) {
        die(msg(0, "آدرس ایمیل نامعتبر است."));
    }
    if ($_POST['rpass'] != $_POST['rrpass']) {
        die(msg(0, "لطفا رمز عبور را دوباره وارد کنید."));
    }
    if (!empty($_POST['runame'])) {
        //checking the 'user' name which is from Sign-Up.html, is it empty or have some text
        $query = mysql_query("SELECT * FROM member WHERE userName = '******'runame']}' ") or die(mysql_error());
        if (!($row = mysql_fetch_array($query))) {
            NewUser();
        } else {
            die(msg(0, "این نام کاربری قبلا استفاده شده است."));
        }
    }
}
示例#9
0
function SignUp()
{
    // SQL query to fetch information of registerd users and finds user match.
    $user_email = mysql_real_escape_string($_POST['user_email']);
    echo $user_email;
    echo "<br/>";
    //$query = mysql_query("SELECT * FROM User WHERE email = '$user_email'") or die(mysql_error());
    $query = mysql_query("select * from user where upper(email)=upper('" . $user_email . "')", $connection);
    while ($rows = mysql_fetch_array($result)) {
        echo $rows['email'];
    }
    $row = mysql_fetch_array($query);
    echo "query is ", $query;
    echo "<br/>";
    echo " row is ", $row;
    echo "<br/>";
    if (!$row) {
        echo "Adding a new users<br/>";
        NewUser();
    } else {
        $error_signup = "SORRY...YOU ARE ALREADY A REGISTERED USER...";
    }
}
示例#10
0
<?php

define('DB_HOST', 'localhost');
define('DB_NAME', 'BookStore');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
$con = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die("Failed to connect to MySQL: " . mysql_error());
NewUser($con);
function NewUser($con)
{
    $firstname = $_POST['fname'];
    $lastName = $_POST['lname'];
    $email = $_POST['email'];
    $password = $_POST['passwd'];
    $gender = $_POST['gender'];
    $query = "INSERT INTO websiteusers(FirstName, LastName, Email, Password, Gender) VALUES ( '{$firstname}','{$lastName}','{$email}','{$password}','{$gender}')";
    if (mysqli_query($con, $query)) {
        echo "done";
        header("location: LoginPage.php");
    } else {
        echo "error";
        header("location: Register.php");
    }
}
?>

示例#11
0
foreach ($adUsers as $adUser) {
    // loop over all the Active Directory users
    // skip the excluded usernames
    $skip = 0;
    foreach ($excludedUsers as $ex) {
        if ($ex == $adUser) {
            $skip = 1;
            break;
        }
    }
    if ($skip == 1) {
        continue;
    }
    // query LDAP for the full user info
    $userInfo = $adldap->user_info($adUser, $ldapAttributes);
    if (NewUser($adUser, $oemrUsers)) {
        // add new user
        echo "Adding user {$adUser}";
        if (AddUser($adUser, $userInfo)) {
            echo ", OK\n";
        } else {
            echo ", FAILED\n";
        }
    } else {
        // update existing users with Active Directory info
        echo "existing user {$adUser}";
        if (UpdateUser($adUser, $userInfo)) {
            echo ", OK\n";
        } else {
            echo ", FAILED\n";
        }
function SignUp()
{
    global $con;
    session_start();
    if (!empty($_POST['user'])) {
        $query = mysqli_query($con, "SELECT * FROM UserName WHERE userName = '******'user']}' AND pass = '******'pass']}'");
        if (!($row = mysqli_fetch_array($query))) {
            NewUser();
        } else {
            echo "<script>\n        alert('USER ALREADY EXISTS..TRY AGAIN!');\n        window.location.href='Sign-Up.html';\n        </script>";
        }
    }
}
示例#13
0
function get_recent($params)
{
    global $xmlrpcerruser;
    global $SYSTEM;
    $blogid = $params->getParam(0);
    $username = $params->getParam(1);
    $password = $params->getParam(2);
    $numposts = $params->getParam(3);
    $uid = $username->scalarval();
    $pwd = $password->scalarval();
    $usr = NewUser($uid);
    # Again, let's just skip the permissions check since this information is
    # public anyway.
    user_verify_fingerprint(user_get_fingerprint($username->scalarval(), $password->scalarval()));
    if (user_is_valid($username->scalarval(), $password->scalarval())) {
        $plan_array = array_merge($plan_array, files_list($plan_dir, "plan{$limiter}*.txt{$private}"));
        rsort($plan_array);
        $arr = array();
        for ($i = 0; $i < $numposts->scalarval(); $i++) {
        }
        $arr[] = entry_to_struct($plan_array[$i]);
        $ret = new xmlrpcresp(new xmlrpcval($arr, 'array'));
    } else {
        $ret = new xmlrpcresp(0, $xmlrpcerruser + 3, "Invalid login");
    }
    return $ret;
}
示例#14
0
<?php

//Jozef Nagy
//12/2013
//JSON + REST web service for storing OBD2 data
$json = file_get_contents('php://input');
$array = json_decode($json, true);
$apikey = NewUser($array);
//return JSON array
exit(json_encode($apikey));
function NewUser($array)
{
    //Config script contains setup information. Required.
    include 'config.php';
    $con = mysqli_connect("localhost", $cfg_db, $cfg_db_passwd, $cfg_db_user);
    // Check connection
    if (mysqli_connect_errno()) {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }
    $email = mysql_real_escape_string($array["Email"]);
    $result = mysqli_query($con, "select uid, email, APIKey from users where email = '{$email}'");
    if (mysqli_num_rows($result) == 0) {
        //Generate the API Key
        $key = gen_random_string(16);
        mysqli_query($con, "INSERT INTO users (email, apikey) VALUES ('{$email}', '{$key}')");
    }
    while ($row = mysqli_fetch_array($result)) {
        $key = $row['APIKey'];
    }
    mysqli_close($con);
    return $key;