PHP Classes

File: example/inc/loginform.php

Recommend this page to a friend!
  Classes of Ashraf Gheith   PHP Secure Login and Registration   example/inc/loginform.php   Download  
File: example/inc/loginform.php
Role: Auxiliary script
Content type: text/plain
Description: Template
Class: PHP Secure Login and Registration
Register and login users in a database with PDO
Author: By
Last change: Fixed some bugs and security issues
Date: 7 years ago
Size: 1,104 bytes
 

Contents

Class file image Download
<div class="form-group">
    <input type="text" name="username" id="username" tabindex="1" class="form-control" placeholder="Email" value="">
</div>
<div class="form-group">
    <input type="password" name="password" id="password1" tabindex="2" class="form-control" placeholder="Password">
</div>
<div class="form-group">
    <div class="row">
        <div class="col-sm-6 col-sm-offset-3">
            <input type="button" name="login-submit" id="login-submit" tabindex="4" class="form-control btn btn-login" value="Log In">
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function() {
        $("#login-submit").click(function(){
            if($("#username").val() != "" && $("#password1").val() != "" && validateEmail($("#username").val())){
                $.ajax({
                  method: "POST",
                  url: "<?=loginfile?>",
                  data: { username: $("#username").val(), password: $("#password1").val() }
                }).done(function( msg ) {
                    if(msg !== ""){
                        alert(msg);
                    }else{
                        window.location = "<?=userfile?>";
                    }
                });
            }else{
                alert("Please fill all fields with valid data!");
            }
        });
    });
</script>