From 88b7d384233943951e362f954948402eacd81736 Mon Sep 17 00:00:00 2001 From: Joe Presbrey Date: Fri, 9 Sep 2005 02:00:26 +0000 Subject: [PATCH] old admin stuff deleted bar graphs added message output fixed admin impersonate git-svn-id: svn://presbrey.mit.edu/sql/mitsql@47 a142d4bd-2cfb-0310-9673-cb33a7e74f58 --- .htaccess | 8 +++-- admin/index.php | 41 ------------------------ defaults.cfg.php | 2 +- global.act.php | 21 ++----------- global.done.php | 2 +- lib/dbaccess.lib.php | 1 + lib/display.lib.php | 24 ++++++++++++++ lib/joe.lib.php | 7 +++-- lib/security.lib.php | 74 +++++++++++++++++++++++++++++++++++++------- main.php | 1 + mitsql.css | 24 ++++++++++++-- php.ini | 3 +- signup.php | 18 ++++++++--- test.php | 13 ++++++-- tpl/main.php | 27 +++++++++++++--- tpl/menu.php | 8 ++++- 16 files changed, 179 insertions(+), 95 deletions(-) delete mode 100755 admin/index.php diff --git a/.htaccess b/.htaccess index 3263492..a438060 100644 --- a/.htaccess +++ b/.htaccess @@ -6,7 +6,9 @@ #php_value xdebug.remote_port "9000" RewriteEngine On -RewriteBase /~presbrey/mitsql/ +RewriteBase /~sql/dev/ +#RewriteBase http://sql.mit.edu/ +#RewriteBase / #RewriteOptions MaxRedirects=1 @@ -52,7 +54,7 @@ RewriteBase /~presbrey/mitsql/ ## REVISION 4 -RewriteCond %{REQUEST_URI} ^.*/mitsql/do/(.+)$ +RewriteCond %{REQUEST_URI} ^.*/do/(.+)$ RewriteRule ^do/(.+)$ $1.php [QSA] RewriteCond %{REQUEST_FILENAME} !-f @@ -62,7 +64,7 @@ RewriteRule .* do/index [R,L,QSA] #RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ /.+\.php\ HTTP #RewriteRule .* do/index [R,L,QSA] -RewriteCond %{THE_REQUEST} !^(GET|POST)\ /.+mitsql/do/.+\ HTTP +RewriteCond %{THE_REQUEST} !^(GET|POST)\ /.+do/.+\ HTTP RewriteCond %{REQUEST_FILENAME} !\.html$ RewriteCond %{REQUEST_FILENAME} !\.css$ RewriteCond %{REQUEST_FILENAME} !\.jpg$ diff --git a/admin/index.php b/admin/index.php deleted file mode 100755 index 7af9251..0000000 --- a/admin/index.php +++ /dev/null @@ -1,41 +0,0 @@ -fullDBList(); -ksort($dblist); - -echo ''; -$dba->printDBs($dblist); -echo '
'; - -?> \ No newline at end of file diff --git a/defaults.cfg.php b/defaults.cfg.php index ab8bb0f..df1ab09 100644 --- a/defaults.cfg.php +++ b/defaults.cfg.php @@ -15,7 +15,7 @@ $_NEW_USER['UL'] = 1; $_NEW_USER['dCreated'] = 'NOW()'; $_NEW_USER['bEnabled'] = 0; -$_NEW_USERQUOTA['nDatabases'] = 5; +$_NEW_USERQUOTA['nDatabasesHard'] = 5; $_NEW_USERQUOTA['nBytesSoft'] = 26214400; $_NEW_USERQUOTA['nBytesHard'] = 26214400; $_NEW_USERQUOTA['dCreated'] = 'NOW()'; diff --git a/global.act.php b/global.act.php index a260ad7..8fe4a4c 100644 --- a/global.act.php +++ b/global.act.php @@ -10,27 +10,12 @@ if (isset($i_ssl)) { } if (isset($i_reset)) { session_destroy(); session_start(); redirect(newQS('reset')); } -$err = array(); +$msg = $err = array(); ## SESSION VARS $timings = array(); $UserId = sess('UserId'); -/*$Username = ''; -$Name = ''; -$Email = ''; -$UL = 0; -$Login = sess('Login'); - -if (is_a($Login, 'Login')) { - $UserId = $Login->getUserId(); - $Username = $Login->getUsername(); - $Name = $Login->getName(); - $Email = $Login->getEmail(); - $UL = $Login->getUL(); -} else { - $Login = new Login(''); -}*/ $Login = new Login($UserId); ## PROCESS CERTIFICATE @@ -40,7 +25,7 @@ $SSLName = ''; $SSLEmail = ''; $SSLUsername = ''; -if (isSSL()) { +if (isSSL() || !isLoggedIn()) { $SSLName = $SSLCred['Name']; $SSLUsername = $SSLCred['Username']; $SSLEmail = $SSLCred['Email']; @@ -59,4 +44,4 @@ if (isSSL()) { unset($_SESSION['LoginSSL']); } -?> \ No newline at end of file +?> diff --git a/global.done.php b/global.done.php index 576e28e..18d11a4 100644 --- a/global.done.php +++ b/global.done.php @@ -15,4 +15,4 @@ if (DEBUG) { isset($User) && print_r($User); } -?> \ No newline at end of file +?> diff --git a/lib/dbaccess.lib.php b/lib/dbaccess.lib.php index 24fd6dc..bcbc894 100644 --- a/lib/dbaccess.lib.php +++ b/lib/dbaccess.lib.php @@ -12,6 +12,7 @@ function DBSlave($sql) { sessTime($sql); $res = mysql_query($sql); sessTime(); + if (mysql_error()) die($sql."
\n".mysql_error()); return $res; } diff --git a/lib/display.lib.php b/lib/display.lib.php index b1d6d2d..ecb4e49 100644 --- a/lib/display.lib.php +++ b/lib/display.lib.php @@ -20,4 +20,28 @@ function sprintTS($timestamp) { ':'.substr($timestamp,12,2); } +function printBar($percent, $txt1 = '', $txt2 = '') { + $color1 = 'black'; + $color2 = 'white'; + $color3 = 'white'; + $color4 = 'black'; + if ($percent>1) { + $percent = $percent/100; + } /* + } elseif (!is_integer($percent) && $percent<2) { + $percent = $percent*100; + } elseif ($percent == 1) { + $percent = 100; + } */ + $per1 = $per2 = ceil($percent*100); + $per2 = 100 - $per2; + $per1 .= "%"; + $per2 .= "%"; + return ' + + + +
 '.$txt1.' 
 
 
'.$txt2.' '.$per1.'
'; +} + ?> diff --git a/lib/joe.lib.php b/lib/joe.lib.php index 55afc81..04c4dc1 100755 --- a/lib/joe.lib.php +++ b/lib/joe.lib.php @@ -105,9 +105,12 @@ function fetchRows($rs, $key = null) { } } -function printErrors($errArray) { +function printErrors($err) { printList('err', $err); } +function printMsgs($err) { printList('msg', $err); } + +function printList($class,$errArray) { if (isset($errArray) && count($errArray)) { - echo '