caryhartline Posted May 18, 2011 Share Posted May 18, 2011 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=""; ?> Quote Link to comment https://forums.phpfreaks.com/topic/236786-parse-error-syntax-error-unexpected-t_elseif/ Share on other sites More sharing options...
Maq Posted May 18, 2011 Share Posted May 18, 2011 In the future, please place tags around your code. Quote Link to comment https://forums.phpfreaks.com/topic/236786-parse-error-syntax-error-unexpected-t_elseif/#findComment-1217211 Share on other sites More sharing options...
mikosiko Posted May 18, 2011 Share Posted May 18, 2011 seems that you are missing a couple of }'s here (The error message is giving you good information) } else { $TPL_err=1; $TPL_errmsg=$ERR_112; elseif(($_POST['action'] != "update" || $TPL_errmsg !=1)) { Quote Link to comment https://forums.phpfreaks.com/topic/236786-parse-error-syntax-error-unexpected-t_elseif/#findComment-1217215 Share on other sites More sharing options...
Maq Posted May 18, 2011 Share Posted May 18, 2011 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 = ""; ?> Quote Link to comment https://forums.phpfreaks.com/topic/236786-parse-error-syntax-error-unexpected-t_elseif/#findComment-1217231 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.