PHP Code Website Login

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
zabidin2
Forum Newbie
Posts: 1
Joined: Thu Oct 13, 2011 6:22 am

PHP Code Website Login

Post 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.
User avatar
egg82
Forum Contributor
Posts: 156
Joined: Sat Oct 01, 2011 9:29 pm
Location: Colorado, USA

Re: PHP Code Website Login

Post 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
Post Reply