Jump to content

Parse error unexpect T_ELSE (help)


champbronc2

Recommended Posts

Parse error unexpect T_ELSE on line 46 I think it was.

<?
session_start();


if ($_POST['username']) {





if( strtolower($_POST['code'])!= strtolower($_SESSION['texto'])){ 

include('header.php'); 


echo "<br><br>SECURITY CODE ERROR... "; 

include('footer.php');

exit();
}


//Comprobacion del envio del nombre de usuario y password
require('funciones.php');
$username=uc($_POST['username']);
$password=uc($_POST['password']);

if ($password==NULL) {
echo "Login Incorrect. Try again.";
}else{
require('config.php');
$query = mysql_query("SELECT username,password FROM users WHERE username = '$username'") or die(mysql_error());
$data = mysql_fetch_array($query);
if($data['password'] != $password) {
echo "Login incorrect. Try again";
}else{
$query24 = mysql_query("SELECT confirmed FROM users WHERE username = '$username'");
$query1 = mysql_fetch_array($query24);
if($query1 != 1) {
echo "Activate your account via email please.";
}else{
$query = mysql_query("SELECT username,password FROM users WHERE username = '$username'") or die(mysql_error());
$row = mysql_fetch_array($query);
mysql_close($con);
$nicke=$row['username'];
$passe=$row['password'];

//90 dias dura la cookie
setcookie("usNick",$nicke,time()+7776000);
setcookie("usPass",$passe,time()+7776000);


$lastlogdate = date("F j, Y - g:i a");
$lastip = getRealIP();
require('config.php');
$querybt = "UPDATE users SET lastlogdate='$lastlogdate', lastiplog='$lastip' WHERE username='$nicke'";
mysql_query($querybt) or die(mysql_error());
mysql_close($con);

?>

<META HTTP-EQUIV="REFRESH" CONTENT="0;URL=members.php">

<?
}
}
}else{
?>
<? include('header.php'); ?>

<h3>Login</h3>
<br />

<a href="register.php">New User Register Free Account</a>
<br>
<a href="recoverpwd.php">Lost password?</a>
<br><br>


<div align="center"><div id="form">
<fieldset>
<legend>Login</legend>

<form action='login.php' method='POST'>

<table width="400" border="0" align="center">
  <tr>
    <td width="150" align="left"><p><label>Username</label></p></td>
    <td width="250" align="left"><input type='text' size='15' maxlength='25' name='username' autocomplete="off"value="" tabindex="1" /></td>
  </tr>
  <tr>
    <td width="150" align="left"><p><label>Password</label></p></td>
<td width="250" align="left"><input type='password' size='15' maxlength='25' name='password' autocomplete="off" value="" tabindex="2" /></td>
  </tr>
  <tr>
    <td width="150" align="left"><p><label>Security Code </label></p></td>
    <td width="250" align="left"><input type='text' size='3' maxlength='3' name='code' autocomplete="off" class="securitycode" value="" tabindex="3" /></td>
  </tr>
  <tr>
    <td width="150" align="left"> </td>
    <td width="250" align="left"><img src="image.php?<?php echo $res; ?>" /></td>
  </tr>

  <tr>
    <td width="150" align="left"> </td>
    <td width="250" align="right"><input type="submit" value="Enter" class="submit" tabindex="4" />
</td>
  </tr>
</table>
</form>
</fieldset>
</div></div>





<? include('footer.php'); ?>
<?
}
?>

I would not get the error when this piece of code was not there:

}else{
$query24 = mysql_query("SELECT confirmed FROM users WHERE username = '$username'");
$query1 = mysql_fetch_array($query24);
if($query1 != 1) {
echo "Activate your account via email please.";

 

But I need that code so that only verified members can login.

 

Any idea what I am doing wrong??

Link to comment
https://forums.phpfreaks.com/topic/125235-parse-error-unexpect-t_else-help/
Share on other sites

this line..

<?
}
}
}else{
?>

 

try adding another } above the else... it removed the error in my IDE though I don't know if it will be your intended function.

 

EDIT: if it does not function as you want it to, indent your lines like a proper programmer should and it will allow you to easily see your mistake.

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.