login error

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 22
Joined: Fri Jun 22, 2012 9:14 am

login error

Post by BandanaChaudhury » Tue Jan 22, 2013 11:24 pm

i an having a login form

$adminpwd = md5($_POST['adminpwd']);
$enter = $_POST['enter'];
$servername = "localhost";
$username = "root";
$password = "";
if ($enter)
$connect = mysql_connect($servername, $username, $password) or die(mysql_error());
mysql_select_db("bctravels") or die(mysql_error());
$query = mysql_query("SELECT admin_pwd FROM admin");
$numrows = mysql_num_rows($query);
while ($rows = mysql_fetch_assoc($query))
$db_admin_pwd = $rows['admin_pwd'];
if ($adminpwd==$db_admin_pwd)
echo "/////";
echo "...";
<link href="../admin/admin.css" rel="stylesheet" type="text/css" />
<title>Administration password check</title>
<h3>You're the Administrator</h3>
<form action='admin_pwd.php' method='POST'>
Enter Admin Password,
<input type='password' name='adminpwd'>
<input type='submit' name='enter' value='enter'>

I dont know why the $adminpwd and $db_admin_pwd doesnot match,
is there any error in my coding,
please help. :help: :help: :help:

User avatar
php-forum Active User
php-forum Active User
Posts: 300
Joined: Sun Dec 11, 2011 12:51 am
Location: Shrewsbury, Shropshire

Re: login error

Post by simplypixie » Wed Jan 23, 2013 12:47 am

Firstly, are you sure the password in the database is encoded with MD5? Why not echo out the posted password and the password you are getting from your query and double check they do match.

On a second note, why on earth would you want to store a password in your session - very insecure?

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests