Student Of Fortune

Create Register | Login | Logout Script With PHP

Share on :
Register | Login | Logout Script web desain grafis
I am sure all my friends already know about the Register, login, and logout. Or may also have some friends who do not really know. Okay, I will explain in well short .. Usually when we enter a site, we are required to login first. But before the login, we must first register your name, email, and password we want to log in later. Well, I would immediately explain the script. In this example, I made a register, login, and logout scripts in 3 pieces. Namely:
1. Index.php
2. Config.php
3. Daftar.php


First of all to be done, of course, is to create a database first. Make a database with the name? reglog?. Then create a table with the name? members?. Then enter following fields:
 
? Id? type = bigint (20)
? name? type = varchar (50)
? email? type = varchar (50)
? password? type = varchar (8)
If so, enter the following script:

This is to connect your database  :

Config.php
<? php
$ host = "localhost";
$ user = "root";
$ pass = "";
$ db = "reglog";
$ table = "members";
$ the connect = mysql_connect ($ host, $ user, $ pass) or die ("Failed to conn");
$ pilih_db = mysql_select_db ($ db) or die ("Database does not exist");
$ cookie_nama = $ _COOKIE ['name'];
?>

Index.php 
<? Php
include ("config.php");
?>
<? Php
if ($ _GET ['register'])
{
include ("daftar.php");
exit;
}
?>
<? Php
if ($ _GET ['register2'])
{
include ("daftar2.php");
exit;
}
?>
<? Php
if ($ _GET ['login'])
{
include ("login.php");
exit;
}
?>
<style type="text/css">
<! -
. Style1 {color: # FFFFFF}
. Style2 {color: # 0000FF}
->
</ Style>
<p>
<? Php
if ($ _GET ['logout'])
{
print "You have successfully logged out! <p>";
}  
> Welcome
<? php
$ cookie_name = $ _COOKIE ['name'];
print "$ cookie_name";
?> [<a href="logout.php" class="style2"> Logout </ a>] </ p>
<p> Click <a
href = "index.php? register = enter% 20name, email, and% 20password% 20 to% 20 list"
class = "style2"> here </ a> to register </ p>
name="form1" <form method="POST" action="index.php?login=success">
<table width="400" border="0">
<tr bgcolor="#999999">
<td colspan="2"> <span class="style1"> Login </ span> </ td>
</ tr>
<tr bgcolor="#CCCCCC">
<td> User: </ td>
<td> <input type="text" name="user" id="user"> </ td>
</ tr>
<tr bgcolor="#CCCCCC">
<td> Password: </ td>
<td> <input type="password" name="password" id="password"> </ td>
</ tr>
<tr>
<td colspan="2"> </ td>
</ tr>
<tr>
<td colspan="2"> <input type = "submit" name = "Submit" value = "Login!"
style = "background-color: # CCCCCC"> </ td>
</ tr>
</ table>
</ form>
<p> </ p>
<? php mysql_close ($ connect);?>
 

Daftar.php
<style type="text/css">
<! -
. style3 {font-size: 24px}
->
</ style>
name="form1" <form method="POST" action="index.php?register2=success">
<table width="400" border="0">
<tr>
<td colspan="2"> <span class="style3"> Register </ span> </ td>
</ tr>
<tr>
<td> Name: </ td>
<td> <input type="text" name="name" id="name"> </ td>
</ tr>
<tr>
<td> Email: </ td>
<td> <input type="text" name="email" id="email"> </ td>
</ tr>
<tr>
<td> Password: </ td>
<td> <input type="password" name="password" id="password"> </ td>
</ tr>
<tr>
<td> Confirm Password: </ td>
<td> <input type="password" name="c_password" id="c_password"> </ td>
</ tr>
<tr>
<td colspan="2"> </ td>
</ tr>
<tr>
<td colspan="2"> <input type="submit" name="Submit" value="Register"> </ td>
</ tr>
</ table>
</ form>
<? php mysql_close ($ connect);?>
 



4 comments on Create Register | Login | Logout Script With PHP :

anonymous said... February 9, 2011 at 3:22 PM

that look like something missing on that code, the input password never compare with the save password in database to autentication.
For savely, use hash function to compare the value of the saved and input password.
Thanks.
tyang @ codeprogram.co.cc

Unknown said... March 16, 2011 at 12:14 AM

I hope This Blog to be your reference

Helen Neely said... July 14, 2011 at 6:09 AM

Great post. Was wondering if you could have the files as a downloadable file.

Thanks anyway for the tutorial.

Giovanni said... September 12, 2012 at 12:53 PM

Your script dont work but nice post

Post a Comment and Don't Spam!

Dont Spam please

 
Recommended Post Slide Out For Blogger

Recent Comments

My Rank