Page 1 of 1

PHP Code Website Login

Posted: Thu Oct 13, 2011 6:42 am
by zabidin2
Hi,

After i searching using uncle Google and none of them meet my criteria so i decide to posting here. I have web site. And got a list of file. Basically got 2 different user to download a file, admin and regular user.

I want to store username and password that encrypted in mysql. Each time user visit the page they need to fill user name and password base on what in database. So, does anyone knows how to write coding.

My background is in networking. So i'm familiar with php coding. If using simple coding, i just search in the net and paste it. To me this is complicated coding. Please assist me. This is not assignment or task given any lecturer. This from my senior supervisor.

Thanks.

Re: PHP Code Website Login

Posted: Thu Oct 13, 2011 11:32 am
by egg82

Code: Select all

$result = mysql_query("SELECT * FROM `users` WHERE `username`='".$user."' AND `password`='".md5($pass)."';");
Simple one-liner to get you started. It's not perfect, but with the information given it's probably the best you can hope for

look up mysql_fetch_array(), mysql_query(), and md5() on that amazing resource, google