html - Why am I getting a 500 Internal Error with a PHP file? -


i have created user register page, html form. have finished php file submit data mysql database.

i have checked phpmyadmin connected database , working.

as far can see, mysql queries , rest of php code seems fine, getting internal error on page php code. have used include function include php file on html file, , both html register page , php file return following error on chrome:

"the website encountered error while retrieving [web address]. may down maintenance or configured incorrectly."

i should note page doing it, other pages on website work fine, defiantly php file. paste code it's pretty long. i've never gotten plain 500 error php file before, have made similar sign forms , codes before , never had problem.

any appreciated.

code

<?php error_reporting(e_error);  //errors $password_error = "<div class='login-form-error'>your passwords didn't match, careful time!</div>"; $field_error = "<div class='login-form-error'>you cannot leave fields blank or use invalid character.</div>"; $username_error = "<div class='login-form-error'>that username taken, make one.</div>"; $characters_error = "<div class='login-form-error'>your username cannot contain special characters.</div>"; $email_error = "<div class='login-form-error'>your emails didn't match, careful next time!</div>"; $signedup = "<center><h1>welcome club!</h1><span style='font-size: 24px;'>your account ready, <a href='/client/sign-in' style='color: #212121; text-decoration: underline;'>sign in</a> , set profile.</span></center>"; $max_length_error = "<div class='login-form-error'>your first name or username cannot contain more 25 characters.</div><br>"; $max_length_password_error = "<div class='login-form-error'>your password must between 8 , 30 characters long.</div>";  $reg =@$_post['reg']; //declaring variables prevent errors $first_name = ""; $gender = ""; $age = ""; $username = ""; $password = ""; $password2 = ""; $email = ""; $email2 = ""; $date = ""; $u_check = "";  //registration form $first_name =  mysql_real_escape_string(strip_tags(stripslashes(@$_post['first_name']))); $gender =  mysql_real_escape_string(strip_tags(stripslashes(@$_post['gender']))); $age =  mysql_real_escape_string(strip_tags(stripslashes(@$_post['age']))); $username = mysql_real_escape_string(strip_tags(stripslashes(@$_post['username']))); $password = mysql_real_escape_string(strip_tags(stripslashes(@$_post['password']))); $password2 = mysql_real_escape_string(strip_tags(stripslashes(@$_post['password2']))); $email = mysql_real_escape_string(strip_tags(stripslashes(@$_post['email']))); $email2 = mysql_real_escape_string(strip_tags(stripslashes(@$_post['email2']))); $d = date("y-m-d"); // year - month - day  if ($reg) { if ($email==$email2) { //check if user exists $u_check = mysql_query("select `username` `users` `username`='$username'") or die("mysql error: ".mysql_error()); //count amount of rows username = $username $check = mysql_num_rows($u_check); if ($check == 0) { //check of fields have been filled in if ($first_name&&&gender&&age&&$username&&$password&&$password2&&$email&&$email2) { //check passwords match if ($password == $password2) { //check username characters if (!ctype_alnum($username)){   echo $characters_error; } else { //check max length un fn ln if (strlen($username)>25||strlen($first_name)>25) {   echo $max_length_error; } else { //check max length pw if (strlen($password)>30||strlen($password)<8) {   echo $max_length_password_error; } else { //encrypt $password = md5($password); $password2 = md5($password); $query = mysql_query("insert users values ('','$username','$password','$email','$date','$first_name','$age','$gender','','profile_picture_here','banner_picture_here','','variables_next','0','','0','0','0','0','0','0')") or die("mysql error: ".mysql_error()); die($signedup); } } } } else { echo password_error; } } else { echo field_error; } } else { echo username_error; } } else { echo email_error; } } ?> 

you have typo on line 46 wrote '&&&' instead of '&&' should work then.

if ($first_name&&&gender&&age&&$username&&$password&&$password2&&$email&&$email2) { 

should be

if ($first_name&&$gender&&$age&&$username&&$password&&$password2&&$email&&$email2) { 

i think.

greetings joe


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -