Jump to content

Need help finding error


Godfather2009

Recommended Posts

<?

 

if(($username) && ($password)){

 

$user = $mysql_fetch_array($mysql_query("SELECT id,status,code,email,ip FROM $tab[user] WHERE username ='$username' AND password ='$password';"));

 

    if($user[1] == banned){ header("Location: login.php?reason=banned&code=$user[2]"); }

elseif($user[1] == unverified){ header("Location: confirm.php?email=$user[3]"); }

elseif($user)

      {

      $host=gethostbyaddr("$REMOTE_ADDR");

      $mysql_query("UPDATE $tab[user] SET online='$time', ip='$REMOTE_ADDR', lastip='$user[4]', host='$host' WHERE id='$user[0]';");

 

      setcookie("trupimp",$user[2]);

 

      header("Location: newsandupdates.php");

      }

  else{ header("Location: login.php?reason=invalid"); }

}

 

 

if($reason==banned){

$banned = $mysql_fetch_array($mysql_query("SELECT reason FROM $tab[user] WHERE code='$code';"));

}

 

 

?>

<html>

 

<TITLE>SITE</TITLE>

 

 

<link href="css/splash.css" rel="stylesheet" type="text/css">

 

<body  bgcolor="#000000" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#0099FF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="margin: 0; padding: 0;">

<table width="821" border="0" align="center" id="container">

  <tr>

    <td width="821" align="center" colspan="3"><img src="images/splash.jpg" width="821" height="516"></td>

 

  </tr>

  <tr>

    <td align="left">

      <div id="welcome" style="background: #000 url('images/descbg.jpg') bottom right no-repeat; position:relative; width:450; height:450; z-index:1; left: 5; top: 0; overflow: auto; font: 95% arial, verdana; unicode-bidi:bidi-override; direction:rtl; display:block; overflow:auto; padding:10px; padding-bottom: 0; border:1px solid #ba8; margin:0 auto;">

  <div dir="ltr">

  <p style="font-size: 120%; color: #ab976e; font-weight: bold;">SITE.com Online Game</p>

 

        <p>SITE free web based multiplayer Online Game based on the real mafia life. </p>

 

<p>You want to be a real Mobster like John Gotti and have all the little mafiosos at your feet? You want to have

fun? You want to make money? Then, you are at the right place! </p>

 

<p>Enter the Mafia world and you will become the boss of a crime gang. As a mobster, you won't have any legal restraints to make money. Indeed, your options are infinite. </p>

 

<p>You can purchase cars to do drive by's. </p>

 

<p>You can form or join an existing family. </p>

 

<p>Really, in the mafia world, there is not much you can't do! </p>

 

<p>SITE.com offers a Real Cash Prize each round along with other amazing prizes. </p>

 

<p>Enjoy the game!</p>

</div>

      </div>

</td>

<td align="center">

  <div id="login" style="z-index:3;">

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

    <table width="160" cellpadding="0" cellspacing="0">

    <tr>

  <td>

 

  <span class="login">

  <br>

  <span style="color: #ab976e; font: 115% arial, verdana; text-transform: uppercase; font-weight: bold; text-align: center;">Login</span>

  </span>

</td>

  </tr>

  <table width="100%" height="100%">

    <tr>

    <td align="center" valign="top">

    <form method="post" action="login.php">

    <?if($reason==banned){?><b><font color="3399FF"><center>You have been banned from our site for a reason.... Why?</center><br><br><a href="http://www.SITE.com/images/banned.swf">

Click Here<br><br></a></font><?=$banned[0]?>  </b><br><br><?}?>     

    <?if($reason==invalid){?><b><font color="89B93A">Invalid login attempt from </font><?=$REMOTE_ADDR?></b><br><br><?}?>

    <?if($reason==notlogged){?><b><font color="89B93A">You must login before you can access this page</font></b><br><br><?}?>

    <?if($reason==idle){?><b><font color="89B93A">You have been logged out for idling</font></b><br><br>

    <?}?>

    <?if($reason==logout){?><b><font color="89B93A">Thanks for playing SITE.com, come back soon!</font></b><br>

    <br><?}?>

    <table>

      <tr>

      <td align="right"><span style="color: #ab976e; font: 65% arial, verdana; text-transform: uppercase; font-weight: bold;">username:</span></td><td><strong><font color="#FFFFFF">

        <input type="text" id=entry type="input" class="input" name="username" maxlength="18" value="username" onfocus="if(this.value == 'username') this.value = '';">

      </font></strong></td>

      </tr>

      <tr>

      <td align="right"><span style="color: #ab976e; font: 65% arial, verdana; text-transform: uppercase; font-weight: bold;">password:</span></td><td><strong><font color="#FFFFFF">

        <input id=entry type="password" class="input" name="password" maxlength="18" value="password" onFocus="if(this.value == 'password') this.value = '';">

      </font></strong></td>

      </tr>

      <tr>

      <td align="right" colspan="2"><strong><font color="#FFFFFF">

        <input type="submit" name="login" value="login">

      </font></strong></td>

      </tr>

    </table>

    <br>

    <strong>

 

<img src="images/signup.jpg" alt="signup, it's free." title="signup, it's free.">

 

<br>

    <span style="color: #ab976e; font: 65% arial, verdana;">

<a href="lostpass.php">Sign up</a>, it's <span style="text-transform: uppercase; color: #8b3400; font-weight: bold; font-size: 120%;">free!</span>

<br />

Lost your password? <a href="lostpass.php">click here</a>.

</span>

    </strong>

    </form>

    </td>

    </tr>

  </table>   </table>

 

</form>

  </div>  

</td>     

  </tr>

  <tr>

  <td colspan="3" style="padding-top: 30px;">

 

  <p align="center" style="font-size: 10px;">

    <span style="font: 100% verdana;">SITE.com © 2006-2007   All Rights Reserved  <a href="mailto:[email protected]">Admin</a></span>

</p>

 

</body>

</html>

Its must be me or something but i dont see any errors in the script. It just seems as though its not getting the information from MYSQL Database.

Link to comment
https://forums.phpfreaks.com/topic/164049-need-help-finding-error/
Share on other sites

Have you verified that you are in fact connecting to the db?  I don't see any sort of connection string or a require for it.

If this page is posting to itself then you have nothing to capture the POST variables.  Also, there is nothing to check if the login button was even clicked.  That would explaind why its not doing anything because its not.  Something like this might help:

if (isset($_POST['login'])){
$username = $_POST['username'];
$password = $_POST['password'];
if(!empty(($username) && ($password))){


put other code here
}
}

No way I'm reading all those lines of script.  Please answer the following items.

 

1.  What error messages (if any) are you getting?

2.  What line do you think the error is on?

3.  What output (if any) are you getting?

4.  What are you expecting to happen?

5.  What is actually happening?

6.  What have you done to troubleshoot the problem so far?

<?

 

include("html.php");

if (isset($_POST['login'])){

$username = $_POST['username'];

$password = $_POST['password'];

if(!empty($username) && !empty($password)){

 

 

 

$user = mysql_fetch_array(mysql_query("SELECT id,status,code,email,ip FROM $tab[user] WHERE username='$username' AND password='$password';"));

 

 

 

    if($user[1] == banned){ header("Location: login.php?reason=banned&code=$user[2]"); }

 

elseif($user[1] == unverified){ header("Location: confirm.php?email=$user[3]"); }

 

elseif($user)

 

      {

 

      $host=gethostbyaddr("$REMOTE_ADDR");

 

      mysql_query("UPDATE $tab[user] SET online='$time', ip='$REMOTE_ADDR', lastip='$user[4]', host='$host' WHERE id='$user[0]';");

 

 

 

      setcookie("trupimp",$user[2]);

 

 

 

      header("Location: play.php");

 

      }

 

  else{ header("Location: login.php?reason=invalid"); }

 

}

 

 

 

 

 

if($reason==banned){

 

$banned = mysql_fetch_array(mysql_query("SELECT reason FROM $tab[user] WHERE code='$code';"));

 

}

 

 

 

siteheader();

 

?>

 

<style type="text/css">

 

<!--

 

.login3 {

 

font-size: 10px;

 

color: #FFFFFF;

 

border-top: 1px solid #33FF00;

 

border-right: 1px solid #33FF00;

 

border-bottom: 1px solid #33FF00;

 

border-left: 1px solid #33FF00;

 

background: #20211D;

 

width: 153px;

 

}

 

 

 

-->

 

</style>

 

<style type="text/css">

 

<!--

 

.login4 {

 

font-size: 10px;

 

color: #FFFFFF;

 

border-top: 1px solid #33FF00;

 

border-right: 1px solid #33FF00;

 

border-bottom: 1px solid #33FF00;

 

border-left: 1px solid #33FF00;

 

background: #20211D;

 

width: 73px;

 

}

 

 

 

-->

 

</style>

 

  <table width="100%" height="100%">

 

    <tr>

 

    <td height="12"><b><?=$sitename?> Login</b></td>

 

    </tr>

 

    <tr>

 

    <td align="center" valign="top">

 

    <form method="post" action="login.php">

 

    <br>

 

    <?if($reason==banned){?><b><font color="89B93A">Your account has been banned...</font><br><br>Reason: <?=$banned[0]?><br><br><font color="#89B93A">you MAY NOT create another account. If we see you here again, you will be frozen

 

whether your cheating or not.</font></b><br><br><?}?>   

 

    <?if($reason==invalid){?><b><font color="89B93A">Invalid login attempt from </font><?=$REMOTE_ADDR?></b><br><br><?}?>

 

    <?if($reason==notlogged){?><b><font color="89B93A">You must login before you can access this page</font></b><br><br><?}?>

 

    <?if($reason==idle){?><b><font color="89B93A">You have been logged out for idling</font></b><br><br><?}?>

 

    <?if($reason==logout){?><b><font color="89B93A">Slap ya later bitch!</font></b><br><br><?}?>

 

    <table>

 

      <tr>

 

      <td align="right">Username:</td><td>

 

<input type="text" class="login3" name="username" size="20" maxlength="15"></td>

 

      </tr>

 

      <tr>

 

      <td align="right">Password:</td><td>

 

<input type="password" class="login3" name="password" size="20" maxlength="15"></td>

 

      </tr>

 

      <tr>

 

      <td align="right" colspan="2"><input type="submit" class="login4" name="login" value="login"></td>

 

      </tr>

 

    </table>

 

    <br>Not a Mobster? <a href="signup.php">Become One!</a>, its <b>free!</b>

 

    <br>Lost your password? <a href="lostpass.php">click here</a>.

 

    </form>

 

    </td>

 

    </tr>

 

  </table>

 

<?

 

sitefooter();

 

?>

What error messages (if any) are you getting?

Parse error: syntax error, unexpected '(', expecting T_STRING or T_VARIABLE or '$' in /home/anarchy3/public_html/index.php on line 6

What are you expecting to happen?

Its Suppose to go to play.php

What is actually happening?

Looping before the error

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.