-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchecksignup.php
More file actions
28 lines (23 loc) · 983 Bytes
/
checksignup.php
File metadata and controls
28 lines (23 loc) · 983 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
<?php
include('connection.php');
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Collect and sanitize input data
$email = mysqli_real_escape_string($condb, $_POST['email']);
$username = mysqli_real_escape_string($condb, $_POST['username']);
$ic = mysqli_real_escape_string($condb, $_POST['ic']);
$phone = mysqli_real_escape_string($condb, $_POST['phone']);
$pass = mysqli_real_escape_string($condb, $_POST['pass']);
// Insert data into the database
$sql = "INSERT INTO users (userName, userEmail, userPhone, userIC, userPass) VALUES ('$username', '$email', '$phone', '$ic', '$pass')";
if (mysqli_query($condb, $sql)) {
echo "New user registered successfully";
// Redirect to a login page or another page if needed
header("Location: loginpage.php");
exit();
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($condb);
}
}
// Close the database connection
mysqli_close($condb);
?>