Jump to content

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

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.