]> andersk Git - sql-web.git/commitdiff
error code color
authorJoe Presbrey <presbrey@mit.edu>
Fri, 9 Sep 2005 18:24:24 +0000 (18:24 +0000)
committerJoe Presbrey <presbrey@mit.edu>
Fri, 9 Sep 2005 18:24:24 +0000 (18:24 +0000)
over quota database limit

git-svn-id: svn://presbrey.mit.edu/sql/mitsql@58 a142d4bd-2cfb-0310-9673-cb33a7e74f58

lib/security.lib.php
main.php
mitsql.css
tpl/main.php
tpl/menu.php
tpl/setup.php

index fca7a0f2279bfd399bc976dc9d2607ff96a0c968..77baf2005ceed3f8fe3293ee1b93aa20f644da42 100644 (file)
@@ -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;
index a6a0f0e3a9053aa0b6c03bc87fbd519c264f682a..8a6ac81f5110d51e67c3cac6809bfc315d1b133b 100644 (file)
--- 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.';
                }
index f3e4017be2ede9417c4450991dab9a5055eee1f0..721c5be49a4331e818c282213a15a664e0a0f1a5 100644 (file)
@@ -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 {
index ea097da090970d021f51c556721683e0b2d0b369..bd3f2f30295a9b4c14eb3425db2e000d6e4d8975 100644 (file)
@@ -54,10 +54,13 @@ if (isset($i_dropask)) {
 </table>
 
 <form method="post">
-<p><span style="width: 150px;"><label for="p1">new database:</label></span> <input type="text" name="newdb">
+<p align="right"><span style="width: 150px;"><label for="p1">new database:</label></span> <input type="text" name="newdb">
 <input type=submit value="Add"></p>
 </form>
 
+<h2>Manage Data</h2>
+<p>One interface we recommend for managing SQL data is <a href="/~sql/phpMyAdmin/" target="_blank">phpMyAdmin</a>. Feel free to use it after you've created your databases above.</p>
+
 <?php
 
 include 'foot.php';
index bfbeb2ac3ea2cf6f609c7d079a7a2631b6fcf673..9853efb430d17a49370f778f3b6c32c2678b95b9 100644 (file)
@@ -1,9 +1,11 @@
 <div id="content1">
 <?php if (isLoggedIn()): ?>
 <div style="float:left">
-<a href="do/main">Main</a> |
-<a href="do/setup">Setup</a> |
 <a href="do/main?refresh">Refresh</a> |
+<a href="do/setup">Setup</a> |
+<?php /*
+<a href="do/main">Main</a> |
+*/ ?>
 <?php if (isAdmin()) { ?>
 <a href="do/admin/main">Admin</a> |
 <?php } ?>
index 65a9cc54844aea5c977ab282d74b63922f4526b7..a330e14857a9352ae2629c0c3f6bbcb207f7d97d 100755 (executable)
@@ -2,7 +2,7 @@
 include 'head.php';
 ?>
 
-<h2>Change Password</h2>
+<h2>Change SQL Password</h2>
 
 <?php printErrors($err); ?>
 <?php printMsgs($msg); ?>
This page took 0.055868 seconds and 5 git commands to generate.