This commit is contained in:
2018-04-29 21:34:47 -04:00
parent 732065c7b5
commit d8d248672b
23 changed files with 5940 additions and 114 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,52 @@
<?php
$user = "ckoch";
$target_dir = "community/uploads/" . $user . "/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Check if image file is a actual image or fake image
//if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
if($check !== false) {
//echo "File is an image - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
//echo "File is not an image.";
$uploadOk = 0;
}
//}
// Check if file already exists
if (file_exists($target_file)) {
//echo "Sorry, file already exists.";
$uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 5000000) {
//echo "Sorry, your file is too large.";
$uploadOk = 0;
}
// Allow certain file formats
//echo("|" . $imageFileType . "|<br />");
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
//echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo( 0 );
//echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
//echo( $target_file );
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
//echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
echo( 1 );
} else {
//echo "Sorry, there was an error uploading your file.";
echo( 0 );
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
<?php
phpinfo();
?>

View 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 );
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,28 @@
<?php
$userName = $_GET("username");
$password = $_GET("password");
$id = $username . $date->getTimestamp();
$returnData = array();
$date = new DateTime();
$passwordSalt = "sexfamemoney$U046qKlL$moneyfamesex";
$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"] = $hashed_password;
$returnData["id"] = $hashedId;
echo( json_encode( $returnData ) );
?>