-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsignup.php
42 lines (34 loc) · 951 Bytes
/
signup.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
<?php
include 'source/config.php';
error_reporting(0);
session_start();
if (isset($_POST['submit'])) {
$username = $_POST['username'];
$email = $_POST['email'];
$password = md5($_POST['password']);
$sql = "SELECT * FROM users WHERE email='$email'";
$result = mysqli_query($conn, $sql);
if (!$result->num_rows > 0) {
$sql = "INSERT INTO users (username, email, password)
VALUES ('$username', '$email', '$password')";
$result = mysqli_query($conn, $sql);
if ($result) {
$username = "";
$email = "";
$_POST['password'] = "";
echo '<script>alert("Wow! User Registration Completed.")
window.location.href = "sign.php";
</script>';
}
else {
echo '<script>alert("Woops! Something Went Wrong.")
window.location.href = "sign.php";
</script>';
}
} else {
echo '<script>alert("Woops! Email Already Exists.")
window.location.href = "sign.php";
</script>';
}
}
?>