PHP Classes
Icontem

File: glogin.test.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Cesar D. Rodas  >  gLogin  >  glogin.test.php  
File: glogin.test.php
Role: Example script
Content type: text/plain
Description: Example
Class: gLogin
Encode password fields before submitting forms
 

Contents

Class file image Download
<?php

error_reporting
(E_ALL);

include(
"gLogin.php");

$login = new gLogin('post');



/*
**    This must come first, before the safeSend function
**    call
*/



if ($login->isFormSubmited()) {
        
/*
         * This is only an example, replace it by ur original
         * table value.
         */

    
$db mysql_connect('localhost','root','');

    
mysql_select_db('db');

    

    
$sql mysql_query("select * from username where usrName = '".$login->getValue'uname' )."'",$db) or die(mysql_error($db));

    if (
mysql_num_rows($sql) == 0) {

        
/* User doesn't exist */ 

        
$m "User Doesn't exist";

    } else {

        
$row mysql_fetch_array($sql);

        if ( !
$login->match('pword'$row['usrPass']) ) {

            
$m "Passwods missmatch";

        } else {

            
/*
            **    User login!, do something here for do the login
            */

            
$m "welcome";

        }

    }

}

$login->safeSend('uname');

$login->safeSend('pword'true);







?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head profile="http://gmpg.org/xfn/11">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <title>Test</title>

    <script type="text/javascript" src="md5.js"></script>


</head>

<body>

    <?

        
if (isset($m)) echo '<script>alert("'.$m.'");</script>';

    
?>
<center><h1>Testing Cesar D. Rodas gLogin</h1>
</center>
    <div id = 'mbody'>

        <div  id = 'loginbox' class='loginbox'>

            <form action = "glogin.test.php" onsubmit="<?=$login->onsubmit()?>" method ="post">

            <?=$login->Js();?>

            <table cellspacing=6>

                <tr> 

                    <td>Username<br /><input type='text' id = 'uname' /></td>

                </tr>

                <tr>

                    <td>Password<br /><input type='password' id = 'pword' /></td>

                </tr>

                <tr>

                    <td colspan=2 align=center><input type=submit value='Login'></td>

                </tr>


            </table>

            </form

        ></div>

    </div>

</body>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products