Beispiel #1
0
    define('DB_USER', 'root');
    define('DB_PASSWORD', '');
    session_start();
    $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
    if ($mysqli->connect_errno > 0) {
        die('Unable to connect to database [' . $mysqli->connect_error . ']');
    }
    if (isset($_POST['user']) && isset($_POST['pass']) && isset($_POST['fname']) && isset($_POST['lname']) && isset($_POST['email'])) {
        $user = $_POST['user'];
        $pass = $_POST['pass'];
        $fname = $_POST['fname'];
        $lname = $_POST['lname'];
        $email = $_POST['email'];
        $password_hash = password_hash($pass, PASSWORD_DEFAULT);
        $sql = "INSERT INTO `username`(`userName`, `First_Name`, `Last_Name`, `pass`, `email`) VALUES ('{$user}','{$fname}','{$lname}','{$pass}', '{$email}')";
        //$sql = "INSERT INTO `username`( `userName`, `pass`) VALUES ('$user',$pass)";
        //$sql = "INSERT INTO 'username' ('UserNameID', 'userName', 'pass') VALUES (NULL, '$user', '$pass')";
        //$result = mysql_query($query);
        if ($mysqli->query($sql)) {
            echo "Registration Succeed";
        } else {
            echo "<p>MySQL error no {$mysqli->errno} : {$mysqli->error}</p>";
            exit;
        }
    } else {
        echo "something is wrong, try again";
    }
}
if (isset($_POST['submit'])) {
    Registration();
}
Beispiel #2
0
<?php

include 'dbconnection.php';
include 'usefunction.php';
if ($_POST) {
    $mail = $_REQUEST['email1'];
    $pass = $_REQUEST['pass1'];
    $gender = $_REQUEST['gender1'];
    $usertype = $_REQUEST['usertype1'];
    $test = new connection();
    //testing($test);
    //die();
    Registration($mail, $pass, $gender, $usertype);
    //print_r($_REQUEST);
}
Beispiel #3
0
     }
     $res = CheckLogin($req->data);
     if ($res === false) {
         SendDataAndDie(666, "");
     }
     SendDataAndDie(200, $res);
 } else {
     if ($cmd == "registration") {
         if (!isset($req->data->login) || !isset($req->data->password) || !isset($req->data->soctype)) {
             SendDataAndDie(4, "");
         }
         $res = CheckLogin($req->data->login);
         if ($res === 1) {
             SendDataAndDie(666, "");
         }
         $res = Registration($req->data->login, $req->data->password, $req->data->soctype);
         if ($res === false) {
             SendDataAndDie(666, "");
         }
         SendDataAndDie(200, "");
     } else {
         if ($cmd == "getsoctypes") {
             $res = GetSocTypes();
             if ($res === false) {
                 SendDataAndDie(666, "");
             }
             SendDataAndDie(200, $res);
         } else {
             if ($cmd == "getfriends") {
                 if (!isset($req->phpsesid)) {
                     SendDataAndDie(301, "");