SoftwareQuery
Home About Contact

PHP Registration And Login Page

 SoftwareQuery     No comments   



Step-1. Create a Database table go to PHPMyAdmin the create database name then click SQL Tab and paste the code.


CREATE TABLE IF NOT EXISTS `enter table name` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `active` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`)
)



*************************************************************
Step-2.     Create a databasefile.php file.

<?php
$connection = mysqli_connect('localhost', ' Enter UserName', 'Enter Password');
         if (!$connection){
        die("Database Connection Failed" . mysqli_error($connection));
         }
         $select_db = mysqli_select_db($connection, ' Enter Database Name');
       if (!$select_db){
       die("Database Selection Failed" . mysqli_error($connection));
        }

        ?>





Step-3. After Create database name and database create a test.php page then paste this code.

<?php
     require('databasefile.php');

  //$PersonID    = $_POST ['PersonID'];

   if (isset($_POST['username']) && isset($_POST['password'])){
        $username = $_POST['username'];
    $email = $_POST['email'];
        $password =  password_hash($_POST['password'] , PASSWORD_DEFAULT);

       $query = "INSERT INTO `Enter Table Name` (username, password, email) VALUES ('$username', '$password', '$email')";
        $result = mysqli_query($connection, $query);
        if($result){
            $smsg = "User Created Successfully.";
        }else{
            $fmsg ="User Registration Failed";
        }
    }

 ?>
***************************************

Step-4. Create a test.php page then we go to create an HTML page then create a registration form.
         
     
<!DOCTYPE html>
<html lang="en">
<head>
<title>Softwarequery- Register Form</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="css/main.css">

</head>
<body style="background-color: #999999;">

<div class="limiter">
<div class="container-login100">
<div class="login100-more" style="background-image: url('images/bg-01.jpg');"></div>

<div class="wrap-login100 p-l-50 p-r-50 p-t-72 p-b-50">
<form  action = "register.php" class="login100-form validate-form" method="POST"   <?php if(isset($smsg)){ ?><div class="alert alert-success" role="alert"> <?php echo $smsg; ?> </div><?php } ?>
               <?php if(isset($fmsg)){ ?><div class="alert alert-danger" role="alert"> <?php echo $fmsg; ?> </div><?php } ?>
                Complete Code of Register.php>
<span class="login100-form-title p-b-59">
Register
</span>

<div class="wrap-input100 validate-input" data-validate="Name is required">
<span class="label-input100">Full Name</span>
<input class="input100" type="text" name="name" placeholder="Name...">
<span class="focus-input100"></span>
</div>

<div class="wrap-input100 validate-input" data-validate = "Valid email is required: ex@abc.xyz">
<span class="label-input100">Email</span>
<input class="input100" type="text" name="email" placeholder="Email addess...">
<span class="focus-input100"></span>
</div>

<div class="wrap-input100 validate-input" data-validate="Username is required">
<span class="label-input100">Username</span>
<input class="input100" type="text" name="username" placeholder="Username...">
<span class="focus-input100"></span>
</div>

<div class="wrap-input100 validate-input" data-validate = "Password is required">
<span class="label-input100">Password</span>
<input class="input100" type="password" name="password" placeholder="*************">
<span class="focus-input100"></span>
</div>

         <div class="flex-m w-full p-b-33">
<div class="contact100-form-checkbox">
<input class="input-checkbox100" id="ckb1" type="checkbox" name="remember-me">
<label class="label-checkbox100" for="ckb1">
<span class="txt1">
I agree to the
<a href="#" class="txt2 hov1">
Terms of User
</a>
</span>
</label>
</div>
                        </div>

<div class="container-login100-form-btn">
<div class="wrap-login100-form-btn">
<div class="login100-form-bgbtn"></div>
<button class="login100-form-btn">
Sign Up
</button>
</div>

<a href="login.php" class="dis-block txt3 hov1 p-r-30 p-t-10 p-b-10 p-l-30">
log-in
<i class="fa fa-long-arrow-right m-l-5"></i>
</a>
</div>
</form>
</div>
</div>
</div>
<script src="js/main.js"></script>
</body>
</html>
***************************************************************************
                                                 Style.Css
[ FONT ]*/

@font-face {
  font-family: Poppins-Regular;
  src: url('../fonts/poppins/Poppins-Regular.ttf');
}

@font-face {
  font-family: Poppins-Medium;
  src: url('../fonts/poppins/Poppins-Medium.ttf');
}

@font-face {
  font-family: Poppins-Bold;
  src: url('../fonts/poppins/Poppins-Bold.ttf');
}

@font-face {
  font-family: Poppins-SemiBold;
  src: url('../fonts/poppins/Poppins-SemiBold.ttf');
}

[ RESTYLE TAG ]*/

* {
margin: 0px;
padding: 0px;
box-sizing: border-box;
}

body, html {
height: 100%;
font-family: Poppins-Regular, sans-serif;
}

/*---------------------------------------------*/
a {
font-family: Poppins-Regular;
font-size: 14px;
line-height: 1.7;
color: #666666;
margin: 0px;
transition: all 0.4s;
-webkit-transition: all 0.4s;
  -o-transition: all 0.4s;
  -moz-transition: all 0.4s;
}

a:focus {
outline: none !important;
}

a:hover {
text-decoration: none;
}

/*---------------------------------------------*/
h1,h2,h3,h4,h5,h6 {
margin: 0px;
}

p {
font-family: Poppins-Regular;
font-size: 14px;
line-height: 1.7;
color: #666666;
margin: 0px;
}

ul, li {
margin: 0px;
list-style-type: none;
}


/*---------------------------------------------*/
input {
outline: none;

********************************************************************************

Login Form 

Step-5. After creating register page we are going to create a login page. First, create a login.php page then paste a PHP code.


<?php
session_start();
 require('databasefile.php');
 if (isset($_POST['username']) and isset($_POST['password'])){

$username = $_POST['username'];
$password = $_POST['password'];

$query = "SELECT * FROM `Enter Table Name` WHERE username='$username' and password='$password'";

$result = mysqli_query($connection, $query) or die(mysqli_error($connection));
$count = mysqli_num_rows($result);

if ($count == 1){
$_SESSION['username'] = $username;
}else{

$fmsg = "Invalid Login Credentials.";
}
}

if (isset($_SESSION['username'])){
$username = $_SESSION['username'];
echo "softwarequery " . $username . "
";
echo "This is the Members Area
";
echo "<a href='logout.php'>Logout</a>";

}
?>

Step-6.   Create a logout.php page then paste this PHP code.

<?php
session_start();
session_destroy();
header('Location: login.php');

?>
**************************************************************************


Step-7.    Create a login.html form





<!DOCTYPE html>
<html lang="en">
<head>
<title>Softwarequery-Login Form </title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="css/main.css">

</head>
<body style="background-color: #999999;">

<div class="limiter">
<div class="container-login100">
<div class="login100-more" style="background-image: url('images/bg-01.jpg');"></div>

<div class="wrap-login100 p-l-50 p-r-50 p-t-72 p-b-50">
<form action = "login.php"  class="login100-form validate-form" method="POST"   <?php if(isset($smsg)){ ?><div class="alert alert-success" role="alert"> <?php echo $smsg; ?> </div><?php } ?>
               <?php if(isset($fmsg)){ ?><div class="alert alert-danger" role="alert"> <?php echo $fmsg; ?> </div><?php } ?>
                Complete Code of Register.php>
<span class="login100-form-title p-b-59">
Register
</span>

<div class="wrap-input100 validate-input" data-validate="Name is required">
<span class="label-input100">Full Name</span>
<input class="input100" type="text" name="name" placeholder="Name...">
<span class="focus-input100"></span>
</div>

<div class="wrap-input100 validate-input" data-validate = "Valid email is required: ex@abc.xyz">
<span class="label-input100">Email</span>
<input class="input100" type="text" name="email" placeholder="Email addess...">
<span class="focus-input100"></span>
</div>

<div class="wrap-input100 validate-input" data-validate="Username is required">
<span class="label-input100">Username</span>
<input class="input100" type="text" name="username" placeholder="Username...">
<span class="focus-input100"></span>
</div>

<div class="wrap-input100 validate-input" data-validate = "Password is required">
<span class="label-input100">Password</span>
<input class="input100" type="password" name="password" placeholder="*************">
<span class="focus-input100"></span>
</div>

         <div class="flex-m w-full p-b-33">
<div class="contact100-form-checkbox">
<input class="input-checkbox100" id="ckb1" type="checkbox" name="remember-me">
<label class="label-checkbox100" for="ckb1">
<span class="txt1">
I agree to the
<a href="#" class="txt2 hov1">
Terms of User
</a>
</span>
</label>
</div>
                        </div>

<div class="container-login100-form-btn">
<div class="wrap-login100-form-btn">
<div class="login100-form-bgbtn"></div>
<button class="login100-form-btn">
Sign Up
</button>
</div>

<a href="register.php" class="dis-block txt3 hov1 p-r-30 p-t-10 p-b-10 p-l-30">
register
<i class="fa fa-long-arrow-right m-l-5"></i>
</a>
</div>
</form>
</div>
</div>
</div>
<script src="js/main.js"></script>
</body>
</html>







  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to TwitterShare to Facebook
Newer Post Older Post Home

0 comments:

Post a comment

Donate

Translate

Popular Posts

  • How to Make Image Upload Code Using AJAX
    Direct Copy Paste PHP File  Image Upload Code -   <html> <head> <meta charset="utf-8"> <meta http-equi...
  • Best Useful Free Plugin to Make Wordpress Theme
    Meta Slider   - Meta Slider is that the initial free possibility on today’s list. A premium version is additionally obtainable...
  • How To Install Magento on Localhost XAMPP OR WAMP SERVER
      Step-1 => Make Sure you have to install Latest Version of  Xampp server or Wamp server in your PC.   Step -2 => Go to Web Bro...
  • How To Intall Node.js Via Command On Window And Linux.
    Step-1 . Firstly We have to go official website of https://nodejs.org/en/ then download the latest version of Nodejs zi...
  • How to Set up Amazon Affiliate Marketing Account to Earn Money
    Amazon Associates is a  marketing of Amazon company. It is allowed to youtube channel owner, Social Media pages owner and any type...
  • How To Create Custom Pagination In WordPress
    Hello, Friend's in this post we are creating a custom code of Pagination in WordPress. It is very easy to put this code any custom...
  • How To Scrape Data From Website Url Using Php.
    Q. why using a Scraping. If we want to get data of another website then using web scraping. It is using a PHP HTML Dom parser library ...
  • How To Install Wordpress in Xampp Server And Wamp Server
      Step 1st  -      Install WampServer or Xampp Server.                                                                               ...
  • How to create facebook share and like button for webpage
    Step-1 . Go to web browser type google and write facebook sharing button click this URL or open this URL.                     Ref URL:...
  • How to create Database Connection with ENCRYPT Password in Php
    <?php  $username = $_POST['username'];   $email = $_POST['email'];  $psw = password_hash($_POST['psw'], PA...

Home

This blog Is very help full for beginner coder,if you want to learn new things definitely this Blog is very
helpful for you guys.

Followers

Contact form

Name

Email *

Message *

Blog

  • Home
  • About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us
  • Terms&Conditions

NewsLetter

Copyright © SoftwareQuery | Powered by softwarequery
Design by ShubhamTiwari | Theme by softwarequery.com | Distributed By softwarequery/