One Hat Cyber Team
Your IP :
216.73.216.186
Server IP :
84.32.84.108
Server :
Linux in-mum-web1837.main-hosting.eu 5.14.0-503.34.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Mar 27 06:00:50 EDT 2025 x86_64
Server Software :
LiteSpeed
PHP Version :
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
u322583024
/
domains
/
awaha.in
/
public_html
/
Edit File:
registersubmission.php
<?php // Include the database connection file include 'admin/connection.inc.php'; // Include this at the very top of your PHP file ob_start(); header('Content-Type: application/json'); // Check if the request is an AJAX request if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Retrieve and sanitize form data $name = mysqli_real_escape_string($conn, $_POST['name']); $email = mysqli_real_escape_string($conn, $_POST['email']); $password = mysqli_real_escape_string($conn, $_POST['password']); // Hash the password $hashed_password = password_hash($password, PASSWORD_BCRYPT); // Set the default role as 'Customer' $role = 'Customer'; // Check if the email already exists $check_email_query = "SELECT * FROM users WHERE email = '$email'"; $email_result = mysqli_query($conn, $check_email_query); if (mysqli_num_rows($email_result) > 0) { // Email already exists echo json_encode(['status' => 'success', 'message' => 'Registration successful']); ob_end_flush(); } else { // Insert the new user into the database $insert_query = "INSERT INTO users (name, email, password, role) VALUES ('$name', '$email', '$hashed_password', '$role')"; if (mysqli_query($conn, $insert_query)) { echo json_encode(['status' => 'success', 'message' => 'Registration successful']); } else { echo json_encode(['status' => 'error', 'message' => 'Failed to register user']); } } } ?>
Simpan