Search
 
SCRIPT & CODE EXAMPLE
 

PHP

login form in php

<section class="vh-100" style="background-color:#5F9EA0 ;">
    <?php
    if(isset($errors['login'])){
        echo $errors['login'];
    }
    ?>
    <div class="container h-100">
        <div class="row d-flex justify-content-center align-items-center h-100">
            <div class="col-lg-12 col-xl-11">
                <div class="card text-black" style="border-radius: 35px;">
                    <div class="card-body p-md-5" style="background-color: #FFEBCD;">
                        <div class="row justify-content-center">
                            <div class="col-md-10 col-lg-6 col-xl-5 order-2 order-lg-1">
                                <p class="text-center h1 fw-bold mb-5 mx-1 mx-md-4 mt-4">Login</p>
                                <form class="mx-1 mx-md-4" method='POST'>
                                    <div class="d-flex flex-row align-items-center mb-4">
                                        <i class="fas fa-envelope fa-lg me-3 fa-fw"></i>
                                        <div class="form-outline flex-fill mb-0">
                                            <input value='admin@gmail.com' name="email" type="email" id="form3Example3c"
                                                class="form-control" />
                                            <label class="form-label" for="form3Example3c">Your Email</label> <br>
                                            <?php
                        if(isset($errors['email'])){
                            echo '<span class="text-danger">'.$errors['email'].'</span>';
                        }
                      ?>
                                        </div>
                                    </div>

                                    <div class="d-flex flex-row align-items-center mb-4">
                                        <i class="fas fa-lock fa-lg me-3 fa-fw"></i>
                                        <div class="form-outline flex-fill mb-0">
                                            <input value='12345678' name="password" type="password" id="form3Example4c"
                                                class="form-control" />
                                            <label class="form-label" for="form3Example4c">Password</label> <br>
                                            <?php
                      if(isset($errors['password'])){
                          echo '<span class="text-danger">'.$errors['password'].'</span>';
                      }
                    ?>
                                        </div>
                                    </div>
                                    <div class="d-flex justify-content-center mx-4 mb-3 mb-lg-4">
                                        <button type="submit" name="login" class="btn btn-lg"
                                            style='background-color: #eb4b4b !important; color: white !important'>Login</button>
                                    </div>

                                    <a class="link-primary" href="signup.php">Signup</a>

                                </form>

                            </div>
                            <div class="col-md-10 col-lg-6 col-xl-7 d-flex align-items-center order-1 order-lg-2">

                                <img src="asset/image/Why are Micro-interactions Important in WordPress Themes.gif" class="img-fluid" alt="Sample image">

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

Comment

login page in php

<?php

$cser=mysqli_connect("localhost","root","","project") or die("connection failed:".mysqli_error());

if(isset($_REQUEST['sub']))
{
$a = $_REQUEST['uname'];
$b = $_REQUEST['upassword'];

$res = mysqli_query($cser,"select* from users where uname='$a'and upassword='$b'");
$result=mysqli_fetch_array($res);
if($result)
{
	if(isset($_REQUEST["remember"]) && $_REQUEST["remember"]==1)
	setcookie("login","1",time()+60);// second on page time 
else
	setcookie("login","1");
	header("location:index.php");
	
	
}
else
{
	header("location:login.php?err=1");
	
}
}
?>
Comment

login php

<!DOCTYPE html>  
 <html>  
      <head>  
           <title>Webslesson Tutorial</title>  
           <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />  
           <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>  
           <script src="jquery.js"></script>  
           <style>  
                #box  
                {  
                     width:600px;  
                     background:gray;  
                     color:white;  
                     margin:0 auto;  
                     padding:10px;  
                     text-align:center;  
                }  
           </style>  
      </head>  
      <body>  
      <?php  
      session_start();  
      if(isset($_SESSION["name"]))  
      {  
           if((time() - $_SESSION['last_login_timestamp']) > 60) // 900 = 15 * 60  
           {  
                header("location:logout.php");  
           }  
           else  
           {  
                $_SESSION['last_login_timestamp'] = time();  
                echo "<h1 align='center'>".$_SESSION["name"]."</h1>";  
                echo '<h1 align="center">'.$_SESSION['last_login_timestamp'].'</h1>';  
                echo "<p align='center'><a href='logout.php'>Logout</a></p>";  
           }  
      }  
      else  
      {  
           header('location:login.php');  
      }  
      ?>  
      </body>  
 </html>
Comment

PREVIOUS NEXT
Code Example
Php :: php day of week full name 
Php :: calculate total time from start and end datetime in php 
Php :: sum of multidimensional array in php 
Php :: php has constant 
Php :: file upload in php mysql 
Php :: laravel natural sort 
Php :: php static dropdown list example 
Php :: codeigniter order_by 
Php :: Create Model with Controller in Laravel 
Php :: html special characters php 
Php :: Convert a String to a Number in PHP 
Php :: wordpress 404.php redirect to home 
Php :: using PDO and PHP = Login.php 
Php :: how to install symfony in windows 10 
Php :: make project in laravel 7 
Php :: php datetime add 1 weeek 
Php :: connect another database in wordpress 
Php :: php faker long text 
Php :: model with migration laravel 
Php :: what is better, php or javascript 
Php :: form validation for file type in codeigniter 
Php :: php check if a url exists 
Php :: how to get index 2nd php 
Php :: prevent SQL injection in PHP? 
Php :: how to show image from php 
Php :: json encode decode 
Php :: php meta refresh 
Php :: woocommerce checkout manager confirm password 
Php :: woocommerce php product gallery change to carousel 
Php :: laravel elequent get 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =