MD5 encryption problems

This is a multi-part message in MIME format.

------=_NextPart_000_0005_01C6698B.64E7EED0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi, all I was trying to add md5 encryption to all of my scripts that
needed username and password info entered into the db well every thing
goes smoothly until I try and login.

I encrypt it when it goes in and before I check it after I sent the
login information I encrypted it again but yet it still will not check
right it wont veryify that the information is fright for instance.

<?

//////// login example ////////

Include ("config.php');

$user = $_POST["user"];

$pass = $_POST["pass"];

$pass = md5($pass);

$login = mysql_query("SELECT * FROM admin_guestbook WHERE
username='$user' AND password='$pass'");

$login_check = mysql_num_rows($login);

if($login_check > 0){

session_register('user');

$_SESSION['user'] = $user;

session_register('password');

$_SESSION['pass'] = $pass;

header ("Location:admin_page.php");

}

else {

print "You are not logged in You entered the wrong username
and password combination please try again";

include "admin.php";

}

?> and when I run the check it wont login



Frank R. Jr.




------=_NextPart_000_0005_01C6698B.64E7EED0
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:Arial;
color:windowtext;}
[at] page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Hi, all I was trying to add md5 encryption to all of =
my
scripts that needed username and password info entered into the db well =
every
thing goes smoothly until I try and login.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>I encrypt it when it goes in and before I check it =
after I sent
the login information I encrypted it again but yet it still will not =
check
right it wont veryify that the information is fright for =
instance.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><?<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>//////// login example =
////////<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Include =
(“config.php’);<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>$user =3D =
$_POST[“user”];<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>$pass =3D =
$_POST[“pass”];<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>$pass =3D md5($pass);<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>$login =3D mysql_query("SELECT * FROM =
admin_guestbook
WHERE username=3D'$user' AND =
password=3D'$pass'");<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>$login_check =3D =
mysql_num_rows($login);<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>if($login_check > 0){<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>         =
   session_register('user');<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>         =
   $_SESSION['user'] =3D $user;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>         =
   session_register('password');<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>         =
   $_SESSION['pass'] =3D $pass;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>         =
   header =
("Location:admin_page.php");<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>         =
   }<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>         =
   else {<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>         =
   print "You are not logged in You entered
the wrong username and password combination please try =
again";<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>         =
   include "admin.php";<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>         =
   }<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>?> and when I run the check it wont =
login<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Frank R. Jr.</span></font><o:p></o:p></p>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><o:p> </o:p></span></font></p>

</div>

</body>

</html>

------=_NextPart_000_0005_01C6698B.64E7EED0--
Frank R [ Do, 27 April 2006 06:44 ] [ ID #1292187 ]

Re: MD5 encryption problems

I assume the form has attribute method="post" and not method="get"
other than that I would say that it should work assuming you give the
correct password. You do realise that you have made the passwords case
sensitive I assume. Perhaps the conversion from non-md5'd passwords to
md5 passwords went wrong?

Also, put a die() after header, in case it ever goes wrong, and you put
more code at the bottom of the page.
richard.a.fletcher [ Do, 27 April 2006 10:25 ] [ ID #1292188 ]

Re: MD5 encryption problems

Well what happens is it doesn't really show any errors it just goes
straight to the username is invalid and the info is 100% correct.
Frank R. Jr.

-----Original Message-----
From: richard.a.fletcher [at] googlemail.com
[mailto:richard.a.fletcher [at] googlemail.com]
Posted At: Thursday, April 27, 2006 3:26 AM
Posted To: alt.php.sql
Conversation: MD5 encryption problems
Subject: Re: MD5 encryption problems

I assume the form has attribute method="post" and not method="get"
other than that I would say that it should work assuming you give the
correct password. You do realise that you have made the passwords case
sensitive I assume. Perhaps the conversion from non-md5'd passwords to
md5 passwords went wrong?

Also, put a die() after header, in case it ever goes wrong, and you put
more code at the bottom of the page.
Frank R [ Do, 27 April 2006 23:51 ] [ ID #1292190 ]
PHP » alt.php.sql » MD5 encryption problems

Vorheriges Thema: How to set decimal separator?
Nächstes Thema: Re: Update a counter when a link is clicked