Jump to content

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 = "";
?>

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.