Forum Moderators: coopster
if(isset($user) && isset($pass))
{
$db=mysql_connect('localhost','root','');
if(!$db)
{
echo "Cannot connect to database";
exit;
}
$result=mysql_select_db('reiki', $db);
if(!$result)
{
echo "Cannot Select database";
exit;
}
$query="select user from auth where user='$user' and pass=password('$pass')";
#$query="insert into auth values('$user',password('$pass'))";
$result = mysql_query($query, $db) or die('Query failed. '.mysql_error());
if(mysql_num_rows($result) > 0)
{
session_register('valid_user');
$valid_user = $user;
}
}
if(isset($valid_user))
{
echo "Welcome to the Admin Panel";
echo '<br><a href="check_new_form.php">Check New Entries</a>';
}
else
{
if(isset($user))
{
echo "Could Not log you In";
}
else
{
echo "You are not logged In";
}
?>
<form action='admin_login.php' method='post'>
<BR><BR><BR><table align='middle' valign='top' cellpadding='2' cellspacing='1' style='border-collapse: collapse'>
<tr>
<td border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium colspan='2'>
<p align='center'><font face='lucida sans unicode'>Administrator Login</font></td>
</tr>
<tr>
<td border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium><font face='lucida sans unicode'>Username:</font></td>
<td border-left-style: none; border-left-width: medium; border-bottom-style: none; border-bottom-width: medium><input type='text' name='user' size=20></td>
</tr>
<tr>
<td border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium><font face='lucida sans unicode'>Password:</font></td><td border-left-style: none; border-left-width: medium; border-bottom-style: none; border-bottom-width: medium><input type='password' name='pass' size=20></td>
</tr>
<tr>
<td colspan='2' align='center'><input type='submit' value='Log In'></td>
</tr>
</table>
</form>
<?php
}
?>
<p><a href="index.php">Home Page</a></p>
</body>
</html>
but it is still not working.
i did what you said. first i removed the session part (though not recommended). then i placed the
$user = $_POST['user'];
$pass = $_POST['pass'];
in the begining of the page. but things still not moving.
actually i first did the change in the php.ini of my system to put register_globals and to off then tried what you had suggested thought the things went right on my system (as before) but it didnt do on the clients server.
i need some more time of yours.
thanks in advance