PHP Problem/Ad Problem

jasgor9

New Member
Messages
40
Reaction score
0
Points
0
PHP Problem: i have a php login script that always says the password is incorrect:

PHP:
$username = $_POST['username'];
$password = md5($_POST['password']);

mysql_connect("localhost", "username", "password");
mysql_select_db("jasgor9_memberdata");

$chk = mysql_query("SELECT * FROM memberdatatable WHERE Username = '$username'");

if($password==$memArray['Password']) {
setcookie("MemberCookie", $username, time()+3600);
header("Location: membersarea.php");
}
else
{
header("Location: wrong.php");
}

Ad problem: the ads on my site are making the loading slow. any ideas besides iframes that could fix this?
 
Last edited:

LHVWB

New Member
Messages
1,308
Reaction score
0
Points
0
PHP:
$chk = mysql_query("SELECT * FROM memberdatatable WHERE Username = '$username'");

if($password==$memArray['Password']) {
setcookie("MemberCookie", $username, time()+3600);
header("Location: membersarea.php");
}
else
{
header("Location: wrong.php");
}
I think your problem is the $memArray variable, where do you get it from?
Try Replacing that with this.

PHP:
$chk = mysql_query("SELECT * FROM memberdatatable WHERE Username = '$username'");
 
if ($chk && mysql_num_rows($chk))
 {    
            while ($row = mysql_fetch_assoc($chk)) 
           { 
                  if($row['password'] == $password)
                 {
                           setcookie("MemberCookie", $username, time()+3600);
                           header("Location: membersarea.php");
                 }
                 else
                           header("Location: wrong.php");
           }
 }
 
Top