From 4a77eeb5dfec8bc3e43f8bf2ddfe6d24f8d9c83b Mon Sep 17 00:00:00 2001 From: Joe Presbrey Date: Fri, 9 Sep 2005 18:24:24 +0000 Subject: [PATCH] error code color over quota database limit git-svn-id: svn://presbrey.mit.edu/sql/mitsql@58 a142d4bd-2cfb-0310-9673-cb33a7e74f58 --- lib/security.lib.php | 2 +- main.php | 14 +++++++++++--- mitsql.css | 6 +++--- tpl/main.php | 5 ++++- tpl/menu.php | 6 ++++-- tpl/setup.php | 2 +- 6 files changed, 24 insertions(+), 11 deletions(-) diff --git a/lib/security.lib.php b/lib/security.lib.php index fca7a0f..77baf20 100644 --- a/lib/security.lib.php +++ b/lib/security.lib.php @@ -203,7 +203,7 @@ class User { } } function addDB($name) { - if (in_array($name, $this->getDBList())) return false; + if (in_array($name, array_keys($this->getDBList()))) return false; if (!addDB($name, $this->getUserId())) return false; $this->setAccess($name); return true; diff --git a/main.php b/main.php index a6a0f0e..8a6ac81 100644 --- a/main.php +++ b/main.php @@ -3,6 +3,8 @@ require_once('mitsql.cfg.php'); require_once('mitsql.lib.php'); +define('MAXDBS', 20); + if (!isLoggedIn()) redirect('index'); $err1 = $msg1 = array(); @@ -13,9 +15,15 @@ if (isPost()) { if (isset($i_newdb)) { $dbname = $User->getUsername().DELIMETER.$i_newdb; if ($User->isOverQuota()) { - $err1[] = 'You are over your quota. You may not add databases.'; - } elseif ($User->addDB($dbname)==false) { - $err1[] = mysql_error(); + $err1[] = 'You are over your quota. You may not add more databases.'; + } elseif (count($User->getDBList())>MAXDBS) { + $err1[] = 'You have too many databases. You may not add more databases.'; + } elseif (!$User->addDB($dbname)) { + if (mysql_error()) { + $err1[] = mysql_error(); + } else { + $err1[] = 'Database already exists.'; + } } else { $msg1[] = 'Database `'.$dbname.'` created.'; } diff --git a/mitsql.css b/mitsql.css index f3e4017..721c5be 100644 --- a/mitsql.css +++ b/mitsql.css @@ -93,14 +93,14 @@ div.msg li { list-style-type: square; } div.err { + color: maroon; margin: 0px 20px 20px 20px; background-color: #ccc; border: 1px dashed black; -} -div.err li { - color: maroon; font-variant: small-caps; font-weight: bold; +} +div.err li { list-style-type: square; } pre { diff --git a/tpl/main.php b/tpl/main.php index ea097da..bd3f2f3 100644 --- a/tpl/main.php +++ b/tpl/main.php @@ -54,10 +54,13 @@ if (isset($i_dropask)) {
-

+

+

Manage Data

+

One interface we recommend for managing SQL data is phpMyAdmin. Feel free to use it after you've created your databases above.

+
-Main | -Setup | Refresh | +Setup | +Main | +*/ ?> Admin | diff --git a/tpl/setup.php b/tpl/setup.php index 65a9cc5..a330e14 100755 --- a/tpl/setup.php +++ b/tpl/setup.php @@ -2,7 +2,7 @@ include 'head.php'; ?> -

Change Password

+

Change SQL Password

-- 2.45.0