Jump to content

$end error ;/


xyn

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]
Link to comment
https://forums.phpfreaks.com/topic/16041-end-error/
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]
Link to comment
https://forums.phpfreaks.com/topic/16041-end-error/#findComment-66077
Share on other sites

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.