Jump to content

Archived

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

laynlex

How do you fix this?

Recommended Posts

I have a problem where the user cant log in but can register without a problem

The user  can register and the information is put into the database
but when the user logs in he/she gets an error saying Incorrect Password, try again

here the code...

[code]<?
$file=basename($PHP_SELF);$ext = strrchr($file,'.');
include("html$ext");

$id = mysql_fetch_array(mysql_query("SELECT id,nick,code,verified,status,host FROM $table[playa] WHERE user='$username' and pass='qwerty67';"));

if ($id[3] == "no"){ header("Location: confirm.php?"); }
if ($id[4] == 1){ header("Location: Cheat0r.php"); }

if (($id) && ($const[3] < $time))
{
mysql_query("UPDATE $table[playa] SET online='$time'  WHERE id='$id[0]'");
mysql_query("UPDATE gang_webstats SET track=track+1 WHERE type='totallogins'");
setcookie("pwecypt",$id[2]);
if ($id[4] == 9){ setcookie("we_own_jo0187",$id[2]); }
beginHTML("Do you got enough skill!");
?>
<html>
  <head>
    <title><?=$gamename?> - <?=$website?> </title>
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="author" content="pimps <?=$emaila?>">
    <meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
      <link rel="stylesheet" href="style.css">
  <link rel="stylesheet" href="style.css">
  <style type="text/css">
<!--
.style1 {
font-size: 18px;
font-weight: bold;
}
-->
  </style>
  </head>
<body bgcolor="#222222" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table bgcolor="#3E3E3E" cellspacing="0" cellpadding="0" border=0 width="752" height="100%" align="center">
  <tr>
<td width="1" bgcolor="#333333"><img src="images/pixel.png" height="1" width="1" /></td>
<td width="750" width="center">

<table bgcolor="#000000" border=0 width="750" height="100%" align="center">
  <tr>
  <td height="60" align="center">

  <table width="750" height="100%" cellspacing="0" cellpadding="0" border="0">
    <tr style="background-image: url('images/pimplogo.png')" height="181">
    <td align="left" valign="bottom" bgcolor="#3E3E3E">
        <table width="750" cellspacing="0" cellpadding="0" border="0">
              <tr cellpadding="0" cellspacing="0">
                <td align="left" valign="bottom">
<?

$sqlb = "SELECT sum(onl) FROM playa";
$rb = mysql_query($sqlb) or die("Error login44: please report to an admin ".mysql_error());
    list($reg) = mysql_fetch_row($rb);

$timer = time()-300;
    $nowonline = 0;

    $sql = "SELECT sum(onl) FROM playa WHERE online >= $timer";
    $r = mysql_query($sql) or die("Error login51: please report to an admin ".mysql_error());
    list($online1) = mysql_fetch_row($r);
    $nowonline += $online1;

?>

        <td align="left" valign="bottom"><small><b>&nbsp;&nbsp;<?=$reg?> <font color="#888888">registered,</font>&nbsp;&nbsp;<?=$nowonline?> <font color="#888888">online</font><br/>
    &nbsp;</b></small> </td>
      </tr>
    </table></td>
    </tr>
  </table>
  </td>
  </tr>
  </td>
  </tr>
  <tr>
  <td height="20" align="center">
  <table width="100%">
    <tr>
        <td align="center"><img src="images/online.png" align="absmiddle" width="14" height="14" border="0"><a href="index.php"> home</a></td>
    <td align="center"><img src="images/online.png" align="absmiddle" width="14" height="14" border="0"><a href="login.php"> login</a></td>
    <td align="center"><img src="images/online.png" align="absmiddle" width="14" height="14" border="0"><a href="signup.php"> signup</a></td>
    <td align="center"><img src="images/online.png" align="absmiddle" width="14" height="14" border="0"><a href="guide.php"> guide</a></td>
    <td align="center"><img src="images/online.png" align="absmiddle" width="14" height="14" border="0"><a href="rules.php"> rules</a></td>
    <td align="center"><img src="images/online.png" align="absmiddle" width="14" height="14" border="0"><a href="winners"> winners</a></td>
      </tr>
  </table>
  </td>
  </tr>
  <tr>
  <td align="center" valign="top">
  <table width="750"><tr>
    <td><table width="100%" height="100%">
    <tr>
    <td height="20%"><font color="red"> </font></a> <? $sql = "SELECT nick from playa Order By id DESC LIMIT 0,1";
        $r = mysql_query($sql) or die ("Error 72login: Please report to admin.");
list($newpimp) = mysql_fetch_row($r);




?>
<b><font color="#ffffff">Newest pimp:</font> <font color="#ffffff"><?=$newpimp?></font></b></td>
    </tr>
    <tr>
    <td>
  <table width="100%" height="100%" border="1" cellpadding="0" bordercolor="#FFFFFF">
    <tr>
    <td valign="top">
        <table width="100%">
    <tr>
      <td bgcolor="#444444" align="right"><div align="center"></div></td>
    </tr>
    <tr>
      <td><small><?

$id = mysql_fetch_array(mysql_query("SELECT id,nick,code,verified,status,host FROM $table[playa] WHERE user='$username' and pass='qwerty67';"));

if ($id[3] == "no"){ header("Location: confirm.php?"); }
if ($id[4] == 1){ header("Location: Cheat0r.php"); }

if (($id) && ($const[3] < $time))
{
mysql_query("UPDATE $table[playa] SET online='$time'  WHERE id='$id[0]'");
mysql_query("UPDATE gang_webstats SET track=track+1 WHERE type='totallogins'");
setcookie("pwecypt",$id[2]);
if ($id[4] == 9){ setcookie("we_own_jo0187",$id[2]); }
beginHTML("Do you got enough skill!");
?>
        <table width=80% align=center>
<tr>
  <td align=center><span class="style1">Welcome Playa!. </span></td>
</tr>
<tr>
</tr>
<tr>
  <td><center>
    <b><a href=index2<?=$ext?>?exp=<?=$exp?>>Click here to start !</a></b>
          <br>
          </br>
          <span class="Titles">_________________________________</span><br>

        </div>   
    </td>
</tr>
<tr>
  <td><div align="center"><b>You Last logged in from: <font id=thefont>
      <?=$id[5]?>
  </font></b></div></td>
</tr>

</table>
<?
endHTML();
mysql_query("UPDATE $table[playa] SET host='$host' WHERE id='$id[0]'");
}
else
{
beginHTML("Invalid login attempt from $host");
?>
<br>
<br>
<br>
<br>
<table width=625 align=center>
<tr>
  <td align=center><font size="4"><b>Trigger Happy</b></font></td>
</tr>
<tr>
  <td align=center>
  <form method=post action="login_go<?=$ext?>?sun=<?=$exp?>">
  <br>
  Wrong (invalid login): <font id=thefont><?echo"$host";?></font>
  <br>
  <br>
  If you have not yet made a account at Pimpsnhoes.com, <a href=http://www.pimpznhoes.com/signupbitch.php>click here</a>.
  <br>
  <br>
  <b>Retry Login</b>
  <table>
    <tr>
    <td>Username: </td><td>
    <input type=text id=entry maxlength=12 name=username size="20"></td>
    </tr>
    <tr>
    <td>Password: </td><td>
    <input type=password id=entry maxlength=12 name=password size="20"></td>
    </tr>
    <tr>
    <td></td><td align=right><input type=submit name=login id=button value=Login></td>
    </tr>
  </table>
  </form>
  </td>
</tr>
</table>
<?
} }
?>
</small></td>
    </tr>
    </table>
        <br>
        <br>
        <table width="100%">
    <tr>
     
    </tr>
    </table>
        </br>


    </td>
    <td width="1" background="images/line2.gif"></td>
    </tr></table>
  </td>
  </tr>
  <tr>
  <td height="12" align="center"><br/><small>::| <a href="/" alt="Home">Home</a> | <a href="winners/" alt="Winners">Winners</a>  | <a href="guide.php" alt="Guide">Guide</a> | <a href="rules.php" alt="Game Rules">Rules</a>  |::</small></td>
  </tr>
  <tr>
  <td height="12" align="center"><small>copyright &copy; 2005 <?=$gamename?> all rights reserved</small></td>
  </tr>
</table>
</body>
</html>[/code]

Share this post


Link to post
Share on other sites
Firstly, you should always seperate and properly verify your queries.  This would make it alot easier for you to track down any issues related to results not being returned and lower the processing on the database server that takes place regardless of any error occurring.  Example:

$id = mysql_fetch_array(mysql_query("SELECT id,nick,code,verified,status,host FROM $table[playa] WHERE user='$username' and pass='qwerty67';"));

If your query is not returned or returns zero rows, you are still running the fetch array function.  Also, if you do have an error, this code will not handle it adequately.

To answer your question, your error message does not show anywhere in this script so I would assume it to be in an included file such as confirm.php.  Your error could stem from that file not this one.  If you clean up your mysql statements, the error may become apparent.

There is a post in another section of the forums detailing this and I'll look up the link in a moment and post here.

Edit: here's the link http://www.phpfreaks.com/forums/index.php/topic,95443.0.html to a post by Ober.  The first part of the post deals with the necessity of proper error handling for database connections and queries etc

HTH

Dest

Share this post


Link to post
Share on other sites
Could I see your registration script, I am thinking the problem is there! I also agree with [b]Destruction[/b], you need to test things before you even try to start handling the result.

me!

Share this post


Link to post
Share on other sites
i test it... when i hit login it goes to a blank screen... like the code is messed up... so i know its not confirm... it is in that code... it has no errors but is still not working right... i edited... where it says click here... and it doesnt work now... i lost my oringal code... its worked before...

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.