public static function init() { if (empty(self::$inst)) { self::$inst = new self(); // initialization CORE::check_mode(); spl_autoload_register('CORE::AutoLoader'); CORE::msg('debug', 'core initialization'); SESSION::init(); CORE::check_lang(); } return self::$inst; // singleton pattern }
function contact() { $result = $this->model->addContact(); SESSION::init(); if ($result == 1) { $_SESSION['message'] = "Your Comment/Suggestion has been submitted successfully. We will get back to you shortly"; redirect_to($this->uri->link("contact_us")); } elseif ($result == 2) { $_SESSION['message'] = "Your Comment/Suggestion was not successful, please try again."; redirect_to($this->uri->link("contact_us")); } elseif ($result != 1 && $result != 2 && $result != "") { $_SESSION['message'] = "Check the following errors: " . $result; redirect_to($this->uri->link("contact_us")); } else { $_SESSION['message'] = "An error occurred, please try again."; redirect_to($this->uri->link("contact_us")); } }
public function login() { //db ausführen session usw. SESSION::init(); SESSION::display(); //form auslesen $postdata = array('username' => $username = filter_var($_POST['username'], FILTER_SANITIZE_EMAIL), 'password' => $password = filter_var($_POST['password'], FILTER_SANITIZE_STRING)); $this->_model->compare($postdata); // var_dump(bool); if (true) { $data['products'] = $this->_model->all(); $this->_view->render('header', $data); $this->_view->render('products/list', $data); $this->_view->render('footer'); } else { echo "Bitte registriere Dich"; $this->_view->render('header', $data); $this->_view->render('products/register', $data); $this->_view->render('footer'); } //an Model weiterreichen und dort vergleichen }
?> public/css/foundation.min.css"> <link rel="stylesheet" href="<?php echo URL; ?> public/css/app.css"> <script type="text/javascript" src="<?php echo URL; ?> public/ckeditor/ckeditor.js"></script> <script src="<?php echo URL; ?> public/js/modernizr.foundation.js"></script> <?php SESSION::init(); if (isset($_SESSION['adminmessage']) && $_SESSION['adminmessage'] != "") { echo '<script type="text/javascript">alert("' . $_SESSION['adminmessage'] . '"); </script>'; $_SESSION['adminmessage'] = ""; } ?> </head> <body> <!-- Header and Nav --> <nav class="top-bar"> <ul> <!-- Title Area --> <li class="name">
function __construct() { parent::__construct(); SESSION::init(); }