Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'DB_info.php';
- require_once 'UTILS.php';
- $servername = "localhost";
- $Username = "username";
- $Password = "password";
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT username FROM $users WHERE username='$username'";
- $result = $conn->query($sql);
- checkErrorReturn
- ($result->num_rows > 0,
- "There is already an account associated with this username",
- "Back to registration page",
- "register.php");
- $sql = "INSERT INTO $users
- VALUES ('$username', '$firstName', '$lastName', '$email', '$password')";
- checkErrorReturn
- (! $conn->query($sql),
- $sql . "<br>" . $conn->error,
- "Back to registration page",
- "register.php");
- $conn->close();
- echo "<h1> Welcome $username! You were successfully
- registered! </h1>";
- echo '<h1> <a href="login.html"> Go to the login page </a> </h1>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement