Jump to content

Internal Server Error all of a sudden??


mfleming

Recommended Posts

Hi.

 

I had this form all working, but then I commented out some echo's and changed the name of my custom error variables now all of a sudden when I hit submit without all fields I get an INTERNAL SERVER ERROR PAGE.

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Apache/1.3.33 Server at www.fusionfashionhair.com Port 80

 

I don't know what else would have causes this as I had it working yesterday?

 

 

My code:

<?php
session_start();
?>
<?php
$submit = $_POST['submit'];
// Form Data
$email = $_POST['email'];
$password_old = $_POST['password_old'];
$password_new = $_POST['password_new'];
$password_new_con = $_POST['password_new_con'];
$errorcount = 0;

// Edit anything inbetween the " " for the display error message
$errormsg['sErrEmail'] = "Email Entered is not in our database"; 
$errormsg['sErrOldPass'] = "Old Password Entered is Incorrect. Please check your Email";
$errormsg['sErrNewPass'] = "New Password must be between 6 and 32 characters";
$errormsg['sErrNewPassCon'] = "New Passwords do not match.";
$errormsg['sErrSecCode'] = "Security Code is Invalid";
$errormsg['sErrdbPass'] = "Invalide Email or activation code. Please Contact <a href='mailto:webmaster@fusionfashionhair.com?subject=Fusion Fashion Hair - Member Activation Error%20Request'>Admin</a>";
$errormsg['NoErr'] = "No Errors, Continue";
$errormsg['PlaceHold'] = "";

$errortrack[] = $errormsg['PlaceHold'];

if ($_POST[submit]){
	if ($errorstop = "go") {
		$errorstop="go";
		while ($errorstop<>"stop") {
			//Check for security code
			if ($_SESSION[key]==$_POST[user_code]){ 
				// echo "True - Continue 0";
				// echo "<p>----------</p>";
				$_SESSION[key]='';
			} else {
				// echo "False - Stop 0";
				$errortrack[] = $errormsg['sErrSecCode'];
				$errorcount++;
				$errorstop="stop";
			}
			// check email verification
			if (!checkEmail($email)) {
				// echo "False - Stop 1";
				$errortrack[] = $errormsg['sErrEmail'];
				$errorcount++;
				$errorstop="stop";				
			} else {
				// echo "True - Continue 1";
				// echo "<p>----------</p>";
			}
			// check for existance
			if (strlen($password_old)>5) {
				// echo "True - Continue 2";
				// echo "<p>----------</p>";
			} else {
				// echo "False - Stop 2";
				$errortrack[] = $errormsg['sErrOldPass'];
				$errorcount++;
				$errorstop="stop";
			}		
			// check for existance
			if (strlen($password_new)>32||strlen($password_new)<6) {
				// echo "False - Stop 3";
				$errortrack[] = $errormsg['sErrNewPass'];
				$errorcount++;
				$errorstop="stop";
			} else {
				// echo "True - Continue 3";
				// echo "<p>----------</p>";
			}		

			// check for existance
			if ($password_new_con==$password_new) {
				// echo "True - Continue 4";
				// echo "<p>----------</p>";
				$errorstop="stop";//Get Out of loop
			} else {
				// echo "False - Stop 4";
				$errortrack[] = $errormsg['sErrNewPassCon'];
				$errorcount++;
				$errorstop="stop";
			}
		}//End While Loop


		// Check database
		require('dbConfig.php');
		// Encrypts old password to check with Database Encryped Password
		$password_old = md5($password_old);

		$check = mysql_query("SELECT * FROM {$usertable} WHERE email='$email' AND password='$password_old'");
		$checknum = mysql_num_rows($check);
		if ($checknum==1) {
			// echo "True - Continue 5 Set password";
			// echo "<p>----------</p>";
			// Encrypts new password
			$password = md5($password_new);
			//run a query to update the account
			$acti = mysql_query("UPDATE {$usertable} SET password='$password' WHERE email='$email'");	
		} else {
			// echo "False - Stop 5";
			$errortrack[] = $errormsg['sErrdbPass'];
			$errorcount++;
			$errorstop="stop";
		}//End if checknum

		// echo "True - Continue 6 GO TO HEADER PAGE";
		// Thank you Page
		$insertGoTo = "changepass.php";
		header(sprintf("Location: %s", $insertGoTo));	

		//send confirmation email
		$to = $email; 
		$subject = "Password Changed for Fusion Fashion Hair";
		$headers = "From:  webmaster@fusionfashionhair.com";
		$server = "mail.fusionfashionhair.com";

		//change php.ini and set SMTP to $server
		ini_set("SMTP",$server);


		$body = "

		Password Successfuly changed for $email, \n\n

		Please click on the link provided below to activate the account with Fusion Fashion Hair
		http://www.fusionfashionhair.com/activate.php?id=$lastid&code=$random \n\n




		Thank you,

		Customer Service

		Contact webmaster for any concerns regarding this email. <a href='mailto:webmaster@fusionfashionhair.com?subject=Fusion Fashion Hair - Password Change Error%20Request'>Admin</a>.
		";

		//function to send email
		mail($to, $subject, $body, $headers);
		} else {
			while($errorcount>=0) {
				// Test display all error messages
				// echo "<p>----------</p>";
				// echo "<p>Error Count = '$errorcount'</p>";
		}
		$errormsg['MissAll'] = "Please Enter in ALL Fields!";
		die ("PLEASE FILL IN ALL FIELDS");	
}// End If Error Go
}// End if Submit
?>
<?php

// LINUX PLATFORM OPTION 3

// checkEmail function checks standard email format same as preg_match()
// checkEmail function checks DSN records using checkdnsrr  Use list() to seperate name and domain using split function
// checkdnsrr ONLY WORKS on LINUX PLATFORM
// Check to see if domain and username is active
// uses fsockopen() to check if its in use using port 25
function checkEmail($email) {
// checks proper syntax
if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/" , $email)) {

	// gets domain name
	list($username,$domain)=split('@',$email);
	// checks for if MX records in the DNS
	if(!checkdnsrr($domain, 'MX')) {
		return false;
	}
	return true;
}
return false;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Fusion Fashion Hair, Loop Hair Extensions Winnipeg, MB </title>
<link href="css/thrColLiqHdr.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/p7exp.css"/>
<link rel="stylesheet" type="text/css" href="css/loginforms.css"/>
<!--[if lte IE 7]>
<style>
.content { margin-right: -1px; } /* this 1px negative margin can be placed on any of the columns in this layout with the same corrective effect. */
ul.nav a { zoom: 1; }  /* the zoom property gives IE the hasLayout trigger it needs to correct extra whiltespace between the links */
</style>
<![endif]-->
</head>
<body onLoad="document.getElementById('user_code').focus();">
<body>
<div class="container">
  <div class="header"><img src="mainlogo3.gif" width="824" height="353" alt="Fusion Fashion Hair" /> </div>
  <!-- end .header -->
  
  <div id="menuwrapper">
    <ul id="p7menubar">
      <li><a href="#">Home</a></li>
      <li><a href="#">Products</a></li>
      <li><a href="#">Shipping</a></li>
      <li><a href="#">Instructions</a></li>
      <li id="LastItem"><a href="#">Contact Us</a></li>
    </ul>
  </div>
  <!-- end menuwrapper -->
  
  <div class="sidebar1_login">
    <h1 class="left">Welcome to Fusion Fashion Hair</h1>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <!-- end .sidebar1 --></div>
  <div class="content_login">
    <p> </p>
    <div class="divider"><!--Page From Divider Line-->
      <p> </p>
    </div>
    <!--End of Divider-->
    <p> </p>
    <form action='newpassform.php' method='post' id="regform">
      <fieldset>
        <legend>Change Password</legend>
        <p><?php foreach ( $errortrack as $value) { //( $errortrack as $key => $value) 
			echo "<span class='errorcode'>$value</span>";}?>
        </p>
        <p>
          <label for='email'>Email:</label>
          <input name='email' type='text' maxlength="25" value='<?php echo $email; ?>'/>
        </p>
        <p>
          <label for='password_old'>Old Password:</label>
          <input name='password_old' type='password' maxlength="32" />
        </p>
        <p>
          <label for='password_new'>New Password:</label>
          <input name='password_new' type='password' maxlength="32"/>
        </p>
        <p>
          <label for='password_new_con'>Confirm Password:</label>
          <input name='password_new_con' type='password' maxlength="32"/>
        </p>
        <p><span class="required">*</span> Note, username and password are case sensitive</p>
        <p>Forgot your password? <a href="forgot_password.php">Click Here</a></p>
        <p>Login <a href="login.php">Here</a></p>
       <h2>Security Check</h2>
      <p>Enter letters below exactly how they are displayed.  Letter are case sensitive. </p>
      <br />
      <img src="captcha.class.php?usefile=1" /> 
      <!--OR--> 
      <!--<img src="image.php" />-->
      
      <input id='user_code' name='user_code' type='text' size='10' >
      <p> </p>
        <input class="reset" type='reset' value='Cancel' name='reset'>
			<input class="submit" type='submit' value='Continue' name='submit'>
      </fieldset>
    </form>
    <!--End of Form--> 
    <!-- end .content --> 
  </div>
  <div class="sidebar2_login">
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    
    <!-- end .sidebar2 --></div>
  <div class="footer"> 
    <!-- end .footer --></div>
  <!-- end .container --></div>
</body>
</html>

Link to comment
Share on other sites

Found it.

 

If I remove the comment from either of these two echos, the Internal Server Error is gone.

 

I'm assuming this has something to do the the Header?

 

			//echo "True - Continue 6 GO TO HEADER PAGE";
		//echo "<p>----------</p>";
		// Thank you Page
		$insertGoTo = "changepass.php";
		header(sprintf("Location: %s", $insertGoTo));	

 

Also,

 

How do I make the code stop?  Currently even if I enter zero info in the form it says says:

 

No recipient addresses found in header

 

Which is part of the php mail function.  I should be exiting out before I get here correct?

 

 

My Code:

<?php
session_start();
?>
<?php
$submit = $_POST['submit'];
// Form Data
$email = $_POST['email'];
$password_old = $_POST['password_old'];
$password_new = $_POST['password_new'];
$password_new_con = $_POST['password_new_con'];
$errorcount = 0;

// Edit anything inbetween the " " for the display error message
$errormsg['sErrEmail'] = "Email Entered is not in our database"; 
$errormsg['sErrOldPass'] = "Old Password Entered is Incorrect. Please check your Email";
$errormsg['sErrNewPass'] = "New Password must be between 6 and 32 characters";
$errormsg['sErrNewPassCon'] = "New Passwords do not match.";
$errormsg['sErrSecCode'] = "Security Code is Invalid";
$errormsg['sErrdbPass'] = "Invalide Email or Old Password, Check your Email.  If You Still Have Problems Please Contact <a href='mailto:webmaster@fusionfashionhair.com?subject=Fusion Fashion Hair - Member Activation Error%20Request'>Admin</a>";
$errormsg['NoErr'] = "No Errors, Continue";
$errormsg['PlaceHold'] = "";

$errortrack[] = $errormsg['PlaceHold'];

if ($_POST[submit]){
	if ($errorstop = "go") {
		$errorstop="go";
		while ($errorstop<>"stop") {
			//Check for security code
			if ($_SESSION[key]==$_POST[user_code]){ 
				//echo "True - Continue 0";
				//echo "<p>----------</p>";
				$_SESSION[key]='';
			} else {
				//echo "False - Stop 0";
				$errortrack[] = $errormsg['sErrSecCode'];
				$errorcount++;
				$errorstop="stop";
			}
			// check email verification
			if (!checkEmail($email)) {
				//echo "False - Stop 1";
				$errortrack[] = $errormsg['sErrEmail'];
				$errorcount++;
				$errorstop="stop";				
			} else {
				//echo "True - Continue 1";
				//echo "<p>----------</p>";
			}
			// check for existance
			if (strlen($password_old)>5) {
				//echo "True - Continue 2";
				//echo "<p>----------</p>";
			} else {
				//echo "False - Stop 2";
				$errortrack[] = $errormsg['sErrOldPass'];
				$errorcount++;
				$errorstop="stop";
			}		
			// check for existance
			if (strlen($password_new)>32||strlen($password_new)<6) {
				//echo "False - Stop 3";
				$errortrack[] = $errormsg['sErrNewPass'];
				$errorcount++;
				$errorstop="stop";
			} else {
				//echo "True - Continue 3";
				//echo "<p>----------</p>";
			}		

			// check for existance
			if ($password_new_con==$password_new) {
				//echo "True - Continue 4";
				//echo "<p>----------</p>";
			} else {
				//echo "False - Stop 4";
				$errortrack[] = $errormsg['sErrNewPassCon'];
				$errorcount++;
				$errorstop="stop";
			}
			$errorstop="stop";//Get Out of loop
		}//End While Loop

		// Check database
		require('dbConfig.php');
		// Encrypts old password to check with Database Encryped Password
		$password_old = md5($password_old);

		$check = mysql_query("SELECT * FROM {$usertable} WHERE email='$email' AND password='$password_old'");
		$checknum = mysql_num_rows($check);
		if ($checknum==1) {
			//echo "True - Continue 5 Set password";
			//echo "<p>----------</p>";
			// Encrypts new password
			$password = md5($password_new);
			//run a query to update the account
			$acti = mysql_query("UPDATE {$usertable} SET password='$password' WHERE email='$email'");	
		} else {
			//echo "False - Stop 5";
			$errortrack[] = $errormsg['sErrdbPass'];
			$errorcount++;
			$errorstop="stop";
		}//End if checknum

		//echo "True - Continue 6 GO TO HEADER PAGE";
		echo "<p>----------</p>";
		// Thank you Page
		$insertGoTo = "changepass.php";
		header(sprintf("Location: %s", $insertGoTo));	

		//send confirmation email
		$to = $email; 
		$subject = "Password Changed for Fusion Fashion Hair";
		$headers = "From:  webmaster@fusionfashionhair.com";
		$server = "mail.fusionfashionhair.com";

		//change php.ini and set SMTP to $server
		ini_set("SMTP",$server);


		$body = "

		Password Successfuly changed for $email, \n\n

		Please click on the link provided below to activate the account with Fusion Fashion Hair
		http://www.fusionfashionhair.com/activate.php?id=$lastid&code=$random \n\n




		Thank you,

		Customer Service

		Contact webmaster for any concerns regarding this email. <a href='mailto:webmaster@fusionfashionhair.com?subject=Fusion Fashion Hair - Password Change Error%20Request'>Admin</a>.
		";

		//function to send email
		mail($to, $subject, $body, $headers);

		} else {
			while($errorcount>=0) {
				// Test display all error messages
				echo "<p>----------</p>";
				echo "<p>Error Count = '$errorcount'</p>";
		}
		$errormsg['MissAll'] = "Please Enter in ALL Fields!";
		die ("PLEASE FILL IN ALL FIELDS");	
}// End If Error Go
}// End if Submit
?>
<?php

// LINUX PLATFORM OPTION 3

// checkEmail function checks standard email format same as preg_match()
// checkEmail function checks DSN records using checkdnsrr  Use list() to seperate name and domain using split function
// checkdnsrr ONLY WORKS on LINUX PLATFORM
// Check to see if domain and username is active
// uses fsockopen() to check if its in use using port 25
function checkEmail($email) {
// checks proper syntax
if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/" , $email)) {

	// gets domain name
	list($username,$domain)=split('@',$email);
	// checks for if MX records in the DNS
	if(!checkdnsrr($domain, 'MX')) {
		return false;
	}
	return true;
}
return false;
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.