I have a sign in page, and If the sign in is unsuccessful, it should display the error
message in the same page.... How will I do that? I have my codes here:
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body background="rPanel/Sun-anan/vvltgrayparch.jpg" >
<center><font face="Arial Narrow">
<form name="login" method="post" action="signin.php">
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<?php
$errormessage = $_SESSION['errormessage'];
echo $errormessage;
?>
<table width="10%" border="7" bordercolor="#339966" cellspacing="0" cellpadding="0" align="center">
<tr>
<td colspan="2" align="center" > <img src="buttons/btn4.jpg" width="212" height="31"></td>
</tr>
<tr>
<td>username:</td>
<td> <input type="text" name="username">
</tr>
<tr>
<td>password:</td>
<td> <input type="password" name="password">
</tr>
<tr>
<td colspan="2" align="right" background="rPanel/Buttons/btn2.jpg" ><div align="center"><font face="Arial Narrow">
<input type="submit" name="Submit" value="Submit">
</font> </div></tr>
</table>
</form>
<p><font color="#000000" size="+1">Create your account <a href="signup.php" target="_blank">here</a>.</font></p>
</font>
<p> </p>
<p><font color="#000000" size="+1"><br>
<font face="Arial Narrow">Upload your IT Projects instantly!<br>
<a href="procedures.php"target="_blank"> Here's</a> how. </font></font></p>
<p>
</center>
</body>
</html>
and this is signin.php
Code: Select all
<?php
session_start();
include "dbconnection.php";
mysql_select_db("itproject",$link);
$_SESSION['uname'] = $_POST['username'];
$_SESSION['pass'] = $_POST['password'];
if($_SESSION['uname']=="" || $_SESSION['pass']=="")//y gi.input
{
echo ("<meta http-equiv='Refresh' content='0;url=index.php'>");
$errormessage = 'Please put something on the fields.';
}
else{
$result = mysql_query("SELECT * FROM pending WHERE gid='".$_SESSION['uname']."' AND password='".$_SESSION['pass']."'");
$number = mysql_num_rows($result);
if($number!=0)
{
echo ("<meta http-equiv='Refresh' content='0;url=multiple_upload.php'>");
}
else
{
$errormessage = "Wrong username or password.";
echo ("<meta http-equiv='Refresh' content='0;url=index.php'>");
}
}
?>
Please correct my codes.... thanks...