ok
Direktori : /home/importfo/www/importfolio.in/ |
Current File : /home/importfo/www/importfolio.in/add_user.php |
<?php // Database connection $conn = new mysqli('localhost', 'importfo_port', 'TEiETvqHxf9h', 'importfo_port'); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // Check if form is submitted if ($_SERVER['REQUEST_METHOD'] == 'POST') { $name = $_POST['name']; $email = $_POST['email']; $password = $_POST['password']; // Hash the password using MD5 (consider using password_hash() for better security) $hashed_password = md5($password); // Prepare SQL statement to insert user $sql = "INSERT INTO user (name, email, password) VALUES (?, ?, ?)"; $stmt = $conn->prepare($sql); // Check if the statement was prepared successfully if ($stmt === false) { die("Error in query: " . $conn->error); } // Bind parameters to the statement $stmt->bind_param('sss', $name, $email, $hashed_password); // Execute the query if ($stmt->execute()) { echo "User added successfully!"; } else { echo "Error: " . $stmt->error; } // Close the statement and connection $stmt->close(); $conn->close(); } ?>