login
This commit is contained in:
56
interfaceServices/registrationCreation_NOT_USED.php
Normal file
56
interfaceServices/registrationCreation_NOT_USED.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
$firstName = $_POST["firstName"];
|
||||
$lastName = $_POST["lastName"];
|
||||
$email = $_POST["email"];
|
||||
$userName = $_POST["userName"];
|
||||
$password = $_POST["password"];
|
||||
|
||||
$newUser = $_POST["newUser"];
|
||||
|
||||
$returnData = array();
|
||||
$date = new DateTime();
|
||||
$id = $date->getTimestamp() . $userName;
|
||||
|
||||
$passwordSalt = "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824";
|
||||
|
||||
$hashedPassword = crypt( $password, $passwordSalt );
|
||||
$hashedId = crypt( $id, $passwordSalt );
|
||||
|
||||
/*
|
||||
For login:
|
||||
if (hash_equals($hashed_password, crypt($user_input, $hashed_password))) {
|
||||
echo "Password verified!";
|
||||
}
|
||||
*/
|
||||
|
||||
$returnData["password"] = $hashedPassword;
|
||||
$returnData["id"] = $hashedId;
|
||||
|
||||
//echo( json_encode( $returnData ) );
|
||||
|
||||
$url = 'http://192.241.155.78/api.php/users/';
|
||||
$fields = array(
|
||||
'firstName' => urlencode( $firstName ),
|
||||
'lastName' => urlencode( $lastName ),
|
||||
'email' => urlencode( $email ),
|
||||
'userName' => urlencode( $userName ),
|
||||
'password' => urlencode( $hashedPassword ),
|
||||
'userId' => urlencode( $hashedId ),
|
||||
'id' => urlencode( $newUser )
|
||||
);
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch,CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch,CURLOPT_POSTFIELDS, json_encode($fields));
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
$result = curl_exec( $ch );
|
||||
|
||||
curl_close( $ch );
|
||||
|
||||
echo( $result );
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user