Please help me

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
anamika12345
Forum Newbie
Posts: 5
Joined: Fri May 09, 2008 3:31 am

Please help me

Post 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
mhonnphp
Forum Commoner
Posts: 37
Joined: Fri Oct 12, 2007 11:29 pm
Location: Philippines
Contact:

Re: Please help me

Post by mhonnphp »

What error/s it show?
anamika12345
Forum Newbie
Posts: 5
Joined: Fri May 09, 2008 3:31 am

Re: Please help me

Post by anamika12345 »

it is not validate the data hence just refresh the login page . no error
mhonnphp
Forum Commoner
Posts: 37
Joined: Fri Oct 12, 2007 11:29 pm
Location: Philippines
Contact:

Re: Please help me

Post 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
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Re: Please help me

Post 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'";
Post Reply