Jump to content

[SOLVED] Internal Server Error


timmah1

Recommended Posts

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

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.