-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignup.php
More file actions
29 lines (25 loc) · 698 Bytes
/
Copy pathsignup.php
File metadata and controls
29 lines (25 loc) · 698 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
<?php
session_start();
$count = 0;
include 'dbcon.php';
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
$sql = "SELECT * FROM Profile WHERE UserName = '$username'";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_array($result);
$count = mysqli_num_rows($result);
if ($count == 1) {
header('location: signup.html');
}
else
{
$sql1 = "INSERT INTO Profile (UserName, Mail, Password) values ('$username', '$email', '$password')";
if (mysqli_query($conn, $sql1)) {
echo '<script>alert("Registration Successful.")</script>';
header('location: login.html');
} else {
echo "Error: " . $sql1 . "<br>" . mysqli_error($conn);
}
}
?>