Field Type Collation Attributes Null Default
tusername varchar(30) latin1_swedish_ci Yes NULL
password varchar(15) latin1_swedish_ci Yes NULL
according to mysqladmin
i have code as
Code: Select all
<?php
ob_start();
$page_title = 'Login';
if (isset($_POST['submit'])) {
require_once('../mysql_connect1.php');
if (empty($_POST['tusername'])) { //
$u = FALSE;
echo '<p><font color="red" size="+1">You forgot to enter your username!</font></p>';
} else {
$u =escape_data($_POST['tusername']);
}
if (empty($_POST['password'])) {
$p = FALSE;
echo '<p><font color="red" size="+1">You forgot to enter your password!</font></p>';
} else {
$p = escape_data($_POST['password']);
}
if ($u && $p) {
$query = "SELECT teach_id,tusername FROM teachers WHERE tusername='$u' AND
password=PASSWORD('$p')";
$result = @mysql_query ($query);
$row = mysql_fetch_array ($result);
if ($row) {
session_start();
$_SESSION['tname'] = $row[1];
$_SESSION['teach_id'] = $row[0];
ob_end_clean();
header ("Location:
http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/disteachers.php?uid=".$row['teach_
id'].""); exit();
} else {
// No match was made.
echo '<p><font color="red" size="+1">The username and password entered do not match
those on file.</font></p>';
}
mysql_close(); // Close the database connection.
} else { // If everything wasn't OK.
echo '<p><font color="red" size="+1">Please try again.</font></p>';
}
} // End of SUBMIT conditional.
?>
<center><h1>Login</h1> </center>
<table border="1" width="100%" bordercolor="#0000FF" bordercolorlight="#0000FF"
bordercolordark="#0000FF" cellpadding="3">
<tr>
<td width="100%">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<p align="center"> <b>Add Students</b></p>
<table border="0" width="100%" bgcolor="#EFEFEF" cellspacing="1" cellpadding="3">
<tr>
<td width="100%" colspan="2" bgcolor="#00659C">
<p align="center"><b> <font color="#FFFFFF">Teacher's Login</font></b></td>
</tr>
<tr>
<td width="59%"><b>UserName </b></td>
<td width="41%"><input type="text" name="tusername" size="10"
maxlength="20" value="<?php if (isset($_POST['tusername'])) echo $_POST['tusername']; ?>" /></td>
</tr>
<td width="59%"><b>Password</b></td>
<td width="41%"><input type="password" name="password" size="20" maxlength="20"
/></td>
</tr>
</table>
<p><div align="center"><input type="submit" name="submit" value="Login" /></div> </p>
</form>
</td>
</tr>
</table>The username and password entered do not match those on file.
whats the matter
other login are running well....in another tables...(ie students)
please help
rami