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
Please help me
Moderator: General Moderators
Re: Please help me
What error/s it show?
-
anamika12345
- Forum Newbie
- Posts: 5
- Joined: Fri May 09, 2008 3:31 am
Re: Please help me
it is not validate the data hence just refresh the login page . no error
Re: Please help me
I think because of this...anamika12345 wrote:it is not validate the data hence just refresh the login page . no error
check this part again... you don't have $_GET['link'] because you use POST methodif($_GET['link'])
header("location:uname.php?link=$_GET[link]");
else
header("location:your_detail.php");
Re: Please help me
try putting a print mysql_error();
after the query is executed
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'";
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();
$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'";