D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
markniuj
/
bazmeasar.com
/
admin
/
Filename :
user.php
back
Copy
<?php include "../config.php"; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Sign Up</title> <style> body { font-family: Arial, sans-serif; background-color: #f4f4f4; margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; } form { max-width: 450px; background-color: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } label { display: block; margin-bottom: 8px; } input { width: 100%; padding: 10px; margin-bottom: 16px; box-sizing: border-box; } input[type="submit"] { background-color: #4caf50; color: #fff; cursor: pointer; } input[type="submit"]:hover { background-color: #45a049; } a { color: #1e88e5; } </style> </head> <body> <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>"> <h2 style="text-align: center;">Sign Up</h2> <?php // Check if the form is submitted if ($_SERVER["REQUEST_METHOD"] == "POST") { // Get form data $username = $_POST["username"]; $email = $_POST["email"]; $password = password_hash($_POST["password"], PASSWORD_DEFAULT); $fullName = $_POST["full_name"]; // Insert data into the users table $sql = "INSERT INTO users (username, email, password, full_name) VALUES ('$username', '$email', '$password', '$fullName')"; if ($conn->query($sql) === TRUE) { echo '<p style="color: green; text-align: center;">Registration successful. <a href="login.php">Login here</a>.</p>'; } else { echo '<p style="color: red; text-align: center;">Error: ' . $conn->error . '</p>'; } // Close the database connection $conn->close(); } ?> <label for="username">Username:</label> <input type="text" name="username" required> <label for="email">Email:</label> <input type="email" name="email" required> <label for="password">Password:</label> <input type="password" name="password" required> <label for="full_name">Full Name:</label> <input type="text" name="full_name"> <input type="submit" value="Sign Up"> </form> </body> </html>