prepare($email_check_query); $stmt->bind_param("s", $email); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows > 0) { $errors[] = "This email already exists. Please try another one."; } // Check for unique phone number $number_check_query = "SELECT * FROM users WHERE number = ? LIMIT 1"; $stmt = $connection->prepare($number_check_query); $stmt->bind_param("s", $number); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows > 0) { $errors[] = "This phone number already exists. Please try another one."; } // Hash the password securely $hashed_password = password_hash($password, PASSWORD_DEFAULT); // Generate a random user ID function generateUserID() { return rand(1000000000, 9999999999); // Generate a random 10-digit user ID } $user_id = generateUserID(); if (empty($errors)) { $query = "INSERT INTO users (user_id, username, email, number, gender, password, address, avatar_image, device_ip, block, device_version) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; $stmt = $connection->prepare($query); $stmt->bind_param("isssssssssi", $user_id, $username, $email, $number, $gender, $hashed_password, $address, $avatar, $device_ip, $block, $device_version); if ($stmt->execute()) { echo ""; exit; } else { $errors[] = "Database Error: " . $stmt->error; } } if (!empty($errors)) { foreach ($errors as $error) { echo ""; } } } $connection->close(); ?> Sign Up for Lexo ᴾᴷ | Join the Delicious Food Experience!

Start for free

Create Your Lexo Account

Sign up today and unlock special offers on delicious meals delivered straight to your door!

I hope you won't have any issues signing up.

Profile

Rizwan Ali

MERN Full Stack Web Developer