-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanual-add.php
66 lines (54 loc) · 1.3 KB
/
manual-add.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
64
65
66
<?php
session_start();
include 'database/connect.php';
include 'functions.php';
include 'langCheck.php';
protectAdmin();
$username = $_POST['username'];
$email = $_POST['email'];
$password = encrypt($_POST['password']);
if(empty($username)){
echo $lang['usernameEmpty'];
exit();
}
if(empty($email)){
echo $lang['emailEmpty'];
exit();
}
if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
echo $lang['emailInvalid'];
exit();
}
if(empty($password)){
echo $lang['emptyPassword'];
exit();
}
$query = $con->prepare("SELECT * FROM users WHERE username = ?");
$query->bind_param("s", $username);
$query->execute();
$query->store_result();
$nm = $query->num_rows;
$query->close();
if($nm > 0){
echo $lang['userExists'];
exit();
}
$query = $con->prepare("SELECT * FROM users WHERE email = ?");
$query->bind_param("s", $email);
$query->execute();
$query->store_result();
$nm1 = $query->num_rows;
$query->close();
if($nm1 > 0){
echo $lang['mailExists'];
exit();
}
$date = date('Y-m-d');
$query = $con->prepare("INSERT INTO users (username, password, email, active, joined) VALUES (?, ?, ?, '1', ?)");
$query->bind_param("ssss", $username, $password, $email, $date);
$query->execute();
$query->close();
echo $query->error;
echo $con->error;
echo $lang['addedUser'];
?>