-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformatInMe.js
More file actions
35 lines (22 loc) · 823 Bytes
/
Copy pathformatInMe.js
File metadata and controls
35 lines (22 loc) · 823 Bytes
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
/*<? php
echo '<script>alert("Welcome to Geeks for Geeks")</script>';
if ($_POST) {
require_once("userChecker.php");
$user = $_POST;
$user["password"] = password_hash($user['password'], PASSWORD_DEFAULT, ["cost"=> 14]); //hardbracets bc it's not an array
// Get existing users from file
$users = json_decode(file_get_contents("../DB/users.json"));
// Check if email is already registerd
if (!doesUserExist($user, $users)) {
$user[] = $user; // pushes new user into userlist
file_put_contents("../DB/users.json", json_encode($users, JSON_PRETTY_PRINT));
header("login.php?mes=registerd"); //redirects you to the main site
}
else {
echo('alert("Login failed, user already exists!");');
}
}
/* TODO:
if (logged){
require_once myCode.html
}