Jump to content


Photo

logining please help me


  • This topic is locked This topic is locked
4 replies to this topic

#1 chriscloyd

chriscloyd
  • Members
  • PipPipPip
  • Advanced Member
  • 489 posts
  • LocationArizona

Posted 04 July 2006 - 01:35 AM

<?
include("db_config.php");
$loginFormAction = $_SERVER['PHP_SELF'];

if (isset($_POST['username'])) {
  $username = $_POST['username'];
  $password = md5($_POST['password']);
$Login = mysql_query("SELECT username, password  FROM users WHERE username='$username' AND password='$password'");
   
   
  $LoginRS = mysql_query($Login) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
    $Loginadmin = mysql_query("SELECT username FROM admin WHERE username='$username'");
$LoginRSadmin = mysql_query($Loginadmin) or die(mysql_error());
$loginFoundadmin = mysql_num_rows($LoginRSadmin);
if ($loginFoundadmin) {
$GLOBALS['admin'] = $username;
session_register("admin");
}
$GLOBALS['username'] = $username;
session_register("username");
header("../index.php");
} else {
header("../index.php?p=sorry");
}
}
?>
thats my code
but i get this error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #4' at line 1
44 bugs in my java code
44 bugs in my java code
Fix 1 bug, and complie again
122 bugs in my java code

#2 micah1701

micah1701
  • Members
  • PipPipPip
  • Advanced Member
  • 613 posts
  • LocationEllington, CT USA

Posted 04 July 2006 - 01:45 AM

for starters, change
       $Loginadmin = mysql_query("SELECT username FROM admin WHERE username='$username'");
      $LoginRSadmin = mysql_query($Loginadmin) or die(mysql_error());

to

       $Loginadmin = "SELECT username FROM admin WHERE username='$username'";
      $LoginRSadmin = mysql_query($Loginadmin) or die(mysql_error());

see if that helps
"Confidence in the face of risk."

#3 chriscloyd

chriscloyd
  • Members
  • PipPipPip
  • Advanced Member
  • 489 posts
  • LocationArizona

Posted 04 July 2006 - 01:51 AM

and it wont redirect them to the index.php
44 bugs in my java code
44 bugs in my java code
Fix 1 bug, and complie again
122 bugs in my java code

#4 micah1701

micah1701
  • Members
  • PipPipPip
  • Advanced Member
  • 613 posts
  • LocationEllington, CT USA

Posted 04 July 2006 - 02:00 AM

and it wont redirect them to the index.php


header("../index.php");

headers do lots of stuff. one of them is forwarding, but you need to tell it to forward using "Location:"

header("Location: ../index.php");

"Confidence in the face of risk."

#5 chriscloyd

chriscloyd
  • Members
  • PipPipPip
  • Advanced Member
  • 489 posts
  • LocationArizona

Posted 04 July 2006 - 02:03 AM

thanks it works bye
44 bugs in my java code
44 bugs in my java code
Fix 1 bug, and complie again
122 bugs in my java code




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users