-
Notifications
You must be signed in to change notification settings - Fork 0
/
sign-up.php
63 lines (53 loc) · 1.52 KB
/
sign-up.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/*
* GNU GENERAL PUBLIC LICENSE
* Version 3, 29 June 2007
*
* Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
* https://www.gnu.org/licenses/gpl-3.0.txt
*/
/*
* By Paulo Roberto Júnior
*/
/* Required for loggin session */
session_start();
/* set header */
header("Content-Type: application/json; charset=utf-8");
/* include files */
require_once('./php/handler-sql.php');
#require_once('../location.php');
/* variables */
$response = array();
/*
* requisição incorreta
*/
if ( !isset($_POST["nick"]) || !isset($_POST["pass"]) || !isset($_POST["apelido"]) || !isset($_POST["description"]) || !isset($_POST["token"]) || !isset($_POST["img"]) || !isset($_POST["color"]) ) {
$response["response"] = "incorrect request nickname or password not entered.";
echo json_encode($response);
exit;
}
/*
* validation to prevent
* injection attacks
*/
$nick = addslashes($_POST["nick"]);
$pass = addslashes($_POST["pass"]);
$apelido = addslashes($_POST["apelido"]);
$description = addslashes($_POST["description"]);
$token = addslashes($_POST["token"]);
$img = addslashes($_POST["img"]);
$color = addslashes($_POST["color"]);
echo json_encode($response);
/*
$account = HandlerSQL::createUser($nick, $apelido, $description, $pass, $token, $color, $img);
if ($account) {
$response["response"] = "ok";
} else {
$response["response"] = "no";
}
sleep( 1.5 );
echo json_encode($response);
*/
?>