ccc
This commit is contained in:
67
registrationCreation.php
Normal file
67
registrationCreation.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
//error_reporting(E_ALL);
|
||||
//ini_set('display_errors', 1);
|
||||
|
||||
$firstName = $_POST["firstName"];
|
||||
$lastName = $_POST["lastName"];
|
||||
$email = $_POST["email"];
|
||||
$userName = $_POST["userName"];
|
||||
$password = $_POST["password"];
|
||||
|
||||
$returnData = array();
|
||||
$date = new DateTime();
|
||||
$id = $date->getTimestamp() . $userName . $date->getTimestamp();
|
||||
|
||||
$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 ),
|
||||
'id' => urlencode( $hashedId )
|
||||
);
|
||||
|
||||
//url-ify the data for the POST
|
||||
//foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
|
||||
//rtrim($fields_string, '&');
|
||||
|
||||
//open connection
|
||||
$ch = curl_init( $url );
|
||||
|
||||
//set the url, number of POST vars, POST data
|
||||
//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, true);
|
||||
|
||||
//execute post
|
||||
$result = curl_exec( $ch );
|
||||
//close connection
|
||||
curl_close( $ch );
|
||||
|
||||
echo( $result );
|
||||
exit();
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user