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 :: laravel validate string 
Php :: download php 7.4 
Php :: spatie media library 
Php :: php send data from one page to another 
Php :: hide .php 
Php :: error php 
Php :: create custom rule in laravel 
Php :: laravel query 
Php :: laravel collection unique 
Php :: file_get_contents with url 
Php :: strings functions php 
Php :: what does = mean in php 
Php :: Attempt to read property "name" on bool 
Php :: can i install php7.4 inside vagrant homestead 
Php :: setup PDO 
Java :: vm options javafx 
Java :: java stack char 
Java :: getcolor deprecated 
Java :: regex java email validation 
Java :: find maven version 
Java :: java lambda foreach multiple statements 
Java :: full screen android java 
Java :: ranfom number between 1 to 100 java 
Java :: heap sort java 
Java :: array to map java4 
Java :: convert java date to sql date 
Java :: add label gui jframe 
Java :: string array to arraylist android 
Java :: jaxb exclude field 
Java :: javaee jsp convert int to string 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =