Page 1 of 1
Login, Register script
Posted: Tue Jan 22, 2008 4:23 pm
by tecmeister
Hi everyone,
Im new to php.
I would like to know how to create a login register page. Like the register page on this website.
I have look at some toturials, but they either have login or register.
Would some please be able to show me a tutorial or give me advice on how to do it.
Thankyou very much for the help that you be able to give me.
Re: Login, Register script
Posted: Tue Jan 22, 2008 6:45 pm
by Christopher
There are two main parts to this 1) authenticating the user via a login form and 2) having access controls on pages to prevent users without permission to view the page. Which would you like to implement first?
Re: Login, Register script
Posted: Fri Jan 25, 2008 7:47 pm
by Josh1billion
Register page:
1. Make a page "register.php"
2. It should contain an HTML form which submits to register.php (itself). Only print the form if the form has not been submitted.
2. If the form has been submitted, insert the username/password/etc. as a new row in your "users" table.
Login page:
1. Make a page "login.php"
2. It should contain an HTML form (login form) which submits to login.php (itself). Only print if the form has not been submitted.
3. If the form has been submitted, check the username/password and if they're correct, store a cookie (or if you prefer, start a session-- cookies are potentially more simple).
Re: Login, Register script
Posted: Sat Jan 26, 2008 12:30 am
by hannnndy
you can use this as a guide i think it will help you a lot
Code: Select all
<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Text to send if user hits Cancel button';
exit;
} else {
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
}
?>
it would help you if you dont want any html form
google is your friend
look at this url too
http://us3.php.net/features.http-auth
Re: Login, Register script
Posted: Mon Jan 28, 2008 11:27 am
by RobertGonzalez
Moved to PHP - Code since this started taking on coding and programming related content.