]> andersk Git - sql-web.git/commitdiff
signup: lower minimum UIDs
authorJoe Presbrey <presbrey@mit.edu>
Mon, 9 Apr 2007 23:58:01 +0000 (23:58 +0000)
committerJoe Presbrey <presbrey@mit.edu>
Mon, 9 Apr 2007 23:58:01 +0000 (23:58 +0000)
setup: note to change passwords in .my.cnf
dbaccess, security, joe: typing bug

git-svn-id: svn://presbrey.mit.edu/sql/web/main@125 a142d4bd-2cfb-0310-9673-cb33a7e74f58

12 files changed:
batch/php.ini [new symlink]
batch/signup.php
bin/php.ini [new symlink]
contrib/php.ini [new symlink]
cron/checkProcesses.php
cron/php.ini [new symlink]
lib/dbaccess.lib.php
lib/joe/util.lib.php
lib/php.ini [new symlink]
lib/security.lib.php
tpl/php.ini [new symlink]
tpl/setup.php

diff --git a/batch/php.ini b/batch/php.ini
new file mode 120000 (symlink)
index 0000000..9fc31db
--- /dev/null
@@ -0,0 +1 @@
+../php.ini
\ No newline at end of file
index edfde59b3757369814f2ca64d2b9fdaa42c9f038..50041296f75041e1d943c9ff7722046961c5405b 100755 (executable)
@@ -19,7 +19,7 @@ if (count($hesinfo)>=4) {
 $myEmail = $myUsername.'@mit.edu';
 $myPassword = substr(md5(uniqid()),0,8);
 
-if ($myUID<1000) exit('bad UID');
+if ($myUID<100) exit('bad UID');
 
 $Login = new Login($myUsername);
 if (!$Login->exists() && !empty($myUsername)) {
diff --git a/bin/php.ini b/bin/php.ini
new file mode 120000 (symlink)
index 0000000..1d5ae9c
--- /dev/null
@@ -0,0 +1 @@
+/afs/athena.mit.edu/contrib/sql/web_scripts/main/php.ini
\ No newline at end of file
diff --git a/contrib/php.ini b/contrib/php.ini
new file mode 120000 (symlink)
index 0000000..1d5ae9c
--- /dev/null
@@ -0,0 +1 @@
+/afs/athena.mit.edu/contrib/sql/web_scripts/main/php.ini
\ No newline at end of file
index a33e9694adf1418f8b38d92350dcd95a303124d6..d927e58c1d3f5d54ad75e93493b2b86cf6c825d6 100755 (executable)
@@ -5,7 +5,7 @@ require_once('mitsql.cfg.php');
 require_once('mitsql.lib.php');
 isOffline() && exit;
 
-define('MAX_PROC_TIME', 10);
+define('MAX_PROC_TIME', 30);
 
 $baddbs = $badusers = $bad = array();
 $result = mysql_query('SHOW FULL PROCESSLIST');
@@ -18,12 +18,13 @@ while ($row = mysql_fetch_assoc($result)){
 }
 mysql_free_result($result);
 
+print_r($bad);
 foreach($bad as $badproc) {
        $mailtos = $mailnames = array();
        $baddb = mysql_escape_string($badproc['db']);
+       if (empty($baddb)) continue;
        $badtime = $badproc['Time'];
        $badquery = $badproc['Info'];
-       if (empty($baddb)) continue;
        $sql = "SELECT User.UserId,User.Name,User.Email
                        FROM `User`
                        NATURAL JOIN DBOwner
@@ -35,10 +36,13 @@ foreach($bad as $badproc) {
                $mailtos[] = $addy['Email'];
                $mailnames[] = $addy['Name'];
        }
-       if (empty($mailtos)) continue;
+       if (empty($mailtos)) {
+               echo "No email found for $baddb\n";
+               continue;
+       }
        $mailto = implode(', ',$mailtos);
        $mailname = implode(', ',$mailnames);
-       $mailsubj = "[sql] Slow Query on $baddb";
+       $mailsubj = "[sql.mit.edu] Slow Query on $baddb";
        $mailbody = "Dear $mailname:
 
 A slow query was found on your database: $baddb
@@ -49,7 +53,9 @@ been appended to this message for your records. Please optimize your
 queries to avoid having your queries killed in the future. If you have any
 questions, please contact sql@mit.edu.
 
-This SQL Service is available at sql.mit.edu.
+The SQL Service
+Email: <sql@mit.edu>
+Web: http://sql.mit.edu/
 
 ---------------------------------------------------------------------------
 
diff --git a/cron/php.ini b/cron/php.ini
new file mode 120000 (symlink)
index 0000000..9fc31db
--- /dev/null
@@ -0,0 +1 @@
+../php.ini
\ No newline at end of file
index 883e138c706792b2b853c395a79b6cc2cd8e03ab..7fcf65af66daf74770d903746336780b416addad 100644 (file)
@@ -12,7 +12,7 @@ function checkQuotas($userId=null) {
        } else {
                if (is_array($userId)) {
                        $sql_userId = sprintf("UserId IN ('%s')", implode("','",array_map('mysql_escape_string',$userId)));
-               } elseif (is_numeric($userId)) {
+               } elseif ((string)intval($userId)===(string)$userId) {
                        $sql_userId = sprintf("UserId = '%s'", mysql_escape_string($userId));
                } else {
                        die('userId parameter error in checkQuotas');
index dd7be0aa74fd709526d41094797ac899f9126cd8..80321c7656f3f453f6f20cc2ad7713767f35cdde 100644 (file)
@@ -83,7 +83,7 @@ function fetchRows($rs, $key = null) {
             while ($r = mysql_fetch_assoc($rs)) {
                 $arr[] = $r;
             }
-        } elseif (is_numeric($key)) {
+        } elseif ((string)intval($key)===(string)$key) {
             while ($r = mysql_fetch_row($rs)) {
                 $arr[$r[$key]] = $r;
             }
diff --git a/lib/php.ini b/lib/php.ini
new file mode 120000 (symlink)
index 0000000..1d5ae9c
--- /dev/null
@@ -0,0 +1 @@
+/afs/athena.mit.edu/contrib/sql/web_scripts/main/php.ini
\ No newline at end of file
index bb32be66c55a1d1ed3bda5186532a296699ae589..98fdd51bb855ebea983fd7c42ca1320753f3d630 100644 (file)
@@ -12,7 +12,7 @@ class Login {
                if (empty($u)) return;
                $this->u = $u;
                $this->p = $p;
-               if (is_numeric($u)) {
+               if ((string)intval($u)===(string)$u) {
                        $this->id = $u;
                        $opt = sprintf(" Username = '%s' OR UserId = '%s'", mysql_escape_string($u), mysql_escape_string($u));
                } else {
diff --git a/tpl/php.ini b/tpl/php.ini
new file mode 120000 (symlink)
index 0000000..1d5ae9c
--- /dev/null
@@ -0,0 +1 @@
+/afs/athena.mit.edu/contrib/sql/web_scripts/main/php.ini
\ No newline at end of file
index 284a69a7e2fef1ac921f601f6e36393d0d0a0034..f82157386d45e3ca6726c655f152d834968769c8 100755 (executable)
@@ -9,7 +9,6 @@ Your MySQL password should be different from your Athena account password.<br>
 
 <?php printErrors($err); ?>
 <?php printMsgs($msg); ?>
-
 <form method="post" action="<?=$URI?>">
 <table>
 <?/*
@@ -19,6 +18,9 @@ Your MySQL password should be different from your Athena account password.<br>
 <tr><td align="right" colspan=2><br /><input name="chgpw" type="submit" value="change password"></td></tr>
 </table>
 </form>
+<br />
+<hr />
+Note: you need to also <a href="http://scripts.mit.edu/faq/59">update your .my.cnf file on Athena</a> if you want to use SIPB <a href="http://scripts.mit.edu/start/">scripts auto-installers</a> or access the MySQL service from the command-line.
 
 <?php
 include 'foot.php';
This page took 0.078531 seconds and 5 git commands to generate.