PHP Classes

File: login.php

Recommend this page to a friend!
  Packages of Andrei   SMK User Authentication   login.php   Download  
File: login.php
Role: Example script
Content type: text/plain
Description: Example login script.
Class: SMK User Authentication
Authenticate users with MySQL database records
Author: By
Last change:
Date: 20 years ago
Size: 1,718 bytes
 

Contents

Class file image Download
<?php

    require_once('auth.class.php');
    require_once('db.inc.php');
    
    $username=GetParam($_REQUEST,'username','');
    $password=GetParam($_REQUEST,'password','');
    $message='';
    
    if ($username!=""){
        //Authenticate
        $auth=new UserAuth($database);
        $auth->Logout();
        if ($auth->Login($username,$password)){
            header('location: index.php'); 
            exit;
        }else{
            $message='Login incorrect';
        }
    }
   
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Test Login</title>
</head>
<body leftmargin="0" topmargin="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan=2> Welcome to my example login!</td>
  </tr>
  <tr>
    <td width="180" align="left" valign="top" rowspan=2>
    <table class="menuleft" height="400" width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr><td>
        &nbsp;
    </td></tr>
    <td width="607" valign="top">
        <center>
        <?php if ($message!=''){ ?>
        <table cellspacing="0" cellpadding="0">
          <tr>
            <td width="100%" height="25" colspan="2">
                <strong><?=$message?></strong>
                </td>
          </tr>
        </table >
        <?php } ?>
        <form action="login.php" method="post" >
        Username:<input type="text" name="username" value=""><br>
        Password:<input type="password" name="password" value=""><br>
        <input type="submit" name="sumbit" value="Login">
        </form>
      </td>
  </tr>
  <tr>
    <td>Please Login</td>
  </tr>
</table>
</body>
</html>