<?php $conn = mysql_connect('localhost', 'rautor', '\\pass'); $db_selected = mysql_select_db('rautor', $conn); require_once 'TableEditor.php'; $editor = new TableEditor($conn, 'sessions'); $editor->setConfig('allowAdd', false); $editor->setConfig('allowEdit', false); $editor->setConfig('allowCopy', false); #$editor->setConfig('allowDelete', false); #$editor->setConfig('allowCSV', false); #$editor->setConfig('allowView', false); $editor->setConfig('title', 'Manage All Sessions'); $editor->setConfig('footerfile', 'footer.html'); $editor->setConfig('perPage', 20); $editor->setDisplayNames(array('domain' => 'Domain', 'node' => 'PC name', 'username' => 'username', 'timestamp' => 'Start Time', 'sessionid' => 'Session ID', 'status' => 'Status', 'clearedtime' => 'Cleared Time', 'ipadress' => 'IP Address', 'port' => 'Port', 'url' => 'URL')); $editor->setSearchableFields('username', 'node', 'timestamp'); $editor->setRequiredFields('username', 'node', 'domain', 'timestamp', 'status', 'clearedtime', 'sessionid', 'ipadress', 'port'); #$editor->noDisplay('sessionid'); $editor->noDisplay('ipaddress'); $editor->noDisplay('port'); $editor->noDisplay('lastping'); #$editor->noDisplay('clearedtime'); #$editor->noDisplay('status'); $editor->setDefaultOrderby('timestamp,username'); $editor->display(); ?>
<?php $conn = mysql_connect('localhost', 'rautor', '\\pass'); $db_selected = mysql_select_db('rautor', $conn); $ip = $_SERVER['REMOTE_ADDR']; $user = $_SERVER['PHP_AUTH_USER']; mysql_query("insert into admin_logins (username,ip,lastreview) values('{$user}','{$ip}',now())"); mysql_query("update admin_logins set username='******',lastreview=now() where ip='{$ip}'"); ?> <?php /* session display stuff */ require_once 'TableEditor.php'; $editor = new TableEditor($conn, 'sesview'); $editor->setConfig('allowCSV', false); $editor->setConfig('allowView', false); $editor->setConfig('allowAdd', false); $editor->setConfig('allowEdit', false); $editor->setConfig('allowCopy', false); $editor->setConfig('allowDelete', false); $editor->setConfig('title', 'Live Sessions Monitor'); $editor->setConfig('footerfile', 'footer.html'); $editor->setConfig('perPage', 30); $editor->setDisplayNames(array('node' => 'Domain:Terminal', 'username' => 'Login Name', 'timestamp' => 'Sess. Start Time', 'Screen' => 'Live')); $editor->setSearchableFields('username', 'node', 'timestamp'); $editor->setRequiredFields('username', 'node', 'domain', 'timestamp', 'status', 'clearedtime', 'sessionid', 'ipadress', 'port'); $editor->noDisplay('sessionid'); $editor->noDisplay('ipaddress'); $editor->noDisplay('port');
<?php $ResultTables = mysql_list_tables(DB_NAME); $iTables = 0; while ($iTables < mysql_num_rows($ResultTables)) { $TName[$iTables] = mysql_tablename($ResultTables, $iTables); if ($table == $TName[$iTables]) { require_once '' . TEFunctionsPath . 'ClassTableEditor.php'; $link = mysql_connect(DB_HOST, DB_USER, DB_PASS); mysql_select_db(DB_NAME); $editor = new TableEditor($link, $table); if (TEditorActions == true) { $ActionButtons = 1; } else { $ActionButtons = 0; } $editor->setConfig('allowView', $ActionButtons); $editor->setConfig('allowAdd', $ActionButtons); $editor->setConfig('allowEdit', $ActionButtons); $editor->setConfig('allowCopy', $ActionButtons); $editor->setConfig('allowDelete', $ActionButtons); $editor->setConfig('perPage', 20); if (!valida_acceso($table)) { ?> <script language="javascript"> alert("Usted no tiene privilegios a este módulo"); history.back(1); </script> <?php } if (file_exists(TEditorPath . 'TE_TODAS_LAS_TABLAS_javascript_inicio.php')) {
/** * create the personal options options form, using the {@link TableEditor} * * {@link TableEditor} is able to handle saving of the data himself * @uses TableEditor * @return string html-content * @global array country acronyms and names * @global DB used for database access */ function createOptionsForm() { global $country, $db; $cont = '<fieldset class="options-options">'; $cont .= '<legend>Change your options</legend>'; $tEdit = new TableEditor($db, TABLE_USERS, 'userid', array('id' => 'hidden', 'usertype' => 'hidden', 'password' => 'hidden', 'reg_email' => 'hidden', 'confirm_hash' => 'hidden', 'lastLogin' => 'hidden', 'limitEntries' => 'text-5', 'bdayDisplay' => array('NULL' => 'default', '0' => 'no', '1' => 'yes'), 'bdayInterval' => 'text-3', 'telURI' => 'text-30', 'faxURI' => 'text-30', 'language' => array_merge(array('NULL' => 'autodetect'), Localizer::getSingleton()->availableLanguages()), 'useMailScript' => 'hidden', 'failedLogins' => 'hidden', 'lastRemoteIP' => 'hidden'), array('limitEntries' => 'Main list: limit entries per page', 'bdayInterval' => 'Main list: display dates and recently changed contacts n days back', 'bdayDisplay' => 'Main list: display dates', 'telURI' => 'URI: Replace tel: (e.g. skype:$?call)', 'faxURI' => 'URI: Replace fax: (e.g. sip:$@sip.com:5060)', 'language' => 'User interface language', 'useMailScript' => 'Users can send email with a web interface from the server (not supported in 3.0)'), 'SELECT * FROM ' . TABLE_USERS . ' WHERE userid = ' . ($this->user !== null ? $db->escape($this->user->id) : $_SESSION['user']->id), 'text', true, $this->user !== null ? 'userid=' . $this->user->id : ''); $cont .= $tEdit->create('', ''); $cont .= '</fieldset>'; return $cont; }
<?php $conn = mysql_connect('localhost', 'rautor', '\\pass'); $db_selected = mysql_select_db('rautor', $conn); $ip = $_SERVER['REMOTE_ADDR']; $user = $_SERVER['PHP_AUTH_USER']; ?> <?php /* session display stuff */ require_once 'TableEditor.php'; $editor = new TableEditor($conn, 'rautor_sessions'); #$editor->setConfig('allowCSV', false); $editor->setConfig('allowView', false); $editor->setConfig('allowAdd', false); $editor->setConfig('allowEdit', false); $editor->setConfig('allowCopy', false); $editor->setConfig('allowDelete', false); $editor->setConfig('title', 'Rautor Sessions\' Listing'); $editor->setConfig('footerfile', 'footer.html'); $editor->setConfig('perPage', 50); $editor->setDisplayNames(array('path' => 'Full Path where files were saved && PC Name', 'node' => 'Terminal', 'domain' => 'Domain', 'username' => 'Login Name', 'starttime' => 'Session Start Time', 'lastping' => 'Session Last Update', 'clearedtime' => 'Session Stop Time')); $editor->setSearchableFields('username', 'node', 'starttime', 'domain'); $editor->setRequiredFields('username', 'node', 'domain', 'timestamp', 'status', 'clearedtime', 'sessionid', 'ipadress', 'port'); $editor->noDisplay('node'); $editor->noDisplay('ipaddress'); $editor->noDisplay('clearedtime'); #$editor->noDisplay('status');
break; case 'save_page': if (!isset($get['url'])) { die('ERROR 1'); } $result = utils()->savePage(REM . $get['url'], file_get_contents('php://input')); break; case 'get_page': if (!isset($get['url'])) { die('ERROR 1'); } $result = file_get_contents(REM . $get['url']); break; case 'users': include 'cl/TableEditor.php'; $ctr = new TableEditor('users'); $ctr->where = " WHERE role IS NOT 'test'"; $ctr->defaultVals = array('role' => 'admin'); $result = $ctr->process($a); break; // LARGE Classes here // LARGE Classes here case 'cats': include 'cl/Categories.php'; $ctr = new Categories(); $result = $ctr->process($a, $post, $get); break; case 'dests': include 'cl/Destinations.php'; $ctr = new Destinations(); $result = $ctr->process($a, $post, $get);
/** * create the groups editor to change group names {@link TableEditor} * * {@link TableEditor} is able to handle saving of the data himself * @uses TableEditor * @return string html-content * @global array country acronyms and names * @global DB used for database access */ function createGroupTableEditor() { global $country, $db; $cont = '<fieldset class="options-options">'; $cont .= '<legend>Change Group Names</legend>'; $cont .= $this->contextHelp('admin-groups'); $cont .= '<div class="options-clear">'; $tEdit = new TableEditor($db, TABLE_GROUPLIST, 'groupid', array('groupname' => 'text-40', 'acronym' => 'text-5', 'logoURL' => 'text-20', 'groupid' => 'hidden'), array('groupname' => 'Group Name', 'acronym' => 'Acronym', 'logoURL' => 'Logo URL (future use)')); $cont .= $tEdit->create('', ''); $cont .= '</div></fieldset>'; return $cont; }
<?php include '../document.php'; require_once 'TableEditor.php'; if (isset($bzID)) { $substr = explode("|", $bzID); $result = mysql_query("SELECT * FROM passwd WHERE password = '******'1']}' AND username = '******'0']}' AND access = '{$substr['2']}'"); if (mysql_num_rows($result) == 1 && $substr[2] >= 1) { $editor = new TableEditor($db, 'motd'); $editor->setDefaultOrderby('title'); $editor->setConfig('allowCopy', false); $editor->setConfig('allowCSV', false); $editor->noDisplay('id'); $editor->display(); } else { $doc = new Document(); $doc->begin("Edit MOTD", 1); print "Unable to find any any MOTD results"; $doc->end(); } } else { $doc = new Document(); $doc->accessDenied(); }
* Demo of TableEditor class. Uses the following table: * * CREATE TABLE `TableEditorDemo` ( * `te_id` int(10) unsigned NOT NULL auto_increment, * `te_name` varchar(32) NOT NULL default '', * `te_password` varchar(32) NOT NULL default '', * `te_email` varchar(32) NOT NULL default '', * `te_datetime` datetime NOT NULL default '0000-00-00 00:00:00', * `te_age` tinyint(3) unsigned NOT NULL default '0', * `te_live` enum('LIVE','NOT LIVE') default NULL, * `te_desc` mediumtext NOT NULL, * PRIMARY KEY (`te_id`) * ) TYPE=MyISAM; */ require_once 'TableEditor.php'; $editor = new TableEditor($conn, 'rautor'); // $editor->setConfig('allowView', false); // $editor->setConfig('allowAdd', false); // $editor->setConfig('allowEdit', false); // $editor->setConfig('allowCopy', false); // $editor->setConfig('allowDelete', false); $editor->setConfig('perPage', 30); $editor->setDisplayNames(array('te_id' => 'ID', 'te_name' => 'Name', 'te_password' => 'Password', 'te_email' => 'Email', 'te_datetime' => 'Date Added', 'te_age' => 'Age', 'te_live' => 'Live', 'te_desc' => 'Description')); // $editor->noDisplay('te_password'); $editor->noEdit('te_live'); $editor->setInputType('te_password', 'password'); $editor->setInputType('te_email', 'email'); $editor->setSearchableFields('te_name', 'te_age', 'te_id', 'te_desc', 'te_live'); $editor->setRequiredFields('te_name', 'te_email', 'te_datetime', 'te_age', 'te_desc'); $editor->setDefaultOrderby('te_id'); $editor->setDefaultValues(array('te_id' => '0', 'te_live' => 'NOT LIVE'));
<?php $conn = mysql_connect('localhost', 'root', 'banana'); $db_selected = mysql_select_db('rautor', $conn); require_once 'TableEditor.php'; $editor = new TableEditor($conn, 'sesview'); $editor->setConfig('allowCSV', false); $editor->setConfig('allowView', false); $editor->setConfig('allowAdd', false); $editor->setConfig('allowEdit', false); $editor->setConfig('allowCopy', false); $editor->setConfig('allowDelete', false); $editor->setConfig('perPage', 30); $editor->setDisplayNames(array('domain' => 'Domain', 'node' => 'PC name', 'username' => 'username', 'timestamp' => 'Start Time', 'sessionid' => 'Session ID', 'status' => 'Status', 'clearedtime' => 'Cleared Time', 'ipadress' => 'IP Address', 'port' => 'Port', 'url' => 'URL')); $editor->setSearchableFields('username', 'node', 'timestamp'); $editor->setRequiredFields('username', 'node', 'domain', 'timestamp', 'status', 'clearedtime', 'sessionid', 'ipadress', 'port'); $editor->noDisplay('sessionid'); $editor->noDisplay('ipaddress'); $editor->noDisplay('port'); $editor->noDisplay('clearedtime'); $editor->noDisplay('status'); $editor->setDefaultOrderby('username'); #function validateAge(&$obj, $data) #{ # $data = (int)$data; # # if ($data < 18 OR $data > 80) { # $obj->addError('Invalid age! Please enter an age between 18 and 80'); # } # # return $data;