}
}
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;
require_once('mitsql.cfg.php');
require_once('mitsql.lib.php');
+define('MAXDBS', 20);
+
if (!isLoggedIn()) redirect('index');
$err1 = $msg1 = array();
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.';
}
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 {
</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';
<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 } ?>
include 'head.php';
?>
-<h2>Change Password</h2>
+<h2>Change SQL Password</h2>
<?php printErrors($err); ?>
<?php printMsgs($msg); ?>