timmah1 Posted November 3, 2008 Share Posted November 3, 2008 Can somebody help me figure out why I'm getting a 500 Internal Server Error with this? <?php session_start(); if($_POST['register']) { //get informatin to determine age $year = date("Y-m-d"); //gets the current date to check age $dob = $_POST['year']."-".$_POST['month']."-".$_POST['day']; //Puts the Age Verification into an easily read variable $age = $year-$dob; //subtracts current date with birthdate to get age //putting variables into nicely formatterd variables $first = $_POST['first']; $last = $_POST['last']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $email = $_POST['email']; $email2 = $_POST['email2']; $user = $_POST['user']; $pass = $_POST['pass']; $pass2 = $_POST['pass2']; $ip=$_SERVER['REMOTE_ADDR']; //checks if the person is 18 or older, if not, it shows them an error if($age > 18) { header("Location". $config_basedir . "register.php?error=1"); } //checks if the passwords match if($pass == $pass2) { if($email == $email2) { //check to see if the username is available $checksql = "SELECT * FROM users WHERE user = '$user' ;"; $checkresult = mysql_query($checksql); $checknumrows = mysql_num_rows($checkresult); //if email is used, show the erro if($checknumrows == 1){ header("Location: " . $config_basedir . "/register.php?error=0"); } //now insert everything in to the database $sql = "INSERT INTO users(date, ip, first, last, city, state, zip, email, user, pass) VALUES( NOW(), '$ip', '$first', '$last', '$city', '$state', '$zip', '$email', '$user', '$pass');"; mysql_query($sql) or die("Sorry, there was a problem creating your account ".mysql_error()); //now mail the user the informatin to verify their account. $subject = "Carolina Registration"; $message = " Hi $first $last, Thank you for registering for Carolina. Below is your login information Username: $user Password: $pass =================================== NOTE: If you believe you received this notification in error, please send an email to [email protected] ------------------------- ©2008 Carolina . All Rights Reserved. This is an automated email and unchecked account, please do not reply this email!"; mail($email, $subject, $message, "From: Carolina Administration<[email protected]\n"); require("header.php"); //show them a successful registration echo "Thank You $first. You have successfully registered for Carolina<br>"; echo "An email has been sent to the email address you provided with your login creditentials<br>."; echo "You may now login."; } //show error if emails do not match else { header("Location". $config_basedir . "register.php?error=2"); } }//show error if passwords do not match else { header("Location". $config_basedir . "register.php?error=3"); } } //ends if POST else { require("header.php"); ?> Thanks in advance Link to comment https://forums.phpfreaks.com/topic/131218-solved-internal-server-error/ Share on other sites More sharing options...
rhodesa Posted November 3, 2008 Share Posted November 3, 2008 my guess is it's cus you are missing a : after Location else { header("Location: ". $config_basedir . "register.php?error=2"); } }//show error if passwords do not match else { header("Location: ". $config_basedir . "register.php?error=3"); } another thought: do you have an .htaccess file in that folder or the ones above it? Link to comment https://forums.phpfreaks.com/topic/131218-solved-internal-server-error/#findComment-681248 Share on other sites More sharing options...
timmah1 Posted November 3, 2008 Author Share Posted November 3, 2008 no, I don't have an .htaccess file in there. Should I? Link to comment https://forums.phpfreaks.com/topic/131218-solved-internal-server-error/#findComment-681252 Share on other sites More sharing options...
rhodesa Posted November 3, 2008 Share Posted November 3, 2008 no...one isn't needed. but if you DID have one, and there was an error in it, that would cause a 500 error. is there any more info on the error page as to what is causing the error? timeout, etc? Link to comment https://forums.phpfreaks.com/topic/131218-solved-internal-server-error/#findComment-681253 Share on other sites More sharing options...
timmah1 Posted November 3, 2008 Author Share Posted November 3, 2008 I fixed this header("Location ". $config_basedir . "register.php?error=2"); to this header("Location: ". $config_basedir . "register.php?error=2"); And it's working now Thank you for your help Link to comment https://forums.phpfreaks.com/topic/131218-solved-internal-server-error/#findComment-681257 Share on other sites More sharing options...
DarkWater Posted November 3, 2008 Share Posted November 3, 2008 Also, at the first call to header(), you have no $config_basedir set, so that could potentially cause issues. Link to comment https://forums.phpfreaks.com/topic/131218-solved-internal-server-error/#findComment-681260 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.