Jump to content


Photo

$end error ;/


  • Please log in to reply
5 replies to this topic

#1 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 30 July 2006 - 07:05 PM

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:
<?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>


#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 30 July 2006 - 07:12 PM

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.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 30 July 2006 - 07:20 PM

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.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 30 July 2006 - 07:21 PM

Let me updaste the whole code. and line 99 is </html>

#5 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 30 July 2006 - 07:34 PM

<?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'>";
	
}
?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#6 pixy

pixy
  • Members
  • PipPipPip
  • Advanced Member
  • 295 posts

Posted 30 July 2006 - 08:01 PM

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

http://www.phpfreaks...c,100473.0.html

This is a .44 Caliber Loveletter straight through my heart.

Tabulas + Threadless + Hire Me!





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users