\nKookcentrum Brabant
\n
\nPrins Hendrikstraat 8
\n 5741 GR Beek en Donk
\nT: 06-46598595
\ninfo@kookcentrumbrabant.nl
\n
\n"); define("DEFAULT_PAGETITLE", "Kookcentrum Brabant "); define("NOT_ADMIN", 'U heeft niet de juiste rechten voor deze pagina
Klik hier om in te loggen'); define("TAALTABS", '
EN NL'); //DE FR
$db = array( "db_host" => 'localhost', "db_port" => '3306', "db_user" => 'kookcent_website', "db_pass" => 'thE4A8e$AmE&', "db_db" => 'kookcent_website'); $maanden[1]="januari"; $maanden[2]="februari"; $maanden[3]="maart"; $maanden[4]="april"; $maanden[5]="mei"; $maanden[6]="juni"; $maanden[7]="juli"; $maanden[8]="augustus"; $maanden[9]="september"; $maanden[10]="oktober"; $maanden[11]="november"; $maanden[12]="december"; $dagen[0]="zondag"; $dagen[1]="maandag"; $dagen[2]="dinsdag"; $dagen[3]="woensdag"; $dagen[4]="donderdag"; $dagen[5]="vrijdag"; $dagen[6]="zaterdag"; $maandenKort[1]="jan"; $maandenKort[2]="feb"; $maandenKort[3]="mrt"; $maandenKort[4]="apr"; $maandenKort[5]="mei"; $maandenKort[6]="jun"; $maandenKort[7]="jul"; $maandenKort[8]="aug"; $maandenKort[9]="sep"; $maandenKort[10]="okt"; $maandenKort[11]="nov"; $maandenKort[12]="dec"; $userdb = $db; $talen = array("nl"); //,"en","de","fr","es" $talendesc = array("nl"=>'Nederlands'); //,"en"=>'English',"de"=>'Deutsch',"fr"=>'France',"es"=>'Español' $arCountry = array("NL"=>"NL"); $GLOBAL['titel'] = array(0=>'', 1=>'Dhr', 2=>'Mevr'); function htmle($str) { return htmlentities($str,ENT_QUOTES,'utf-8'); } function htmld($str) { return html_entity_decode($str,ENT_QUOTES,'utf-8'); } function prijs_format($prijs) { return number_format($prijs,2,',',''); } ?>feedback; $this->imgAlert = '/images/icons/feedback_alert.gif'; $this->imgInfo = '/images/icons/feedback_info.gif'; if ($_SESSION['admin_info']) { $this->last = $_SESSION['admin_info']; } } function addFeedback($fb, $from) { $this->feedback[count($this->feedback)] = $fb." (".get_class($from).")"; $_SESSION['admin_info'] = $this->feedback; } function addUserInfo($fb, $type='notify') { $i = count($this->userinfo); $this->userinfo[$i][0] = $fb; $this->userinfo[$i][1] = $type; $_SESSION['user_info'] = $this->userinfo; } function add($fb, $type='notify'){ $this->addUserInfo($fb, $type); } /* Toont alle relevante feedback voor de gebruiker */ function getUserInfo() { if ($this->debug) { if ($_SESSION['admin_info']) { foreach ($_SESSION['admin_info'] as $row) { echo ''."\n"; } unset($_SESSION['admin_info']); echo ' '; } if ($this->last) { foreach ($this->last as $row) { echo ''."\n"; } unset($this->last); } } if (count($_SESSION['user_info']) > 0) { $success = ''; $danger = ''; foreach ($_SESSION['user_info'] as $row) { if($row[1] == 'notify') { $success .= '
'.$row[0].'
'; } else { $danger .= '
'.$row[0].'
'; } } if($success) { echo ''."\n"; } if($danger) { echo ''."\n"; } } unset($_SESSION['user_info']); } function getFeedback() { $this->getUserInfo(); /* if (count($_SESSION['user_info']) > 0) { echo '
'; foreach ($_SESSION['user_info'] as $row) { echo $row[0]."
\n"; } echo '
'; unset($_SESSION['user_info']); } */ } /* Checkt of er informatie is die weergegeven moet worden */ function check(){ if (isset($_SESSION['user_info'])) { return 1; } else { return 0; } } } $feedback = new feedback; ?>settings = $settings; } function connect() { extract($this->settings); if ($this->handle = new mysqli($db_host,$db_user,$db_pass,$db_db)) { $this->connected = true; return true; } else { exit("- Error: ".mysqli_error()); return false; } } function Qq($query) { if (list($field) = @mysqli_fetch_array(mysqli_query($this->handle, $query))) { return $field; } else { return 0; } } function Query($q) { if (mysqli_query($this->handle, $q)) { return true; } else { return false; } } function Query_Array($query, $assoc = MYSQLI_BOTH) { if ($res = mysqli_query($this->handle, $query)) { $ar = array(); while ($row = mysqli_fetch_array($res, $assoc)) { $ar[count($ar)] = $row; } return $ar; } else { return false; } } function escape($string){ return $this->handle->real_escape_string($string); } function getInsertID() { return $this->handle->insert_id; } function getError() { return $this->handle->error; } function disconnect() { mysqli_close($this->handle); $this->connected = false; } } ?>"Content", 8=>"Administrator" ); //1=>"Content", 3=>"Verkoop", 5=>"In- en Verkoop", 10=>"Administrator" /* Constructor Expects: Array with MySQL information $userdb = array( "db_host" => 'localhost', "db_port" => '3306', "db_user" => 'USER', "db_pass" => 'PASS', "db_db" => 'DBASE' ); */ function users() { global $userdb; $this->db = new db_connection($userdb); } function setUserTable($value){ $this->usertable = $value; } function setUserField($value){ $this->userfield = $value; } function setPasswdField($value){ $this->pasfield = $value; } function setIdField($value){ $this->id_field = $value; } function setNameField($value){ $this->namefield = $value; } function setRightField($value){ $this->rightsfield = $value; } function setSessionName($value){ $this->sessionName = $value; } function setHash($value){ $this->hash = $value; } function setCookie($value){ $this->cookie = $value; } function setExpireTime($value){ $this->expire = $value;// //60*60*10*1 = 36000 = 10 uur; } function getRechten(){ return $_SESSION[$this->sessionName."rechten"]; } function getUserId() { return $_SESSION[$this->sessionName."id"]; } function getUserName() { return $_SESSION[$this->sessionName."naam"]; } // Paswd Genereren kan via: http://www.sevenmiles.nl/genpas/ function getHashPassword($passwd, $pepper) { return hash('whirlpool',$passwd.$pepper.$this->salt,false); } /* Login() Function, called by login form. Executes Function StartSession($rights) */ function login() { if ($this->connect()) { $user = trim($_POST["login"]); if ($this->hash) $pas = $this->getHashPassword(trim($_POST["pass"]), $user); else $pas = trim($_POST["pass"]); $q = "SELECT * FROM `".$this->usertable."` WHERE `".$this->userfield."`='".$this->db->escape(htmlentities($user, ENT_QUOTES))."' AND `".$this->pasfield."`='".$this->db->escape(htmlentities($pas, ENT_QUOTES))."' AND `".$this->pasfield."`!='' LIMIT 1"; //exit($q); $arUser = $this->db->query_array( $q ); $this->disconnect(); $rechten = $arUser[0][$this->rightsfield]; $user_id = $arUser[0][$this->id_field]; $username = $arUser[0][$this->userfield]; $this->startSession($rechten, $user_id, $username, $q); } } function scriptLogin($userID, $username) { $this->startSession(1, $userID, $username, true); } /* startSession() Function, calles by Login() Function Checks is users is valid and sets SESSION vars */ function startSession($rechten, $user_id, $username, $script=false) { global $feedback, $fb; if ($rechten > 0) { $_SESSION[$this->sessionName] = 1; $_SESSION[$this->sessionName."rechten"] = $rechten; $_SESSION[$this->sessionName."id"] = $user_id; $_SESSION[$this->sessionName."naam"] = $username; $_SESSION[$this->sessionName."script"] = $script; if($this->cookie) { $encriptedValue = sha1( 1 + $this->shakey ); setcookie($this->sessionName, $encriptedValue, time()+$this->expire); //60*60*10*1 = 36000 = 10 uur; setcookie($this->sessionName."rechten", $rechten, time()+$this->expire); setcookie($this->sessionName."id", $user_id, time()+$this->expire); setcookie($this->sessionName."naam", $username, time()+$this->expire); setcookie($this->sessionName."script", $script, time()+$this->expire); } $_SESSION['FAILED_LOGIN'] = false; return true; } else { $fb = "Gebruikersnaam of wachtwoord niet juist "; $feedback->addUserInfo("Gebruikersnaam of wachtwoord niet juist ", 'error'); $_SESSION[$this->sessionName] = 0; $_SESSION[$this->sessionName."rechten"] = 0; $_SESSION[$this->sessionName."id"] = 0; $_SESSION['FAILED_LOGIN'] = true; if($this->cookie) { setcookie($this->sessionName, "", time() - 3600); setcookie($this->sessionName."rechten", 0, time() - 3600); setcookie($this->sessionName."id", 0, time() - 3600); setcookie($this->sessionName."naam", "", time() - 3600); setcookie($this->sessionName."script", "", time() - 3600); } return false; } } /* function startSession($rechten, $user_id, $username, $q) { global $feedback, $fb; if ($rechten > 0) { $_SESSION[$this->sessionName] = 1; $_SESSION[$this->sessionName."rechten"] = $rechten; $_SESSION[$this->sessionName."id"] = $user_id; $_SESSION[$this->sessionName."naam"] = $username; if($this->cookie) { $encriptedValue = sha1( 1 + $this->shakey ); setcookie($this->sessionName, $encriptedValue, time()+$this->expire); //60*60*10*1 = 36000 = 10 uur; setcookie($this->sessionName."rechten", $rechten, time()+$this->expire); setcookie($this->sessionName."id", $user_id, time()+$this->expire); setcookie($this->sessionName."naam", $username, time()+$this->expire); } $_SESSION['FAILED_LOGIN'] = false; return true; } else { $fb = "Gebruikersnaam of wachtwoord niet juist "; $feedback->addUserInfo("Gebruikersnaam of wachtwoord niet juist ", 'error'); $_SESSION[$this->sessionName] = 0; $_SESSION[$this->sessionName."rechten"] = 0; $_SESSION[$this->sessionName."id"] = 0; $_SESSION['FAILED_LOGIN'] = true; if($this->cookie) { setcookie($this->sessionName, "", time() - 3600); setcookie($this->sessionName."rechten", 0, time() - 3600); setcookie($this->sessionName."id", 0, time() - 3600); setcookie($this->sessionName."naam", "", time() - 3600); } return false; } } */ /* Logout() Function Logs out de current user */ function logout() { //@session_destroy(); if($this->cookie){ unset($_COOKIE[$this->sessionName]); setcookie($this->sessionName, "", time() - 3600); } session_start(); unset($_SESSION[$this->sessionName]); unset($_SESSION[$this->sessionName."rechten"]); unset($_SESSION[$this->sessionName."id"]); unset($_SESSION[$this->sessionName."naam"]); //exit(); } /* LoginTable($fb) Function Shows the login form. Optional parameter: $fb for showing feedback */ function loginTable() { ?>
Gebruikersnaam
Wachtwoord
 
 
getFeedback(); if(!$action) $action = BASEURL.PHP_SELF; ?>