i m trying to make login page ... while runing that i got one Fatal error i m not able to understand even i tried .......... guide me plz
here is :----
Fatal error: Call to undefined function: mysql_real_escape_string() in c:\apache\htdocs\newhr\checklogin.php on line 14
plz help me to solve it......
Mainform.html
<html>
<body bgcolor="E6E6FA">
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#fffff">
<tr>
<form name="form1" method="post" action="checklogin.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="FAFAFA">
<tr>
<td colspan="3"><strong>Member Login </strong></td>
</tr>
<tr>
<td width="78">Username</td>
<td width="6">:</td>
<td width="294"><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
</html>
checklogin
<?php
$host="localhost";
$username="root";
$password="root";
$db_name="master";
$tbl_name="member";
$con=mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$username=$_POST['username'];
$password=$_POST['password'];
$username = stripslashes($username);
$password = stripslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
$sql="SELECT * FROM $tbl_name WHERE username='$username' and password='$password'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
session_register("username");
session_register("password");
header("location:loginsucess.php");
}
else {
echo "Wrong Username or Password";
}
mysql_close($con);
?>
loginsucess
<HTML>
<HEAD>
<TITLE>New Document</TITLE>
</HEAD>
<BODY>
<?
session_start();
if(!session_is_registered(username))
{
header("location:loginform.html");
}
?>
<html>
<body>
Login Successful
</body>
</html>
logout
<HTML>
<HEAD>
<TITLE>logout</TITLE>
</HEAD>
<BODY>
<?
session_start();
session_destroy();
?>
</BODY>
</HTML>