--- /dev/null
+<?php
+
+require_once('mitsql.cfg.php');
+require_once('mitsql.lib.php');
+
+checkQuotas();
+
+?>
$_NEW_USER['bEnabled'] = 0;
$_NEW_USERQUOTA['nDatabasesHard'] = 5;
-$_NEW_USERQUOTA['nBytesSoft'] = 26214400;
-$_NEW_USERQUOTA['nBytesHard'] = 26214400;
+$_NEW_USERQUOTA['nBytesSoft'] = 49807360;
+$_NEW_USERQUOTA['nBytesHard'] = 52428800;
$_NEW_USERQUOTA['dCreated'] = 'NOW()';
$_NEW_USERSTAT['nDatabases'] = 0;
), dLastCheck = NOW()";
if (!empty($userId)) $sql .= sprintf(" WHERE UserId = '%s'", mysql_escape_string($userId));
DBUpdate($sql);
+ $sql = "UPDATE UserStat SET nDatabases = (
+ SELECT COUNT(*)
+ FROM DB
+ INNER JOIN DBOwner ON DBOwner.DatabaseId = DB.DatabaseId
+ WHERE DBOwner.UserId = UserStat.UserId
+ AND DB.bEnabled=1
+ GROUP BY UserId
+ ), dLastCheck = NOW()";
+ if (!empty($userId)) $sql .= sprintf(" WHERE UserId = '%s'", mysql_escape_string($userId));
+ DBUpdate($sql);
}
?>
require_once('display.lib.php');
+$BASE_URL = 'http'.(isSSL()?'s':'').'://'.$_SERVER['SERVER_NAME'].BASE_URL;
+
if (isset($_SERVER['REQUEST_URI'])) {
//$thisPath=pathinfo($_SERVER['REQUEST_URI']);
//session_set_cookie_params(0, $thisPath['dirname']);
//$arr = explode('/', $_SERVER['SCRIPT_NAME']);
//session_set_cookie_params(0, '/'.$arr[1].'/');
- session_set_cookie_params(0, $BASE_URL);
+ session_set_cookie_params(0, BASE_URL);
session_start();
define('INTERACTIVE', 1);
} else {
include 'tpl/login.php';
-?>
\ No newline at end of file
+?>
if (!isLoggedIn()) redirect('index');
+$err1 = $msg1 = array();
+
$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.';
+ $err1[] = 'You are over your quota. You may not add databases.';
} elseif ($User->addDB($dbname)==false) {
- $err[] = mysql_error();
+ $err1[] = mysql_error();
} else {
- $msg[] = 'Database `'.$dbname.'` created.';
+ $msg1[] = 'Database `'.$dbname.'` created.';
}
}
if (isset($i_drop)) {
$dropdbs = array_keys($i_drop);
foreach($dropdbs as $dbname) {
if ($User->delDB($dbname)) {
- $msg[] = 'Database `'.$dbname.'` dropped.';
+ $msg1[] = 'Database `'.$dbname.'` dropped.';
} else {
- $err[] = mysql_error();
+ $err1[] = mysql_error();
}
}
}
- if (!count($err))
+ if (!count($err1))
$User->refresh();
}
defined('ADMINDB') || define('ADMINDB', 'mitsql');
$BASE_PATH = dirname(__FILE__).'/';
-$BASE_URL = 'http://'.$_SERVER['SERVER_NAME'].BASE_URL;
-//$BASE_URL = isset($_SERVER['SCRIPT_NAME'])?dirname($_SERVER['SCRIPT_NAME']).'/':'';
set_time_limit(0);
ignore_user_abort(1);
if (mysql_error()) die(mysql_error());
chdir($CWD);
-
?>
--- /dev/null
+<?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_chgpw)) {
+ $p1 = (isset($i_p[1])?$i_p[1]:'');
+ $p2 = (isset($i_p[2])?$i_p[2]:'');
+ if (empty($p1)) {
+ $err[] = 'You may not have a blank password.';
+ } elseif ($p1 != $p2) {
+ $err[] = 'Your confirmation password does not match.';
+ } else {
+ $User->setPassword($p1);
+ $msg[] = 'Your password was changed.';
+ }
+ }
+}
+
+include 'tpl/setup.php';
+
+?>
<h2>Quotas</h2>
<p>
-By default, new users can create up to <strong>5 databases</strong>, consuming a total of <strong>25 megabytes</strong> of SQL data.
+By default, new users can create up to <strong>5 databases</strong>, consuming a total of <strong>50 megabytes</strong> of SQL data.
The system will periodically check your database sizes and suspend creation of new data (INSERT statements) if your total usage exceeds your allotted quota.
</p>
$dropdbs = array_keys($i_dropask);
echo '<form method="post">';
foreach($dropdbs as $dbname) {
- $msg[] = 'Are you sure you want to drop `'.$dbname.'`? <input style="position:absolute; right:20px;" type="submit" name="drop['.$dbname.']" value="Yes">';
+ $msg1[] = 'Are you sure you want to drop `'.$dbname.'`? <input style="position:absolute; right:20px;" type="submit" name="drop['.$dbname.']" value="Yes">';
}
echo '</form>';
}
<h2>Databases</h2>
<form method="post">
-<?php printErrors($err); ?>
-<?php printMsgs($msg); ?>
+<?php printErrors($err1); ?>
+<?php printMsgs($msg1); ?>
</form>
<table width="100%">
$bytes = $User->getBytes();
$usage = $bytes['nBytes'];
$total = $bytes['nBytesHard'];
+ if (!count($myDBs)) {
+ echo '<tr><td width="100%"><em>You have no databases. Add one below.</em></td></tr>';
+ } else
foreach($myDBs as $db) {
echo '<tr><td width="100%">';
if ($total>0)
<?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> |
<?php if (isAdmin()) { ?>
<a href="do/admin/main">Admin</a> |
--- /dev/null
+<?php
+include 'head.php';
+?>
+
+<h2>Change Password</h2>
+
+<?php printErrors($err); ?>
+<?php printMsgs($msg); ?>
+
+<form method="post">
+<table>
+<?/*
+<tr><td align="right">old password:</td><td><input type="password" name="p[0]"></td></tr>*/?>
+<tr><td align="right">new password:</td><td><input type="password" name="p[1]"></td></tr>
+<tr><td align="right">confirm:</td><td><input type="password" name="p[2]"></td></tr>
+<tr><td align="right" colspan=2><br /><input name="chgpw" type="submit" value="change password"></td></tr>
+</table>
+</form>
+
+<?php
+include 'foot.php';
+?>