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 null coalesce 
Php :: laravel get route path uri 
Php :: php preg_quote 
Php :: Hide Add to cart button on specific products 
Php :: php replace string 
Php :: last insert id mysqli 
Php :: saving an image from pc to php 
Php :: get shipping price of choosen shipping method woocommerce 
Php :: array shift php 
Php :: laravel blade if else condition 
Php :: how to get array key in php 
Php :: inplode php 
Php :: php localhost 
Php :: Laravel query where and 
Php :: php recortar string 
Php :: php session array 
Php :: How to use Query builder with eloquent in Laravel 8? 
Php :: laravel log package, laravel log, save laravel log 
Php :: carbon this month first day 
Php :: php method type hinting 
Php :: how to loop by index in php 
Php :: php switch case statement 
Php :: woocommerce set default shipping country 
Php :: laravel one to many relationship example 
Php :: date and time syntax 
Php :: Function create_function() is deprecated in 
Php :: Woocommerce Changing the Entry Title of the Custom Endpoint 
Php :: simple php round Passing parameters with mode 
Php :: php sentense case 
Php :: php empy a file 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =