Page 1 of 1

Please help me

Posted: Fri May 23, 2008 3:26 am
by anamika12345
i want to pass the user name and password ,
but fails to validate ,this user id and password presenyt in the database
is there any problen in the coading ?
<?php
include("include/db.inc.php");
if($_POST['Image5'])
{ echo "validation";


$email=$_POST['textfield'];
$password=$_POST['textfield2'];
$sql="select id,password from table1where email='$email' and password='$password'";
$res=mysql_query($sql);
$rec=mysql_fetch_array($res);
if(mysql_num_rows($res) && ($rec['password']==$password))
{

echo $query4=mysql_fetch_array(mysql_query("SELECT id FROM table1 WHERE email='$email' and password='$password' and confirm='1' and blocked='0' and deactive='0'"));

if($query4['id'])
{
$_SESSION[id]=$query4['id'];

if($_GET['link'])
header("location:uname.php?link=$_GET[link]");
else
header("location:your_detail.php");
}
}
}
?>
<form name="loginform" method="post" action="login.php" onSubmit="return regvalid();">
<td align="left" valign="middle">
<a href="javascript:void(0);" onclick="javascript:document.loginform.submit();return false;><input type="image" img src="img/enter.gif" alt="Enter" name="Image5" width="73" height="20" border="0" id="Image5" /></a>
</td>
</form>
please hel;p me

Re: Please help me

Posted: Fri May 23, 2008 3:58 am
by mhonnphp
What error/s it show?

Re: Please help me

Posted: Fri May 23, 2008 4:04 am
by anamika12345
it is not validate the data hence just refresh the login page . no error

Re: Please help me

Posted: Fri May 23, 2008 4:19 am
by mhonnphp
anamika12345 wrote:it is not validate the data hence just refresh the login page . no error
I think because of this...
if($_GET['link'])
header("location:uname.php?link=$_GET[link]");
else
header("location:your_detail.php");
check this part again... you don't have $_GET['link'] because you use POST method

Re: Please help me

Posted: Fri May 23, 2008 5:02 am
by panic!
try putting a print mysql_error();
after the query is executed

Code: Select all

$email=$_POST['textfield'];
$password=$_POST['textfield2'];
$sql="select id,password from table1where email='$email' and password='$password'";
$res=mysql_query($sql);
$rec=mysql_fetch_array($res);
 
print mysql_error();
 
i suspect it's because there should be a space between table1 and where

$sql="select id,password from table1where email='$email' and password='$password'";

should be

$sql="select id,password from table1 where email='$email' and password='$password'";