private function postAuthenticate($u, $p)
 {
     $this->justProcessed = true;
     $sql = "SELECT u.ID, u.username, u.email, u.admin, u.banned, u.active, u.name, (SELECT GROUP_CONCAT( g.name SEPARATOR '-groupsep-' ) FROM groups g, group_memberships gm WHERE g.ID = gm.group AND gm.user = u.ID ) AS groupmemberships FROM users u WHERE u.username='******' AND u.password_hash='{$p}'";
     //echo $sql;
     PHPEcommerceFrameworkRegistry::getObject('db')->executeQuery($sql);
     if (PHPEcommerceFrameworkRegistry::getObject('db')->numRows() == 1) {
         $userData = PHPEcommerceFrameworkRegistry::getObject('db')->getRows();
         if ($userData['active'] == 0) {
             $this->loggedIn = false;
             $this->loginFailureReason = 'inactive';
             $this->active = false;
         } elseif ($userData['banned'] != 0) {
             $this->loggedIn = false;
             $this->loginFailureReason = 'banned';
             $this->banned = false;
         } else {
             $this->loggedIn = true;
             $this->userID = $userData['ID'];
             $this->admin = $userData['admin'] == 1 ? true : false;
             $_SESSION['phpecomf_auth_session_uid'] = $userData['ID'];
             $groups = explode('-groupsep-', $userData['groupmemberships']);
             $this->groups = $groups;
         }
     } else {
         $this->loggedIn = false;
         $this->loginFailureReason = 'invalidcredentials';
     }
 }
Example #2
0
/**
 * PHPEcommerceFramework
 * Framework loader - acts as a single point of access to the Framework
 *
 * @version 1.0
 * @author Michael Peacock
 */
// first and foremost, start our sessions
session_start();
// setup some definitions
// The applications root path, so we can easily get this path from files located in other folders
define("FRAMEWORK_PATH", dirname(__FILE__) . "/");
// require our registry
require_once 'registry/registry.class.php';
$registry = PHPEcommerceFrameworkRegistry::singleton();
$registry->getURLData();
// get database connection details
require_once 'config.php';
// store core objects in the registry.
$registry->storeObject('mysql.database', 'db');
$registry->storeObject('template', 'template');
$registry->storeObject('authentication', 'authenticate');
$registry->storeSetting('default', 'view');
$registry->storeSetting('sitename', 'Juniper Theatricals Store');
$registry->storeSetting('siteshortname', 'JTS');
$registry->storeSetting('siteurl', 'http://localhost/book4/chapter11/');
$registry->storeSetting('payment.paypal.email', '*****@*****.**');
$registry->storeSetting('payment.currency', 'USD');
$registry->storeSetting('payment.testmode', 'NO');
$registry->storeSetting('payment.paypal.email', '*****@*****.**');
Example #3
0
 /**
  * Gets data from the current URL
  * @return void
  */
 public function getURLData()
 {
     $urldata = isset($_GET['page']) ? $_GET['page'] : '';
     self::$urlPath = $urldata;
     if ($urldata == '') {
         self::$urlBits[] = 'home';
         self::$urlPath = 'home';
     } else {
         $data = explode('/', $urldata);
         while (!empty($data) && strlen(reset($data)) === 0) {
             array_shift($data);
         }
         while (!empty($data) && strlen(end($data)) === 0) {
             array_pop($data);
         }
         self::$urlBits = $this->array_trim($data);
     }
 }
Example #4
0
 /**
  * Set the content of the page based on a number of templates
  * pass template file locations as individual arguments
  * @return void
  */
 public function buildFromTemplates()
 {
     $bits = func_get_args();
     $content = "";
     foreach ($bits as $bit) {
         if (strpos($bit, 'views/') === false) {
             $bit = 'views/' . PHPEcommerceFrameworkRegistry::getSetting('view') . '/templates/' . $bit;
         }
         if (file_exists($bit) == true) {
             $content .= file_get_contents($bit);
         }
     }
     $this->page->setContent($content);
 }