Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in C:\xampp\htdocs\register.php:20 Stack trace: #0 {main} thrown in C:\xampp\htdocs\register.php on line 20
- <?php
- if(isset($_SESSION['id'])) {
- header("Location: index.php");
- }
- if(isset($_POST['register'])) {
- include_once("db.php");
- $username = strip_tags($_POST['username']);
- $password = strip_tags($_POST['password']);
- $password_confirm = strip_tags($_POST['password']);
- $email = strip_tags($_POST['email']);
- $username = stripslashes($username);
- $password = stripslashes($password);
- $password_confirm = stripslashes($password_confirm);
- $email = stripslashes($email);
- $username = mysql_real_escape_string($db, $username);
- $password = mysql_real_escape_string($db, $password);
- $password_confirm = mysql_real_escape_string($db, $password_confirm);
- $email = mysql_real_escape_string($db, $email);
- $password = md5($password);
- $password_confirm = md5($password);
- $sql_store = "ISNERT into users (username, password, email) VALUES ('$username', '$password', '$email')";
- $sql_fetch_username = "SELECT username FROM users WHERE username = '$username'";
- $sql_fetch_email = "SELECT email FROM users WHERE email = '$email'";
- $query_username = mqsqli_query($db, $sql_fetch_username);
- $query_email = mysqli_query($db, $sql_fetch_email);
- if(mysqli_num_rows($query_username)) {
- echo "This username is already taken";
- return;
- }
- if($username = "") {
- echo "Please insert a username";
- return;
- }
- if($password == "" || $password_confirm == "") {
- echo "Please insert your password";
- return;
- }
- mysql_query($db, $sql_store);
- header("Location: index.php");
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Register Page</title>
- </head>
- <body>
- <form action="register.php" method="post" enctype="multipart/form-data">
- <input placeholder="Username" name="username" type="text">
- <input placeholder="Password" name="password" type="password">
- <input placeholder="Confirm Password" name="password_confirm" type="password">
- <input placeholder="E-Mail Address" name="email" type="text">
- <input name="register" type="submit" type="Register">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement