Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Processing Request</title>
- <link rel="Stylesheet" href="style.css" type="text/css" />
- </head>
- <body>
- <h1>Account Creation</h1>
- <h3>
- <?php
- $dbhost = "localhost";
- $username = "root";
- $password = "";
- $connect = mysqli_connect("$dbhost", "$username", "$password");
- $db = "accounts";
- if (!$connect){
- die("ERROR: Database connection failed: " . mysqli_connect_error());
- }
- mysqli_select_db($connect, $db);
- $makeUser = $_POST["makeUser"];
- $makePass = $_POST["makePass"];
- $sql = "INSERT INTO accounts (username, password) VALUES ('$makeUser', '$makePass')";
- if("SELECT username FROM accounts WHERE username = '$makeUser'"){
- header("Location: createaccount.php?status=userTaken");
- }
- else{
- mysqli_query($connect, $sql);
- echo "Account creation was succesful!";
- }
- mysqli_close($connect);
- ?>
- Click <a href="index.php">here</a> to login.
- </h3>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement