Login   Register  
PHP Classes
elePHPant
Icontem

File: userLogin.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Gurdeep Singh  >  UserAction  >  userLogin.php  >  Download  
File: userLogin.php
Role: Example script
Content type: text/plain
Description: Checks for the POST values and pass it to UserManager class
Class: UserAction
Authenticate users with MySQL database records
Author: By
Last change:
Date: 6 years ago
Size: 1,827 bytes
 

Contents

Class file image Download
<?php
    
if (!empty($_POST)) {
        if (
$_POST['username'] == "") {
            
$message "Please enter Username";
        }else if (
$_POST['password'] == "") {
            
$message "Please enter Password";
        } else {
            require_once(
'UserAction/UserManager.php');
            
$userManager UserManager::getInstance($_POST['username'], $_POST['password']);
            
$userResult $userManager->userLogin();
            
            if (
count($userResult) == 0) {
                
$message "Username/Password incorrect.";
            } else {
                
$message "Login successful";
            }
        }
    }
?>
<html>
<head>
<title>User Login</title>
<link rel="STYLESHEET" type="text/css" href="./general.css">
</head>
<table width="60%" border="0" cellpadding="0" cellspacing="0"
    align="center">
    <tr>
        <td align="center">
        <form action="userLogin.php" method="post" name="loginForm">
        <table border="0" align="center" width="400" cellspacing="2"
            cellpadding="7" bgcolor="#f3f3f3">
            <tr bgcolor="#587888">
                <td colspan="2" bgcolor="#1A237D" align="center" class="subheading"
                    height="40"><b>User Login</b></td>
            </tr>
            <tr bgcolor="#ffffff">
                <td colspan="2" align="left" class="normal"><font color=#FF0000>
                <?php
                    
if($message != "") {
                        echo 
$message;
                    }
                
?>
                </font>
                </td>
            </tr>

            <tr bgcolor="#ffffff">
                <td class="normal">Username:</td>
                <td><input class=button type="text" name="username" value=""></td>
            </tr>
            <tr bgcolor="#ffffff">
                <td class="normal">Password:</td>
                <td><input class=button type="Password" name="password" value=""></td>
            </tr>
            <tr bgcolor="#ffffff">
                <td class="normal">&nbsp;</td>
                <td><input class=buttonadmin type="Submit" name="submit"
                    value="Sign In" class="buttonStyle"></td>
            </tr>
        </table>
        </form>
        </td>
    </tr>
</table>
</html>