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.
Login, Register script
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Login, Register script
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?
(#10850)
- Josh1billion
- Forum Contributor
- Posts: 316
- Joined: Tue Sep 11, 2007 3:25 pm
Re: Login, Register script
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).
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).
- hannnndy
- Forum Contributor
- Posts: 131
- Joined: Sat Jan 12, 2008 2:09 am
- Location: Iran>Tehran
- Contact:
Re: Login, Register script
you can use this as a guide i think it will help you a lot
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
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>";
}
?>
google is your friend
look at this url too http://us3.php.net/features.http-auth
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: Login, Register script
Moved to PHP - Code since this started taking on coding and programming related content.