The following tutorial will teach you how to add a login/register script to your site. This tutorial requires 6 files, and PHP with MySQL installed.
Simply upload all files to any directory, open connect.php and set the connection variables. After that simply run install.php once, and when it tells you it is installed, delete install.php
You can download all the files here. Install [install.php]
|
require_once("connect.php"); $query = mysql_query(" CREATE TABLE 'members' ( 'id' MEDIUMINT( 8 ) NOT NULL AUTO_INCREMENT , 'username' VARCHAR( 50 ) NOT NULL , 'firstname' VARCHAR( 50 ) NOT NULL , 'lastname' VARCHAR( 50 ) NOT NULL , 'password' VARCHAR( 50 ) NOT NULL , 'date' VARCHAR( 50 ) NOT NULL , 'ip' VARCHAR( 50 ) NOT NULL , PRIMARY KEY ( 'id' ) , UNIQUE ( 'username' ) )"); echo "Installed! Please delete this file."; ?> |
Connect [connect.php]
|
// MySQL connect information. $c_username = "database_username"; $c_password = "database_password"; $c_host = "localhost"; $c_database = "database_name"; // Connect. $connection = mysql_connect($c_host, $c_username, $c_password) or die ("It seems this site's database isn't responding."); mysql_select_db($c_database) or die ("It seems this site's database isn't responding."); ?> |
Register [register.php]
|
// Check if he wants to register: if (!empty($_POST[username])) undefined ?> |
Login [login.php]
|
session_start();
// Check if he wants to login: if (!empty($_POST[username])) undefined ?> |
Logout [logout.php]
|
$_SESSION[username] = "";
?> |
Want to limit certain files only to members, use the below script. Members [members.php]
|
session_start();
// Check his status. if (!empty($_SESSION[username])) // he got it. undefined else // bad info. undefined ?> |


Reply
You can create new account by just visiting here:
Reply
Reply
Reply
thanks
Reply
thanks
Reply
advisor.bulljobs@gmail.com .... suggest me step by step
Reply
Reply
Reply
Reply
Reply
rajeevcse04.blogspot.com
Reply
<!doctype html><html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Google</title><script>window.google={kEI:"FPqqTZr3HMO0tAaWxY2aCQ",kEXPI:"17259,27084,29383,29456,29544",kCSI:{e:"17259,27084,29383,29456,29544",ei:"FPqqTZr3HMO0tAaWxY2aCQ",expi:"17259,27084,29383,29456,29544"},ml:function(){},pageState:"#",kHL:"en",time:function(){return(new Date).getTime()},log:function(c,d,
b){var a=new Image,e=google,g=e.lc,f=e
Reply
Reply
Reply
1) you try to to go to a protected page
2) it tells you you are not logged in
3) you try to log in but you are not registered (how does he come to the register page)
4) you register and login
5) does the page with the code of members.php in to be saved as .php or is .htm as good?
6) where has this code to go to in the htm file?
Maybe I am the only one who does not know "How to" but sorry I am a beginner
Reply
Reply
Reply
Reply
www.qorser.com
Reply
BlackDrifter.com
Reply
I have a all forms in php showing problems, for instance: In the form register.php in desired username it shows <? echo $_POST[username]; ?> for First Name --> <? echo $_POST[firstname]; ?> etc.... How can I fix this errror? I am using PHP 5.2.9-2. I find the tutorial realy interessting and I'lll appreciate if someone can drop a tip to fix it. Thanks for any help. Richard Andrews.
Reply
I got a question.
How do i use this script to secure 1 or more pages of my website ?
Cause <?php include('login.php'); ?>
cause it its will just add the login page to my normal page
greeting MR
Reply
Reply
Reply
Reply
Reply
header( "refresh:4;url=your url or page" );
header( "Location: your url or page" );
Hope this will help you abit unless you allready got it ofc
Reply
Reply
Reply
if using localhost the u need to install one of the following
mac - mamp
windows - wamp
just google for them
Reply
Reply
Reply
Reply
Please help
Reply
Reply
Reply