title = "Link Education"; $site->logo = "link-logo.png"; define('CAPTCHA_SESSION_KEY', "hih78uwdfufdev7"); ?>db = $this->connect(); $this->path = $path; $this->page = $page; $this->session= $_SESSION; } static function connect(){ // Connect to the database // require_once('class.database.php'); $db = new database(str_dbHost, str_dbUser, str_dbPassword, str_dbName); return $db; } static function checkAuth($username, $password, $encrypted){ if ($encrypted === false){ $username = md5($username); $password = md5($password); } return ($username == USER_NAME && $password == PASSWORD); } static function findPage($path){ global $_POST; // This function parses the url, and retrieves the data for the page // $db = Ccms::connect(); $paths = explode("/", $path); $o = array(); if (count($paths) == 1){ // Special Case Home Page $sql = sprintf("select * from page p1 where p1.url = '/'"); $r = $db->select($sql); // OK, so now we have a match if ($db->numrows($r)>0){ $p = $db->fetch_object($r); $parent = "=" . $p->id; $o[] = $p; } } else { $parent = "<=1"; for ($i=1; $iselect($sql); // OK, so now we have a match if ($db->numrows($r)>0){ $p = $db->fetch_object($r); $parent = "=" . $p->id; $o[] = $p; } } } if (count($o)>0 && end($o)->alias!=""){ return Ccms::findPage(end($o)->alias); } else { return $o; } } function __destruct(){ global $db, $_SESSION; if ($db) $db->disconnect(); if (!is_array($this->session['history'])) $this->session['history'] = array(); if (end($this->session['history']) != $this->path && $this->path != ""){ $this->session['history'][] = $this->path; } $_SESSION = $this->session; } } ?>