|
-
Apr 3rd, 2004, 11:41 PM
#1
Thread Starter
Frenzied Member
Auth page
Hi All,
As you can see I've finally got my signup.php page working, I want to have a login.php page.
I've looked around hotscripts ect for a script but am not having any luck. I guess it will go something like this
PHP Code:
<?php
mysql_connect (localhost, user, password);
mysql_select_db (nz);
$qry = mysql_query("SELECT user_name, user_password FROM DB_Users");
$arr = mysql_fetch_array($qry);
if ($_POST['action'] == 'save') {
if($_POST['user_name'] == $_POST ['user_name']){
\\ set cookie information
}
}else{
echo "Your passwords don't match.";
}
} else {
?>
this is way wrong but does anyone have a basic code that will help me??
-
Apr 4th, 2004, 05:00 AM
#2
In your code you're comparing one value to itself.. nothing's going to happen.
This should work for you:
Code:
<?php
mysql_connect ('localhost', 'user', 'password');
mysql_select_db ('nz');
$qry = mysql_query("SELECT user_name FROM DB_Users WHERE user_name='$_POST[user_name]' AND user_password='$_POST[user_password]';");
$arr = mysql_fetch_array($qry);
if($_POST['action'] == 'save'){
if($arr[0] != ""){
echo "Authenticated.\n";
//set cookie information
}else{
echo "The server could not authenticate your account information.\n";
}
}else{
echo "stuff for action that isn't 'save'\n";
}
?>
-
Apr 4th, 2004, 07:53 AM
#3
Stuck in the 80s
If this is for a login page, why is action 'save'?
-
Apr 4th, 2004, 03:01 PM
#4
Thread Starter
Frenzied Member
Originally posted by The Hobo
If this is for a login page, why is action 'save'?
it's a copy paste from the signup page, action maybe login
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|