run code in 150+ php & hhvm versions
Bugs & Features
<?php include 'connect.php'; if ($_POST['register']) { //get form data $username = addslashes(strip_tags($_POST['username'])); $password = addslashes(strip_tags($_POST['password'])); $email = addslashes(strip_tags($_POST['email'])); $firstname = addslashes(strip_tags($_POST['firstname'])); $lastname = addslashes(strip_tags($_POST['lastname'])); if (!$username||!$password||!$email||!$firstname||!$lastname){ echo "Please fill out all fields"; } else { //encrypt password $password = md5($password); //check if username already taken $check = mysql_query("SELECT * FROM `user` WHERE username='$username'"); } if (mysql_num_rows($check)>=1){ echo "Username already taken"; } else { //register into database $register = mysql_query("INSERT INTO `user` VALUES (`id`,'$username','$password','$firstname','$lastname','$email','0')"); $register; header("Location:register_success.php") } } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="styles/style.css"/> <title>Register</title> </head> <body> <h1>Register here &#10095;</h1> <form class="login-form" action='register.php' method='POST'> <input type='text' name='username' class='login-username' required='true' placeholder='Username'><p /> <input type='password' name='password' class='login-password' required='true' placeholder='Password'><p /> <input type='text' name='firstname' class='login-username' required='true' placeholder='First name'><p /> <input type='text' name='lastname' class='login-username' required='true' placeholder='Last name'><p /> <input type='email' name='email' class='login-username' required='true' placeholder='Email'><p /> <input type='submit' name='register' value='Register' required='true' class='login-submit'> </form> <div class="underlay-photo"></div> <div class="underlay-black"></div> </body> </html>
Output for 5.3.0 - 5.6.21, 7.0.0 - 7.1.0RC4
Parse error: syntax error, unexpected '}' in /in/YU7gb on line 33
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Fatal error: syntax error, unexpected '}' in /in/YU7gb on line 33
Process exited with code 255.