php login w3schools code example

Example 1: how to make a html login page

<!doctype html>
<form name="loginForm" method="post" action="index.html">
<table width="20%" bgcolor="0099CC" align="center">
  <tr>
<td colspan=2><center><font size=4><b>light-net login</b></font></center></td>
</tr>

<tr>
<td>Username:</td>
<td><input type="text" size=25 name="user"></td>
</tr>

<tr>
<td>Password:</td>
<td><input type="Password" size=25 name="pass"></td>
</tr>

<tr>
<td ><input type="Reset"></td>
<td><input type="submit" onclick="return check(this.form)" value="Login"></td>
</tr>

</table>
</form>
<script language="javascript">
function check(form)
{

if(form.user.value == "public" && form.pass.value == "peasants")
{
	return true;
}
else
{
	alert("Error Password or Username")
	return false;
}
}
	      </script>

Example 2: login javascript php

<aside id="login" class="col-md-4">    
    <div class="card">
        <div class="card-body">
            <a href="" class="float-right btn btn-outline-primary">Registro</a>
            <h4 class="card-title mb-4 mt-1">Acceso</h4>
        
            <hr />
          
            <form method="post" name="login_form" id="login_form" action="" onsubmit="enviar(this); return false;">
                <div class="form-group">
                    <input class="form-control" placeholder="Email" type="email" id="email" name="email" value="[email protected]" autocomplete />
                </div>
                <div class="form-group">
                    <input class="form-control" placeholder="******" type="password" id="password" name="password" autocomplete />
                </div>                                    
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <button type="submit" class="btn btn-primary btn-block" id="access" name="access">Acceso</button>
                        </div> 
                    </div>
                    <div class="col-md-6 pt-2 pr-4 text-right">
                        <a class="small" href="#" class="">¿Olvidó su contraseña?</a>
                    </div>                                            
                </div>      
            </form>
                
            <!-- messages -->
            <div class="row">
                <div class="col-12">
                    <div class="outer-loader">
                        <span class="inner-loader"><img src="assets/img/loader.gif" alt="consultando ..." /></span>     
                        <span class="messages"></span>
                    </div>    
                    <span class="debug"></span>    
                </div>
            </div> <!-- end messages -->     
        </div>
        
    </div> 
</aside>

Tags:

Php Example