Jump to content

Archived

This topic is now archived and is closed to further replies.

xyn

$end error ;/

Recommended Posts

Hi guys,
My login script isn't working, I get unexpected $end at line 99.
it's missing the "session_start();" because i have it at the TOP of my page.
before the HTML headers.


My code:
[code=php:0]<?PHP session_start(); ?>
<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta name="keywords" content="Eumod, Eurpean modified cars, modded, mod, customized">
<meta name="description" content="Eumod is a discussion wbesite and fitting company. we're proud of our services and expanding.">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel="stylesheet" type="text/css" href="style.css">
<title>EZone Logging in</title>
</head>

<body>

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
  <tr>
    <td width="1%">&nbsp;</td>
    <td width="98%">&nbsp;</td>
    <td width="1%">&nbsp;</td>
  </tr>
  <tr>
    <td width="1%">&nbsp;</td>
    <td width="98%"><?PHP
$user = $_POST['user'];
$pass = $_POST['pass'];

if(isset($_POST['user']) && empty($_POST['user']))
{
$error[] = "Please enter your username";
}
if(isset($_POST['pass']) && empty($_POST['pass']))
{
$error[] = "Please enter your password";
}

if(is_array($error))
{
echo '<p class="text">Error:<UL>';

foreach($error as $key => $val)
{
echo "<LI>" . $val . "</LI>";
}
echo '</UL></p>';
exit;
}


include "../db/db.php";
$sql = mysql_query("SELECT user,pass FROM accounts WHERE user='".strtolower($_POST['user'])."' AND pass='".md5($_POST['pass'])."'");
$num = @mysql_num_rows($sql);
if( !num )
{
$fault[] = "Your Username does not exist.";
}

$ql = mysql_query("SELECT adm_ban,pri_active FROM accounts WHERE user='".strtolower($_POST['user'])."' AND pass='".md5($_POST['pass'])."'");
while($data = mysql_fetch_array($ql, MYSQL_NUM))
{
$ban = $data[0];
$act = $data[1];
if( $ban == "y" )
{
$fault[] = "Sorry, you have been banned. Please email eumod support for more information.";
}
if( $act != "y" )
{
$fault[] = "Your acocunt has not been activated.";
}

if(is_array($fault))
{
echo '<p class="text">Error:<UL>';

foreach($fault as $key => $val)
{
echo "<LI>" . $val . "</LI>";
}
echo '</UL></p>';
exit;

}else{

$_SESSION['LoggedIn'] = true;
echo '<meta http-equiv="REFRESH" content="0;URL=../index.php">';

}
?></td>
    <td width="1%">&nbsp;</td>
  </tr>
  <tr>
    <td width="1%">&nbsp;</td>
    <td width="98%">&nbsp;</td>
    <td width="1%">&nbsp;</td>
  </tr>
</table>

</body>

</html>[/code]

Share this post


Link to post
Share on other sites
can you kindly make the code look better use the tab so i dont have to use the scoll bar cheers.


point out 99 please cheers.

Share this post


Link to post
Share on other sites
Had a quick look and i think you got a phase error becouse you dont backslash your double quotes
But when you post the correct error and show the error line may be someone can help ok.

Share this post


Link to post
Share on other sites
Let me updaste the whole code. and line 99 is </html>

Share this post


Link to post
Share on other sites
[code]
<?PHP session_start(); ?>
<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta name="keywords" content="Eumod, Eurpean modified cars, modded, mod, customized">
<meta name="description" content="Eumod is a discussion wbesite and fitting company. we're proud of our services and expanding.">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel="stylesheet" type="text/css" href="style.css">
<title>EZone Logging in</title>
</head>

<body>

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
    <td width="1%">&nbsp;</td>
    <td width="98%">&nbsp;</td>
    <td width="1%">&nbsp;</td>
  </tr>
  <tr>
    <td width="1%">&nbsp;</td>
    <td width="98%

<?PHP

$user = $_POST['user'];
$pass = $_POST['pass'];

if(isset($_POST['user']) && empty($_POST['user'])){
$error[] = "Please enter your username";
}
if(isset($_POST['pass']) && empty($_POST['pass'])){
$error[] = "Please enter your password";
}

if(is_array($error)){

echo "<p class='text'>Error:<UL>";

foreach($error as $key => $val){
echo "<LI>'" . $val . "'</LI>";
}
echo "</UL></p>";
exit;
}


include "../db/db.php";
$sql = mysql_query("SELECT user,pass FROM accounts WHERE user='".strtolower($_POST['user'])."' AND pass='".md5($_POST['pass'])."'");
$num = @mysql_num_rows($sql);
if( !num ){
$fault[] = "Your Username does not exist.";
}

$ql = mysql_query("SELECT adm_ban,pri_active FROM accounts WHERE user='".strtolower($_POST['user'])."' AND pass='".md5($_POST['pass'])."'");
while($data = mysql_fetch_array($ql, MYSQL_NUM)){
$ban = $data[0];
$act = $data[1];
if( $ban == "y" ){
$fault[] = "Sorry, you have been banned. Please email eumod support for more information.";
}
if( $act != "y" )
{
$fault[] = "Your acocunt has not been activated.";
}
if(is_array($fault)){
echo "<p class='text'>Error:<UL>";

foreach($fault as $key => $val){
echo "<LI>'" . $val . "'</LI>";
echo "</UL></p>";
exit;

}else{

$_SESSION['LoggedIn'] = true;
echo "<meta http-equiv='REFRESH' content='0;URL=../index.php'>";

}
?>
[/code]

Share this post


Link to post
Share on other sites
Unexpected $end means you are missing one or more brackets } somewhere. There's a sticky post about this here:

http://www.phpfreaks.com/forums/index.php/topic,100473.0.html

Share this post


Link to post
Share on other sites

×

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.