]> andersk Git - sql-web.git/commitdiff
lighttpd remote signups
authorJoe Presbrey <presbrey@mit.edu>
Tue, 21 Aug 2007 23:05:07 +0000 (23:05 +0000)
committerJoe Presbrey <presbrey@mit.edu>
Tue, 21 Aug 2007 23:05:07 +0000 (23:05 +0000)
git-svn-id: svn://presbrey.mit.edu/sql/web/dev@141 a142d4bd-2cfb-0310-9673-cb33a7e74f58

batch/signup-client.php [new file with mode: 0755]
batch/signup.php
contrib/deleteuser.sql

diff --git a/batch/signup-client.php b/batch/signup-client.php
new file mode 100755 (executable)
index 0000000..1898efd
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/php -q
+<?php
+
+require_once(dirname(__FILE__).'/../mitsql.cfg.php');
+require_once('mitsql.lib.php');
+
+require_once('batch.inc.php');
+
+if (!defined('SIGNUP_PW') || strlen(SIGNUP_PW)==0) exit;
+if (!isset($argv) || count($argv) < 4) exit;
+$myUsername = $argv[1];
+$myUID = $argv[3];
+if ($myUID<100) exit('bad UID');
+
+if (!extension_loaded('curl'))
+    @dl('curl.so');
+
+//$cx = curl_init(BASE_HTTPS.BASE_URL.'do/batch/signup');
+$cx = curl_init('https://scripts2.mit.edu/dev/do/batch/signup');
+curl_setopt($cx, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
+curl_setopt($cx, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($cx, CURLOPT_SSL_VERIFYHOST, false);
+curl_setopt($cx, CURLOPT_SSL_VERIFYPEER, false);
+curl_setopt($cx, CURLOPT_POST, true);
+curl_setopt($cx, CURLOPT_POSTFIELDS, 'u='.$myUsername);
+curl_setopt($cx, CURLOPT_USERPWD, 'signup:'.SIGNUP_PW);
+echo curl_exec($cx);
+?>
index 99785226b2b3dc2ce762eadf19bc86910f300094..20175b97dfdfc7ac28a242af27095208aeb1447e 100755 (executable)
@@ -6,10 +6,17 @@ require_once('mitsql.lib.php');
 
 require_once('batch.inc.php');
 
-$myUsername = $argv[1];
-$myUID = $argv[3];
-if ($myUID<100) exit('bad UID');
+if (isset($argv) && count($argv)>=4) {
+    $myUsername = $argv[1];
+    $myUID = $argv[3];
+    if ($myUID<100) exit('bad UID');
+} elseif (defined('SIGNUP_PW') && strlen(SIGNUP_PW) && (isset($_SERVER['HTTP_AUTHORIZATION']) || isset($_SERVER['PHP_AUTH_PW'])) && SIGNUP_PW == $_SERVER['PHP_AUTH_PW']) {
+    $myUsername = $i_u;
+} else {
+    exit;
+}
 
+if (empty($myUsername)) exit('bad User');
 $hescmd = "hesinfo $myUsername passwd";
 $hesinfo = explode(':', trim(exec($hescmd)));
 if (count($hesinfo)>=4) {
index 2447df938ffee7cfa78a5fbe95a13af7f85fe41d..c208ad825dd957534542a6969695aa65f5ffe57f 100644 (file)
@@ -1,5 +1,5 @@
 
-SET @NAME=185;
+SET @NAME=1340;
 
 USE mitsql;
 DELETE FROM DBQuota WHERE DatabaseId IN (SELECT DatabaseId FROM DBOwner WHERE UserId = @NAME);
This page took 0.033872 seconds and 5 git commands to generate.