[ Index ]
 

Code source de phpMyVisites 2.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/core/forms/ -> FormLogin.class.php (source)

   1  <?php
   2  /* 
   3   * phpMyVisites : website statistics and audience measurements
   4   * Copyright (C) 2002 - 2006
   5   * http://www.phpmyvisites.net/ 
   6   * phpMyVisites is free software (license GNU/GPL)
   7   * Authors : phpMyVisites team
   8  */
   9  
  10  // $Id: FormLogin.class.php 29 2006-08-18 07:35:21Z matthieu_ $
  11  
  12  
  13  require_once  INCLUDE_PATH . "/core/forms/Form.class.php";
  14  
  15  class FormLogin extends Form
  16  {    
  17  	function FormLogin( &$template )
  18      {
  19          $action = Request::getCurrentCompletePath() . "/index.php?mod=login";
  20          parent::Form( $template,  $action);
  21      }
  22      
  23  	function process()
  24      {            
  25          $urlToGoAfter = str_replace('mod=login',
  26                                      '',
  27                                      Request::getCurrentCompleteUrl()
  28                                  );
  29  
  30          // general input
  31          $formElements = array(
  32              array('text', 'form_login', $GLOBALS['lang']['login_login']),
  33              array('password', 'form_password', $GLOBALS['lang']['login_password']),
  34              array('hidden', 'form_url', $urlToGoAfter),
  35          );
  36          $this->addElements( $formElements );
  37          
  38          // validation rules
  39          $formRules = array(
  40              array('form_login', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['login_login']), 'required'),
  41              array('form_password', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['login_password']), 'required'),
  42          );
  43          $this->addRules( $formRules );
  44      
  45          // launche process
  46          return parent::process();
  47      }
  48      
  49  	function postProcess()
  50      {
  51          $login = $this->getSubmitValue('form_login');
  52      
  53  
  54          $password = md5($this->getSubmitValue('form_password'));
  55          $url = $this->getSubmitValue('form_url');
  56          
  57          $me = new User();
  58          
  59          if($me->isCorrect($login, $password))
  60          {
  61              $me->loadPermissions();
  62              if( $me->NoSitePermission() )
  63              {
  64                  header("Location: ".Request::getCurrentCompletePath()."/index.php?mod=login&error_login=2");
  65                  exit;
  66              }
  67              header("Location: $url");
  68              exit;
  69          }
  70          else
  71          {
  72              header("Location: ".Request::getCurrentCompletePath()."/index.php?mod=login&error_login=1");
  73              exit;
  74          }
  75      }
  76  }
  77  ?>


Généré le : Mon Nov 26 14:10:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics