From 5085530310ff52260aa0c23533ee883f1add85cd Mon Sep 17 00:00:00 2001 From: Joe Presbrey Date: Sun, 17 Jul 2005 02:44:25 +0000 Subject: [PATCH] git-svn-id: svn://presbrey.mit.edu/sql/mitsql@37 a142d4bd-2cfb-0310-9673-cb33a7e74f58 --- login.php | 4 +- mitsql.sql | 165 +++++++++++++++++++++++++++++++++++++++++++++++++ signup.php | 8 ++- tpl/login.php | 2 +- tpl/signup.php | 10 +-- 5 files changed, 179 insertions(+), 10 deletions(-) create mode 100644 mitsql.sql diff --git a/login.php b/login.php index 441c778..18f7531 100644 --- a/login.php +++ b/login.php @@ -4,12 +4,12 @@ require_once('mitsql.cfg.php'); require_once('mitsql.lib.php'); if (isSSL()) { + $Login2 = new Login($SSLUsername); if (is_null($SSLCred)) { $err[] = 'Please install a valid certificate.'; } else { - $Login2 = new Login($SSLUsername); if (!(empty($SSLUsername) || $Login2->exists())) { - addUser($cred); + addUser($SSLCred); $Login = new Login($SSLUsername); } } diff --git a/mitsql.sql b/mitsql.sql new file mode 100644 index 0000000..df06c00 --- /dev/null +++ b/mitsql.sql @@ -0,0 +1,165 @@ +-- MySQL dump 10.9 +-- +-- Host: localhost Database: mitsql +-- ------------------------------------------------------ +-- Server version 4.1.12-nt + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `db` +-- + +DROP TABLE IF EXISTS `db`; +CREATE TABLE `db` ( + `DatabaseId` int(10) unsigned NOT NULL auto_increment, + `Name` varchar(200) NOT NULL default '', + `nBytes` int(10) unsigned NOT NULL default '0', + `dLastCheck` datetime NOT NULL default '0000-00-00 00:00:00', + `dCreated` datetime NOT NULL default '0000-00-00 00:00:00', + `bEnabled` tinyint(3) unsigned NOT NULL default '1', + PRIMARY KEY (`DatabaseId`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `dbowner` +-- + +DROP TABLE IF EXISTS `dbowner`; +CREATE TABLE `dbowner` ( + `DatabaseId` int(10) unsigned NOT NULL default '0', + `UserId` int(10) unsigned NOT NULL default '0', + `GroupId` int(10) unsigned NOT NULL default '0', + KEY `DatabaseId` (`DatabaseId`), + KEY `UserId` (`UserId`), + KEY `GroupId` (`GroupId`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `dbquota` +-- + +DROP TABLE IF EXISTS `dbquota`; +CREATE TABLE `dbquota` ( + `DatabaseId` int(10) unsigned NOT NULL default '0', + `nBytesSoft` int(10) unsigned NOT NULL default '0', + `nBytesHard` int(10) unsigned NOT NULL default '0', + `dCreated` datetime NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (`DatabaseId`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `group` +-- + +DROP TABLE IF EXISTS `group`; +CREATE TABLE `group` ( + `GroupId` int(10) unsigned NOT NULL auto_increment, + `Username` varchar(200) NOT NULL default '', + `Password` varchar(200) NOT NULL default '', + `Name` text NOT NULL, + `Email` text NOT NULL, + `dCreated` datetime NOT NULL default '0000-00-00 00:00:00', + `bEnabled` tinyint(3) unsigned NOT NULL default '1', + PRIMARY KEY (`GroupId`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `groupquota` +-- + +DROP TABLE IF EXISTS `groupquota`; +CREATE TABLE `groupquota` ( + `GroupId` int(10) unsigned NOT NULL default '0', + `nDatabases` int(10) unsigned NOT NULL default '0', + `nBytesSoft` int(10) unsigned NOT NULL default '0', + `nBytesHard` int(10) unsigned NOT NULL default '0', + `dCreated` datetime NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (`GroupId`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `groupstat` +-- + +DROP TABLE IF EXISTS `groupstat`; +CREATE TABLE `groupstat` ( + `GroupId` int(10) unsigned NOT NULL default '0', + `nDatabases` int(10) unsigned NOT NULL default '0', + `nBytes` int(10) unsigned NOT NULL default '0', + `dLastCheck` datetime NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (`GroupId`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `user` +-- + +DROP TABLE IF EXISTS `user`; +CREATE TABLE `user` ( + `UserId` int(10) unsigned NOT NULL auto_increment, + `Username` varchar(200) NOT NULL default '', + `Password` varchar(200) NOT NULL default '', + `Name` text NOT NULL, + `Email` text NOT NULL, + `UL` tinyint(3) unsigned NOT NULL default '1', + `dCreated` datetime NOT NULL default '0000-00-00 00:00:00', + `dSignup` datetime NOT NULL default '0000-00-00 00:00:00', + `bEnabled` tinyint(3) unsigned NOT NULL default '0', + PRIMARY KEY (`UserId`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `usergroup` +-- + +DROP TABLE IF EXISTS `usergroup`; +CREATE TABLE `usergroup` ( + `UserId` int(10) unsigned NOT NULL default '0', + `GroupId` int(10) unsigned NOT NULL default '0', + KEY `UserId` (`UserId`), + KEY `GroupId` (`GroupId`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `userquota` +-- + +DROP TABLE IF EXISTS `userquota`; +CREATE TABLE `userquota` ( + `UserId` int(10) unsigned NOT NULL default '0', + `nDatabases` int(10) unsigned NOT NULL default '0', + `nBytesSoft` int(10) unsigned NOT NULL default '0', + `nBytesHard` int(10) unsigned NOT NULL default '0', + `dCreated` datetime NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (`UserId`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `userstat` +-- + +DROP TABLE IF EXISTS `userstat`; +CREATE TABLE `userstat` ( + `UserId` int(10) unsigned NOT NULL default '0', + `nDatabases` int(10) unsigned NOT NULL default '0', + `nBytes` int(10) unsigned NOT NULL default '0', + `dLastCheck` datetime NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (`UserId`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + diff --git a/signup.php b/signup.php index e958d29..0b52815 100644 --- a/signup.php +++ b/signup.php @@ -4,20 +4,24 @@ require_once('mitsql.cfg.php'); require_once('mitsql.lib.php'); if (!isSSL()) - redirect2(flipSSL()); + redirect('index',false); if (isLoggedIn()) { redirect('index'); } else { - + + if (is_null($SSLCred)) { + $err[] = 'Please install a valid certificate.'; + } else { $Login2 = new Login($SSLUsername); if (isPost() && $Login2->canSignup()) { $u = new User($Login2->getUserId()); $u->signup($i_p1); $Login2->refresh(); } + } } diff --git a/tpl/login.php b/tpl/login.php index 5151449..54abd2b 100644 --- a/tpl/login.php +++ b/tpl/login.php @@ -30,7 +30,7 @@ $otherTxt = isSSL()?' without a Certificate':' with a Certificate'; - +

Signup to use this service.

diff --git a/tpl/signup.php b/tpl/signup.php index c2fed42..f01aa18 100644 --- a/tpl/signup.php +++ b/tpl/signup.php @@ -8,11 +8,13 @@ $thisTxt = isSSL()?' with this Certificate':' via SQL'; +canLogin()): ?>

You are registering as:

+ -canSignup()): ?> +canSignup()): ?>

password:

@@ -20,14 +22,12 @@ $thisTxt = isSSL()?' with this Certificate':' via SQL';
-canLogin()): ?> +canLogin()): ?> -

Login. This account is already signed up.

+

Login. This account is signed up.

-Hi -