phpUserTrack
[ class tree: phpUserTrack ] [ index: phpUserTrack ] [ all elements ]

Source for file login.php

Documentation is available at login.php

  1. <?php
  2.     require_once './include/version.php';
  3.     require_once dirname(__FILE__'/lib/core.php';
  4.     
  5.     require_once 'smarty/libs/Smarty.class.php';    
  6.     
  7. $smarty new Smarty();
  8.  
  9. $smarty->plugins_dir['include';
  10. require_once $smarty->_get_plugin_filepath('function''html_doctype');
  11.  
  12. $smarty->assign('noNav'true);
  13. if (isset($_POST['submit'])) {
  14.     try {
  15.         $login new login();
  16.         if (!$login->submit_login($_POST['username']$_POST['password'])) {
  17.             $notify[array('title' => 'Login Failed'
  18.                 'desc' => 'invalid username/password combo',
  19.                 'type' => 'error'
  20.             );
  21.         else {
  22.             $notify[array('title' => 'Login Succeeded'
  23.                 'desc' => 'You are logged in as <strong>' $_POST['username''</strong>',
  24.                 'type' => 'success'
  25.             );
  26.             include('index.php');
  27.             //header( 'Location: index.php' ) ;
  28.             die;
  29.         }
  30.     catch (Exception $e{
  31.         $notify[array('title' => 'Database Error'
  32.         'desc' => 'Can\'t connect to database server. <a href="settings.php">Check settings</a>.: ' $e->getMessage(),
  33.         'type' => 'error'
  34.     );
  35.     }
  36. elseif (isset($_GET['logout'])) {
  37.     unset ($_SESSION['uid']);
  38.     $notify[array('title' => 'Logout Succeeded'
  39.             'desc' => 'You have been successfully logged out from the system',
  40.             'type' => 'success'
  41.         );
  42. }
  43.  
  44. $smarty->assign('notifMsg'$notify);
  45.  
  46. $smarty->assign('pageTitle''phpUserTrack Login Page');
  47.  
  48. $smarty->display('header.tpl');
  49. $smarty->display('login.tpl');
  50. $smarty->display('footer.tpl');
  51.  
  52. ?>

Documentation generated on Tue, 06 Nov 2007 09:22:09 -0800 by phpDocumentor 1.4.0a2