hi there i am looking for just a login script to connect to a database, and send the user to a seperate user page. I have looked around on the internet and all the examples i seem to find never work for some random reason or another.
i have a registration script and datbase set up (all details below).
I would love a script or some help in making a sript asap as its driving me loopy.
thanks
Eric
MySql database
Username = madashat_eric
Password = *******
database name = madashat_users
Table name = users
Table =
CREATE TABLE `users` (
`name` VARCHAR( 36 ) NOT NULL ,
`dob` VARCHAR( 10 ) NOT NULL ,
`email` VARCHAR( 36 ) NOT NULL ,
`website` VARCHAR( 72 ) NOT NULL ,
`username` VARCHAR( 36 ) NOT NULL ,
`password` VARCHAR( 36 ) NOT NULL
);
Login Script
Moderator: General Moderators
- ericburnard
- Forum Contributor
- Posts: 104
- Joined: Wed Jun 15, 2005 5:11 pm
- Location: Chesterfield, UK
ok, so create an html form that asks for username and password:
then check against the database to make sure the credentials are valid:
Code: Select all
<form name="e;MyForm"e; action="e;validation.php"e; method="e;post"e;>
<input type="e;text"e; name="e;username"e;><br>
<input type="e;password"e; name="e;password"e;><br>
<input type="e;submit"e; value="e;login"e;>Code: Select all
$query = "e;select * from users where username = '"e;.mysql_real_escape_string($_POSTї'username'])."e;' and password = '"e;.mysql_real_escape_string(md5($_POSTї'password']))."e;'"e;;
$result = mysql_query($query)
or die(mysql_error());
if($row = mysql_fetch_assoc($result))
// valid stuff so send them somewhere else
else
header(Location: login.php);