Jump to content

Parse error: syntax error, unexpected T_ELSEIF...


caryhartline

Recommended Posts

I can't figure out the problem with my code.  This is the error I am receiving...

 

Parse error: syntax error, unexpected T_ELSEIF in /****/****/****/****/****/**** on line 68

 

This is my code:

-----------------------------------------------------------------------------------------------------

 

 

<?

include "./includes/config.inc.php";
include $include_path."countries.inc.php";

#// If user is not logged in redirect to login page
if(!isset($_SESSION["BPLowbidAuction_LOGGED_IN"])) {
Header("Location: user_login.php");
exit;
}

if($_POST['action'] == "update") {
#// Check data
if ($_POST['TPL_email']) {
	if (strlen($_POST['TPL_password'])<6 && strlen($_POST['TPL_password']) > 0) {
		$TPL_err=1;
		$TPL_errmsg=$ERR_011;
	} else if (strlen($_POST['TPL_email'])<5) {
		$TPL_err=1;
		$TPL_errmsg=$ERR_110;
	} elseif(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$",$_POST['TPL_email'])) {
		$TPL_err = 1;
		$TPL_errmsg = $ERR_008;
		}
		$nletter=isset($_POST['TPL_nletter']) ? $_POST['TPL_nletter'] :0;
		$sql="UPDATE BPLA_users SET email=\"".	AddSlashes($_POST['TPL_email'])
		."\", reg_date=reg_date"
		." , nletter=\"".			AddSlashes($_POST['TPL_nletter']);

		if(strlen($_POST['TPL_password']) > 0) {
			$sql .= 	"\", password=\"".		md5($MD5_PREFIX.AddSlashes($_POST['TPL_password']));
		}

		$sql .= "\" WHERE nick='".$_SESSION['BPLowbidAuction_LOGGED_IN_USERNAME']."'";
		$res=mysql_query ($sql);


		//$query = "select * from BPLA_users where nick='".$_SESSION['BPLowbidAuction_LOGGED_IN_USERNAME']."'";
		//$result = @mysql_query($query);
		//if(!$result) {
		//	MySQLError($query);
		//	exit;
		//} else {
		//	$USER = mysql_fetch_array($result);
		//	$TPL_nick 		= $USER['nick'];
		//	$TPL_email 		= $USER['email'];;
		//	$TPL_nletter 	= $USER['nletter'];
		//	}
		//}
		//
		#// Redirect user to his/her admin page
		$TMP_MSG = $MSG_183;
		$_SESSION["TMP_MSG"]=$TMP_MSG;

		/*Header("Location: user_menu.php");
		exit;

		include "header.php";
		include "templates/template_updated.html";
		*/
		//include "header.php";
		//include phpa_include("template_change_details_php.html");

} else {
	$TPL_err=1;
	$TPL_errmsg=$ERR_112;

elseif(($_POST['action'] != "update" || $TPL_errmsg !=1)) {
//#// Retrieve user's data
//$query = "select * from BPLA_users where nick='".$_SESSION['BPLowbidAuction_LOGGED_IN_USERNAME']."'";
//$result = @mysql_query($query);
//if(!$result) {
//	MySQLError($query);
//	exit;
//} else {
//	$USER = mysql_fetch_array($result);
//	$TPL_nick 		= $USER['nick'];
//	$TPL_email 		= $USER['email'];
//	$TPL_nletter 	= $USER['nletter'];
//}
//echo "111 ";
//include "header.php";
//include phpa_include("template_change_details_php.html");
}

if($TPL_err==1) {	
//include "header.php";
//include phpa_include("template_change_details_php.html");
}


#// Retrieve user's data
$query = "select * from BPLA_users where nick='".$_SESSION['BPLowbidAuction_LOGGED_IN_USERNAME']."'";
$result = @mysql_query($query);
if(!$result) {
	MySQLError($query);
	exit;
} else {
	$USER = mysql_fetch_array($result);
	$TPL_nick 		= $USER['nick'];
	$TPL_email 		= $USER['email'];
	$TPL_nletter 	= $USER['nletter'];
}

include "header.php";
include phpa_include("template_change_details_php.html");

include "footer.php";

$TPL_err=0;
$TPL_errmsg="";
?>

Formatting your code help detects issues such as this.

 

  include "./includes/config.inc.php";
  include $include_path . "countries.inc.php";
  
  //// If user is not logged in redirect to login page
  if (!isset($_SESSION["BPLowbidAuction_LOGGED_IN"])) {
      header("Location: user_login.php");
      exit;
  }
  
  if ($_POST['action'] == "update") {
      //// Check data
      if ($_POST['TPL_email']) {
          if (strlen($_POST['TPL_password'])  0) {
              $TPL_err = 1;
              $TPL_errmsg = $ERR_011;
          } elseif (strlen($_POST['TPL_email'])               $TPL_err = 1;
              $TPL_errmsg = $ERR_110;
          } elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$", $_POST['TPL_email'])) {
              $TPL_err = 1;
              $TPL_errmsg = $ERR_008;
          }
          $nletter = isset($_POST['TPL_nletter']) ? $_POST['TPL_nletter'] : 0;
          $sql = "UPDATE BPLA_users SET email=\"" . addslashes($_POST['TPL_email']) . "\", reg_date=reg_date" . " , nletter=\"" . addslashes($_POST['TPL_nletter']);
          
          if (strlen($_POST['TPL_password']) > 0) {
              $sql .= "\", password=\"" . md5($MD5_PREFIX . addslashes($_POST['TPL_password']));
          }
          
          $sql .= "\" WHERE nick='" . $_SESSION['BPLowbidAuction_LOGGED_IN_USERNAME'] . "'";
          $res = mysql_query($sql);
          
          
          //$query = "select * from BPLA_users where nick='".$_SESSION['BPLowbidAuction_LOGGED_IN_USERNAME']."'";
          //$result = @mysql_query($query);
          //if(!$result) {
          //  MySQLError($query);
          //  exit;
          //} else {
          //  $USER = mysql_fetch_array($result);
          //  $TPL_nick     = $USER['nick'];
          //  $TPL_email     = $USER['email'];;
          //  $TPL_nletter   = $USER['nletter'];
          //  }
          //}
          //
          //// Redirect user to his/her admin page
          $TMP_MSG = $MSG_183;
          $_SESSION["TMP_MSG"] = $TMP_MSG;
          
          /*Header("Location: user_menu.php");
           exit;
           
           include "header.php";
           include "templates/template_updated.html";
           */
          //include "header.php";
          //include phpa_include("template_change_details_php.html");
      } else {
          $TPL_err = 1;
          $TPL_errmsg = $ERR_112;
          elseif (($_POST['action'] != "update" || $TPL_errmsg != 1)) {
              //#// Retrieve user's data
              //$query = "select * from BPLA_users where nick='".$_SESSION['BPLowbidAuction_LOGGED_IN_USERNAME']."'";
              //$result = @mysql_query($query);
              //if(!$result) {
              //  MySQLError($query);
              //  exit;
              //} else {
              //  $USER = mysql_fetch_array($result);
              //  $TPL_nick     = $USER['nick'];
              //  $TPL_email     = $USER['email'];
              //  $TPL_nletter   = $USER['nletter'];
              //}
              //echo "111 ";
              //include "header.php";
              //include phpa_include("template_change_details_php.html");
          }
          
          if ($TPL_err == 1) {
              //include "header.php";
              //include phpa_include("template_change_details_php.html");
          }
          
          
          //// Retrieve user's data
          $query = "select * from BPLA_users where nick='" . $_SESSION['BPLowbidAuction_LOGGED_IN_USERNAME'] . "'";
          $result = @mysql_query($query);
          if (!$result) {
              MySQLError($query);
              exit;
          } else {
              $USER = mysql_fetch_array($result);
              $TPL_nick = $USER['nick'];
              $TPL_email = $USER['email'];
              $TPL_nletter = $USER['nletter'];
          }
          
          include "header.php";
          include phpa_include("template_change_details_php.html");
          
          include "footer.php";
          
          $TPL_err = 0;
          $TPL_errmsg = "";
?>

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.