Jump to content

[SOLVED] Internal Server Error


timmah1

Recommended Posts

This page worked perfectly on my server, but when I transferred it to my clients server, I get a 500 Internal Server Error.

Can anybody tell me why?

if($_POST['register']) {

if($_POST['password'] == $_POST['password2']) {

		//check to see if email has been registered
		$checksql = "SELECT * FROM users WHERE email = '" . $_POST['email'] . "' ;"; 
		$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=taken");
		}

	for($i = 0; $i < 16; $i++) {
				$randomstring .=chr(mt_rand(32,126));
	}


	$verifyurl = "$config_basedir/verify.php";
	$verifystring = urlencode($randomstring);
	$verifyemail = urlencode($_POST['email']);
	$verifyusername = $_POST['username'];

	$ip=$_SERVER['REMOTE_ADDR'];
	//login information
	$user = $_POST['username'];
	$pass = $_POST['password'];

	//personal stuff
	$first = $_POST['first'];
	$email = $_POST['email'];
	$last = $_POST['last'];
	$state = $_POST['state'];
	$zip = $_POST['zip'];
	$remind = $_POST['remind'];

	//get rid of the bad stuff
	$user = stripslashes($user);
	$pass = stripslashes($pass);
	$email = stripslashes($email);
	$first = stripslashes($first);
	$last = stripslashes($last);
	$state = stripslashes($state);
	$zip = stripslashes($zip);
	$remind = stripslashes($remind);

	$user = mysql_real_escape_string($user);
	$pass = mysql_real_escape_string($pass);
	$email = mysql_real_escape_string($email);
	$first = mysql_real_escape_string($first);
	$last = mysql_real_escape_string($last);
	$state = mysql_real_escape_string($state);
	$zip = mysql_real_escape_string($zip);
	$remind = mysql_real_escape_string($remind);

	//now insert everything in to the database
	$sql = "INSERT INTO users(ip, username, password, email, first, last, state, zip, remind, verify_string, active, credits) VALUES(
				'$ip',
				'$user',
				'$pass',
				'$email',
				'$first',
				'$last',
				'$state',
				'$zip',
				'$remind',
				'" . addslashes($randomstring) . "',
				0,
				'$credits');";
				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 = "Karla Kogan Website Registration";
   			$message = "

		Hello $first $last, 

		Thank you for registering for Karla Kogan.
		You must activate your account before you can login, please click on the link below.

		$verifyurl?email=$verifyemail&verify=$verifystring

		===================================

		NOTE: If you believe you received this notification in error, please send an email to [email protected]

		-------------------------
		©2008 KarlaKogan.com. All Rights Reserved.

		This is an automated email and unchecked account, please do not reply this email!";  


   		 	 mail($_POST['email'], $subject, $message, 
      		  "From: Karla Kogan Validation<[email protected]\n"); 
		  
		//show that their information was received and that an email was sent to them
		require("header.php");
		echo "
		 	<font color='#FFFFFF'>Thank you for registering.<br>
An email has been sent to the email address you provided. <br>Please check your spam folder and/or your junk folder.<br>You must click on the link to verify your account before logging in</font>";
		}

		//show error if the passwords don't match
		else {
			header("Location: " . $config_basedir . "/register.php?error=pass");
		}
}
else {
require("header.php");

//this switches and shows the errors if there were any
	switch($_GET['error']) {

		case "pass":
			echo "<font color=#FF0000><strong>Passwords do not match</font>";
		break;

		case "taken":
			echo "<font color=#FF0000><strong>Username is already in use</font>";
		break;

		case "ip":
			echo "<font color=#FF0000><strong>Your IP Address has already been signed up</font>";
		break;
	}

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/128168-solved-internal-server-error/
Share on other sites

I took the code apart, piece by piece, everything works fine until the mail() function which I have

mail($email, $subject, $message, 
"From: Karla Kogan Validation<[email protected]\n");

 

They host with GoDaddy, is GoDaddy different then every other server that it won't allow mail()?

 

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.