Example #1
0
 function logError($msg)
 {
     include_once dirname(__FILE__) . "/error.class.inc.php";
     $e = new errorHandler();
     $e->setError(9, "Logging error: " . $msg);
     $e->dumpError();
     return;
 }
 public static function error_report_array($arr)
 {
     $fp = fopen('./' . errorHandler::uuid() . '.log', 'wb');
     $res = "";
     util::printArray($res, $arr);
     fwrite($fp, $res);
     fclose($fp);
 }
Example #3
0
 /**
  * @return put return description here..
  * @param param :  parameter passed to function
  * @desc buildDropDown($idField,$labelField,$tableName,$conditionField="",$conditionValue="",$labelField2 = "") :  put function description here ...
  */
 function buildDropDown($idField, $labelField, $tableName, $conditionField = "", $conditionValue = "", $labelField2 = "")
 {
     global $db;
     if ($labelField2 != "") {
         $lab2 = ", {$labelField2}";
     } else {
         $lab2 = "";
     }
     if ($conditionField != "") {
         $whereClause = " where {$conditionField}='{$conditionValue}' ";
     }
     $querydrop = "select {$idField},{$labelField} {$lab2} from {$tableName} {$whereClause} ";
     $thisDatabaseQuery = new databaseQuery();
     $thisDatabaseQuery->setSqlQuery($querydrop);
     $thisDatabaseQuery->executeQuery();
     $result = $thisDatabaseQuery->getResultSet();
     if ($result == false) {
         $thisError = new errorHandler();
         $thisError->setUserErrorMessage("An Error Occured while trying to build drop down box from database");
         $thisError->setProgramErrorMessage("An Error Occured while trying to build drop down box from database in function buildDropDown()" . $querydrop);
         $thisError->handleError();
     } else {
         if ($result->RowCount() == 0) {
             return "";
         } else {
             if ($result->RowCount() > 0) {
                 while (!$result->EOF) {
                     $id = $result->fields[$idField];
                     $label = $result->fields[$labelField];
                     if ($labelField2 != "") {
                         $label2 = $result->fields[$labelField2];
                     }
                     echo "<option value=\"{$id}\">{$label}";
                     if ($labelField2 != "") {
                         echo " {$label2} ";
                     }
                     echo "</option>";
                     $result->MoveNext();
                 }
             }
         }
     }
 }
Example #4
0
 /**
  * @return put return description here..
  * @param param :  parameter passed to function
  * @desc decode :  put function description here ... 
  */
 function decode($string)
 {
     // Write Function Code Here
     $string = base64_decode($string);
     $tokens = explode($this->getSeparator(), $string);
     if ($tokens[1] != $this->getSalt()) {
         $thisError = new errorHandler();
         $thisError->setUserErrorMessage("Data Tampering Detected !! Administrator has been notified ! ");
         $thisError->setProgramErrorMessage("POST DATA TAMPERING -->" . $string);
         $thisError->setErrorPage($_SERVER['PHP_SELF']);
         $thisError->setEmailAdmin(false);
         $thisError->setQuitProgram(true);
         $thisError->handleError();
     }
     return $tokens[0];
 }
Example #5
0
<?php

require_once dirname(__FILE__) . '/../header.php';
?>

<div class="container">

    <form class="form-signin" action='../pages/login' method="post">
        <h2 class="form-signin-heading">Please sign in</h2>
        <label for="inputUsername" class="sr-only">Username</label>
        <input type="text" name='username' id="inputUsername" class="form-control" placeholder="Username" required autofocus>
        <label for="inputPassword" class="sr-only">Password</label>
        <input type="password" name='password' id="inputPassword" class="form-control" placeholder="Password" required></br>
<!--        <div class="checkbox">
            <label>
                <input type="checkbox" value="remember-me"> Remember me
            </label>
        </div>-->
        <button class="btn btn-lg btn-primary btn-block" type="submit" name='login' value='login'>Sign in</button></br>
        <div>
            <a href="../candidat/create" class="btn btn-default btn-sm btn-block">Create Candidat Account</a>
            <a href="../companie/create" class="btn btn-default btn-sm btn-block">Create Companie Account</a>
        </div>
        <?php 
errorHandler::printErrorsOnStack();
?>
    </form>

</div>
Example #6
0
if (@(!($etomiteDBConn = mysql_connect($database_server, $database_user, $database_password)))) {
    die("Failed to create the database connection!");
} else {
    mysql_set_charset($database_charset);
    mysql_select_db($dbase);
}
// get the settings from the database
include_once "../includes/settings.inc.php";
// include version info
include_once "../includes/version.inc.php";
// include the crypto thing
include_once "../includes/crypt.class.inc.php";
startCMSSession();
// include_once the error handler
include_once "../includes/error.class.inc.php";
$e = new errorHandler();
// if $max_attempts system setting is set, use it, otherwise set to 3
$max_attempts = !empty($max_attempts) ? $max_attempts : 3;
$username = preg_replace("/[^\\w\\.@-]/", "", htmlspecialchars($_POST['username']));
$givenPassword = preg_replace("/[^\\w\\.@-]/", "", htmlspecialchars($_POST['password']));
$captcha_code = preg_replace("/[^\\w\\.@-]/", "", $_POST['captcha_code']);
$sql = "SELECT {$dbase}." . $table_prefix . "manager_users.*, {$dbase}." . $table_prefix . "user_attributes.* FROM {$dbase}." . $table_prefix . "manager_users, {$dbase}." . $table_prefix . "user_attributes WHERE {$dbase}." . $table_prefix . "manager_users.username REGEXP BINARY '^" . $username . "\$' and {$dbase}." . $table_prefix . "user_attributes.internalKey={$dbase}." . $table_prefix . "manager_users.id;";
$rs = mysql_query($sql);
$limit = mysql_num_rows($rs);
if ($limit == 0 || $limit > 1) {
    $e->setError(900);
    $e->dumpError();
}
$row = mysql_fetch_assoc($rs);
$internalKey = $row['internalKey'];
$dbasePassword = $row['password'];
Example #7
0
 function countReturnRows()
 {
     $this->buildSearchSQL();
     $query = new databaseQuery();
     $query->setSqlQuery($this->getSql());
     //$result = $query->getDbConn()->Execute($newQuery);
     $result = $query->countResultSet();
     if ($result == false) {
         $thisError = new errorHandler();
         $thisError->setUserErrorMessage("A Database Error Occured while counting result Rows ");
         $thisError->setProgramErrorMessage($this->dbConn->ErrorMsg());
         $thisError->setErrorPage($_SERVER['PHP_SELF']);
         $thisError->handleError();
         return 0;
     } else {
         return $query->getTotalRows();
     }
 }
Example #8
0
    exit;
}
// include_once the language file
if (!isset($manager_language)) {
    $manager_language = "english";
    // if not set, get the english language file.
}
$_lang = array();
include_once "includes/lang/english.inc.php";
$length_eng_lang = count($_lang);
if ($manager_language != "english") {
    include_once "includes/lang/" . $manager_language . ".inc.php";
}
// include_once the error handler
include_once "includes/error.class.inc.php";
$e = new errorHandler();
// first we check to see if this is a frameset request
if (!isset($_POST['a']) && !isset($_GET['a']) && $e->getError() == 0) {
    // this looks to be a top-level frameset request, so let's serve up a frameset
    include_once "frames/1.php";
    exit;
}
// retrieve the action directive form the request
if (isset($_GET['a']) && isset($_POST['a'])) {
    $e->setError(100);
    $e->dumpError();
    // set $e to a corresponding errorcode
    // we know that if an error occurs here, something's wrong,
    // so we dump the error, thereby stopping the script.
} else {
    $action = $_REQUEST['a'];
Example #9
0
if (!isset($_SESSION['mgrValidated'])) {
    echo "Not Logged In!";
    exit;
}
// include_once the style variables file
if (isset($manager_theme) && !isset($_style)) {
    $_style = array();
    include_once "media/style/" . $manager_theme . "/style.php";
}
// check if user is allowed to access manager interface
if (isset($allow_manager_access) && $allow_manager_access == 0) {
    include_once "manager.lockout.inc.php";
}
// include_once the error handler
include_once "error.class.inc.php";
$e = new errorHandler();
// Initialize System Alert Message Queque
if (!isset($_SESSION['SystemAlertMsgQueque'])) {
    $_SESSION['SystemAlertMsgQueque'] = array();
}
$SystemAlertMsgQueque =& $_SESSION['SystemAlertMsgQueque'];
// first we check to see if this is a frameset request
if (!isset($_POST['a']) && !isset($_GET['a']) && $e->getError() == 0 && !isset($_POST['updateMsgCount'])) {
    // this looks to be a top-level frameset request, so let's serve up a frameset
    include_once "frames/1.php";
    exit;
}
// OK, let's retrieve the action directive from the request
if (isset($_GET['a']) && isset($_POST['a'])) {
    $e->setError(100);
    $e->dumpError();
Example #10
0
 /**
  * @return a number representing the total number of result rows in a query
  * @desc counts the total number of rows for a query..
  * @version 1.0 [2004-08-06]
  * @license GNU GPL License
  * @author Nilesh Dosooye 
  * @copyright Copyright &copy; 2003, Nilesh Dosooye
  */
 function countResultSet()
 {
     // count only if query is a select query
     if (strtoupper(substr($this->getSqlQuery(), 0, 6)) != "SELECT") {
         $this->setTotalRows("1");
         return true;
     } else {
         // Break query into two parts on 'from' pivot
         list($select, $conditions) = explode(" FROM ", $this->getSqlQuery());
         // replace select fields items by count(*) to find total num of resultsets
         $newQuery = "select count(*) as total from " . $conditions;
         if (DEBUG_PRINT_COUNT_SQL) {
             $timeNow = date("h:i:s");
             echo "<b>Original SQL Query (before count)--></b><font color=green>" . $this->getSqlQuery() . "</font><br>";
             echo "<b>Count SQL Query</b> (<font color=red>" . $timeNow . "</font>)--><font color=green>" . $newQuery . "</font><br>";
         }
         $result = $this->dbConn->Execute($newQuery);
         if ($result == false) {
             $thisError = new errorHandler();
             $thisError->setUserErrorMessage("A Database Error Occured while counting result Rows ");
             $thisError->setProgramErrorMessage($this->dbConn->ErrorMsg());
             $thisError->setErrorPage($_SERVER['PHP_SELF']);
             $thisError->handleError();
             return false;
         } else {
             //$result->MoveNext();
             // Returning ResultSet
             $totalNumberOfRows = $result->fields['total'];
             $this->setTotalRows($totalNumberOfRows);
             return true;
         }
     }
 }
Example #11
0
<?php

//import all the necessary classes and set up the error handler
function exception_error_handler($errno, $errstr, $errfile, $errline)
{
    throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
set_error_handler("exception_error_handler");
try {
    //set up variables
    include 'config.php';
    include 'classes/template_variables.php';
    include 'classes/class_xml.php';
    $xmlstuff = new xmlStuff(array('path' => $xmlpath));
    include 'classes/class_error.php';
    $errorhandler = new errorHandler(array('templatepath' => $templatepath));
    include 'classes/class_url.php';
    $urlhandler = new urlHandler(array('urlsfile' => $urlsfile, 'templatepath' => $templatepath));
    $command = $urlhandler->getURL();
    include 'classes/class_snapd.php';
    //extends class xml
    $cd = new cdHandler(array('command' => $command, 'path' => $templatepath, 'xmlpath' => $xmlpath, 'showall' => $showall, 'itemsperpage' => $itemsperpage));
    include 'classes/class_templating.php';
    $templateHandler = new templateHandler(array('path' => $templatepath, 'relatedfunctions' => $cd, 'matchtemplates' => $matchtemplates));
    $templateHandler->openFile($command);
} catch (Exception $e) {
    $errorhandler->error($e);
}
Example #12
0
 /**
  * Triggers a user created error
  * Example: $error_handler->trigger("Some Warning", E_USER_ERROR);
  *
  * @param string Message
  * @param string Type
  */
 function trigger($message = "", $type = E_USER_ERROR)
 {
     $this->debug->log->error("\$message: {$message} \$type: {$type}");
     parent::trigger($message, $type);
 }
Example #13
0
 function userLogin($username, $password, $rememberme = 0, $url = "", $id = "", $alias = "", $use_captcha = 0, $captcha_code = "")
 {
     // Performs user login and permissions assignment
     // And combination of the following variables can be sent
     // Defaults to current document
     // $url   = and fully qualified URL (no validation performed)
     // $id    = an existing document ID (no validation performed)
     // $alias = any document alias (no validation performed)
     // include the crypto thing
     include_once "./manager/includes/crypt.class.inc.php";
     // include_once the error handler
     include_once "./manager/includes/error.class.inc.php";
     $e = new errorHandler();
     if ($use_captcha == 1) {
         if ($_SESSION['veriword'] != $captcha_code) {
             unset($_SESSION['veriword']);
             $e->setError(905);
             $e->dumpError();
             $newloginerror = 1;
         }
     }
     unset($_SESSION['veriword']);
     $username = htmlspecialchars($username);
     $givenPassword = htmlspecialchars($password);
     $sql = "SELECT " . $this->db . "manager_users.*, " . $this->db . "user_attributes.* FROM " . $this->db . "manager_users, " . $this->db . "user_attributes WHERE " . $this->db . "manager_users.username REGEXP BINARY '^" . $username . "\$' and " . $this->db . "user_attributes.internalKey=" . $this->db . "manager_users.id;";
     $rs = $this->dbQuery($sql);
     $limit = $this->recordCount($rs);
     if ($limit == 0 || $limit > 1) {
         $e->setError(900);
         $e->dumpError();
     }
     $row = $this->fetchRow($rs);
     $_SESSION['shortname'] = $username;
     $_SESSION['fullname'] = $row['fullname'];
     $_SESSION['email'] = $row['email'];
     $_SESSION['phone'] = $row['phone'];
     $_SESSION['mobilephone'] = $row['mobilephone'];
     $_SESSION['internalKey'] = $row['internalKey'];
     $_SESSION['failedlogins'] = $row['failedlogincount'];
     $_SESSION['lastlogin'] = $row['lastlogin'];
     $_SESSION['role'] = $row['role'];
     $_SESSION['nrlogins'] = $row['logincount'];
     if ($row['failedlogincount'] >= $this->config['max_attempts'] && $row['blockeduntil'] > time()) {
         session_destroy();
         session_unset();
         $e->setError(902);
         $e->dumpError();
     }
     if ($row['failedlogincount'] >= $this->config['max_attempts'] && $row['blockeduntil'] < time()) {
         $sql = "UPDATE " . $this->db . "user_attributes SET failedlogincount='0', blockeduntil='" . (time() - 1) . "' where internalKey=" . $row['internalKey'] . ";";
         $rs = $this->dbQuery($sql);
     }
     if ($row['blocked'] == "1") {
         session_destroy();
         session_unset();
         $e->setError(903);
         $e->dumpError();
     }
     if ($row['blockeduntil'] > time()) {
         session_destroy();
         session_unset();
         $e->setError(904);
         $e->dumpError();
     }
     if ($row['password'] != md5($givenPassword)) {
         session_destroy();
         session_unset();
         $e->setError(901);
         $newloginerror = 1;
         $e->dumpError();
     }
     $sql = "SELECT * FROM " . $this->db . "user_roles where id=" . $row['role'] . ";";
     $rs = $this->dbQuery($sql);
     $row = $this->fetchRow($rs);
     $_SESSION['permissions'] = $row;
     $_SESSION['frames'] = 0;
     $_SESSION['validated'] = 1;
     if ($url == "") {
         $url = $this->makeURL($id, $alias);
     }
     $this->sendRedirect($url);
 }
Example #14
0
 /**
  * Output a database error.
  *
  * @param string The string to present as an error.
  */
 function error($string = "", $query = "", $error = "", $error_no = "")
 {
     $this->db->roll_back();
     if ($this->error_reporting) {
         if (!$query) {
             $query = $this->db->last_query;
         }
         if ($error_no == "") {
             $error_no = $this->error_number($query);
         }
         if ($error == "") {
             $error = $this->error_string($query);
         }
         if (class_exists("errorHandler")) {
             global $error_handler;
             if (!is_object($error_handler)) {
                 require_once MYBB_ROOT . "inc/class_error.php";
                 $error_handler = new errorHandler();
             }
             $error = array("error_no" => $error_no, "error" => $error, "query" => $string);
             $error_handler->error(MYBB_SQL, $error);
         } else {
             trigger_error("<strong>[SQL] [{$error_no}] {$error}</strong><br />{$string}", E_USER_ERROR);
         }
     }
 }
         global $_lang, $_style, $which_editor, $use_editor;
         if ($oT->checkTemplateById($_REQUEST['id'], $_REQUEST['customtable'])) {
             $tbl = (int) $_REQUEST['customtable'];
             $onetbl = $modx->getFullTableName('customtable_' . $tbl);
             $manager_theme = $modx->config['manager_theme'];
             include_once "header.inc.php";
             include_once MODX_BASE_PATH . "/assets/plugins/customtables/mutate_content.dynamic.php";
             include_once "footer.inc.php";
             die;
         }
     }
     if ($action == 5 && isset($_REQUEST['customtable']) && $_POST['mode'] == '27') {
         if (isset($_REQUEST['customtable']) && $oT->checkTemplate($_REQUEST['customtable'])) {
             if (!$modx->hasPermission('save_document')) {
                 include_once MODX_MANAGER_PATH . "includes/error.class.inc.php";
                 $err = new errorHandler();
                 $err->setError(3, "You don't have enough privileges for this action!");
                 $err->dumpError();
             }
             $oT->api->setTable('customtable_' . $_REQUEST['customtable']);
             $oT->updateDoc($_POST);
             $oT->modx->clearCache();
             header('Location:index.php?a=27&customtable=' . $_REQUEST['customtable'] . '&id=' . (int) $_POST['id']);
             echo 'updated';
             die;
         }
     }
     break;
 case 'OnWebPageInit':
     $oT->checkCacheEvents();
     break;
Example #16
0
 /**
  * Output a database error.
  *
  * @param string The string to present as an error.
  */
 function error($string = "")
 {
     if ($this->error_reporting) {
         if (class_exists("errorHandler")) {
             global $error_handler;
             if (!is_object($error_handler)) {
                 require_once MYBB_ROOT . "inc/class_error.php";
                 $error_handler = new errorHandler();
             }
             $error = array("error_no" => $this->error_number(), "error" => $this->error_string(), "query" => $string);
             $error_handler->error(MYBB_SQL, $error);
         } else {
             trigger_error("<strong>[SQL] [" . $this->error_number() . "] " . $this->error_string() . "</strong><br />{$string}", E_USER_ERROR);
         }
     } else {
         return false;
     }
 }
Example #17
0
 function mysqlBackup(&$config, &$dbclass, &$vboptions)
 {
     /* Load Error Codes */
     parent::loadCodes();
     /* Set Default Status */
     $this->STATUS = $this->MESSAGES[NO_ERRORS];
     /* Reference Database Object */
     $this->MYSQL =& $dbclass;
     /* Forum Shutdown System */
     $this->SHUTDOWN =& $config['SHUTDOWN'];
     $this->MESSAGE =& $config['MESSAGE'];
     /* File Saving Information */
     $this->DATE = date($config['DATE']);
     $this->PREFIX =& $config['PREFIX'];
     $this->DUMP_PATH =& $config['DUMP_PATH'];
     /* Backup Method & Lock & Repair*/
     $this->LOCK =& $config['LOCK'];
     $this->REPAIR =& $config['REPAIR'];
     /* Backup Type & Tables & Combine */
     $this->TABLES = array();
     $this->TYPE =& $config['TYPE'];
     $this->TABS =& $config['TABLES'];
     $this->COMBINE =& $config['COMBINE'];
     /* Backup Optimizations */
     $this->INNODB =& $config['INNODB'];
     /* PHP Execution Function */
     $this->COMMAND =& $config['COMMAND'];
     /* Get Database Options */
     if ($this->SHUTDOWN) {
         /* Get Options */
         $this->OPTIONS =& $vboptions;
         /* Check if loaded OK */
         if (!is_array($this->OPTIONS) || empty($this->OPTIONS)) {
             $this->throwError(DB_OPTIONS);
         }
     }
     /* Get Tables List */
     $list = $this->MYSQL->query('SHOW tables');
     while ($table = $this->MYSQL->fetch_array($list, DBARRAY_NUM)) {
         if (in_array($table[0], $this->TABS)) {
             if ($this->TYPE == 1) {
                 $this->TABLES[] = $table[0];
             }
         } else {
             if ($this->TYPE == 2) {
                 $this->TABLES[] = $table[0];
             }
         }
     }
 }