--- /dev/null
+#!/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);
+?>
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) {