]> andersk Git - sql-web.git/blobdiff - main.php
check quotas function
[sql-web.git] / main.php
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..90bf2ea91a43798cd61bc76c4fb758e1e991dacf 100644 (file)
--- a/main.php
+++ b/main.php
@@ -0,0 +1,39 @@
+<?php
+
+require_once('mitsql.cfg.php');
+require_once('mitsql.lib.php');
+
+if (!isLoggedIn()) redirect('index');
+
+$User = new User($Login->getUserID());
+
+if (isPost()) {
+       if (isset($i_newdb)) {
+               $dbname = $User->getUsername().DELIMETER.$i_newdb;
+               if ($User->isOverQuota()) {
+                       $err[] = 'You are over your quota. You may not add databases.';
+               } elseif ($User->addDB($dbname)==false) {
+                       $err[] = mysql_error();
+               } else {
+                       $msg[] = 'Database `'.$dbname.'` created.';
+               }
+       }
+       if (isset($i_drop)) {
+               $dropdbs = array_keys($i_drop);
+               foreach($dropdbs as $dbname) {
+                       if ($User->delDB($dbname)) {
+                               $msg[] = 'Database `'.$dbname.'` dropped.';
+                       } else {
+                               $err[] = mysql_error();
+                       }
+               }
+       }
+       if (!count($err))
+               $User->refresh();
+}
+
+$myDBs = $User->getDBList();
+
+include 'tpl/main.php';
+
+?>
This page took 1.206158 seconds and 4 git commands to generate.