Hello,
i am trying to implement user name and password check from my table and if they match, the user will be redirected to main.php else he stays over there.
I worked with a simple two textboxes to enter user name and password and then with a submt button.It was working fine.Now, i implemented the same code to my complicated log in page, it is'nt working.could somebody pls tell me where is the error?
<?php
include "dbconnection.inc";
include "main_functions.inc";
$p_main = new main_functions;
if ($language_f != "")
$p_main->set_system_language($language_f);
$p_main->get_language_phrases('LOGIN');
$sql = "SELECT count(*) as cnt from TBL_USER WHERE USER_NAME = '$sess_user_f' AND USER_PASSWORD = '$sess_pass_f'";
$result = ibase_query($sql);
$row = ibase_fetch_row($result);
if ($row[0]) {
header('Location: main.php');
exit;
} else {
echo"<form action=\"$PHP_SELF\" method=\"POST\">\n";
}
?>
<head><title>Login</title>
<link rel="stylesheet" type="text/css" href="formate.css">
</head>
<body>
<form method="post">
<table width="100%" height="100%" border="2">
<tr>
<td>
<center>
<table bgcolor="#E0E0E0" border="2">
<tr>
<td>
<table bgcolor="#E0E0E0" width="320">
<tr height="23" width="100%">
<td background="images/img_title.gif"><b><font color="#FFFFFF">
<?php
echo "{$p_main->a_system_textphrases_m[TXT_LOGIN]}";
?>
</b></font></td>
</tr><tr>
<td align="right">
<?php
echo ("
<a href =\"index.php?language_f=ENG\" target=\"_self\">
<img src=\"images/ban_english.gif\" alt=\"{$p_main->a_system_textphrases_m[TXT_SETENGLISH]}\" name=\"btn_gersel\" width=\"46\" height=\"25\" border=\"0\">
</a>");
echo ("<a href =\"index.php?language_f=SPA\" target=\"_self\">
<img src=\"images/ban_spanish.gif\" alt=\"{$p_main->a_system_textphrases_m[TXT_SETSPANISH]}\" width=\"46\" height=\"25\" border=\"0\">
</a>");
echo ("<a href =\"index.php?language_f=FRE\" target=\"_self\">
<img src=\"images/ban_french.gif\" alt=\"{$p_main->a_system_textphrases_m[TXT_SETFRENCH]}\" width=\"46\" height=\"25\" border=\"0\">
</a>");
?>
</td></tr><tr><td>
<?php
echo "{$p_main->a_system_textphrases_m[TXT_INTRO]}";
?>
<br><br>
</td>
</tr>
</table>
<table bgcolor="#E0E0E0" width="320">
<tr>
<td>
<?php
echo "{$p_main->a_system_textphrases_m[TXT_USERNAME]}";
?>
</td>
<td align="right"><input type="text" name="sess_user_f" value="" maxlength="99" size="25"></td>
</tr>
<tr>
<td>
<?php
echo "{$p_main->a_system_textphrases_m[TXT_PASSWORD]}";
?>
</td>
<td align="right"><input type="password" name="sess_pass_f" maxlength="255" size="25"></td>
</tr><input type="hidden" value="1" name="login_try">
</table>
<div align="center">
<br>
<table>
<tr>
<td><input type="submit" value="Log in" style="position: relative; width: 150;"></td>
</form><form method="post">
<td><input type="submit" value="Change password" style="position: relative; width: 150;"></td>
<input type="hidden" value="1" name="login_changepass">
</tr></form>
</table>
</div>
</td>
</tr>
</table>
</center>
</td>
</tr>
</table>
</form>
</body></html>