Esempio n. 1
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");
         $thisError->setErrorPage($_SERVER['PHP_SELF']);
         $thisError->setQuitProgram(true);
         $thisError->handleError();
     }
     return $tokens[0];
 }
Esempio n. 2
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();
     }
 }
Esempio n. 3
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 © 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;
         }
     }
 }