diff contrib/web/php-user/mlmmj.php @ 769:fc5892d87716

Update php code to use superglobals
author Ben Schmidt
date Fri, 29 Oct 2010 22:13:47 +1100
parents 1180bcbc90d9
children
line wrap: on
line diff
--- a/contrib/web/php-user/mlmmj.php	Thu Oct 21 10:08:35 2010 +1100
+++ b/contrib/web/php-user/mlmmj.php	Fri Oct 29 22:13:47 2010 +1100
@@ -55,22 +55,20 @@
 
     function mlmmj()
 	{
-	    global $HTTP_POST_VARS, $HTTP_SERVER_VARS;
-
 	    // set mandatory vars...
 	    $this->errors = FALSE;
 	    $this->delimiter = "+";
 
-	    if (!isset($HTTP_POST_VARS["email"]) &&
-		!isset($HTTP_POST_VARS["mailinglist"]) &&
-		!isset($HTTP_POST_VARS["job"]) &&
-		!isset($HTTP_POST_VARS["redirect_success"]) &&
-		!isset($HTTP_POST_VARS["redirect_failure"]))
+	    if (!isset($_POST["email"]) &&
+		!isset($_POST["mailinglist"]) &&
+		!isset($_POST["job"]) &&
+		!isset($_POST["redirect_success"]) &&
+		!isset($_POST["redirect_failure"]))
 	    {
 		$this->errors = TRUE;
-		if(isset($HTTP_POST_VARS["redirect_failure"]))
+		if(isset($_POST["redirect_failure"]))
 		{
-		    header("Location: ".$HTTP_POST_VARS["redirect_failure"]);
+		    header("Location: ".$_POST["redirect_failure"]);
 		    exit;
 		}
 		else
@@ -78,25 +76,25 @@
 	    }
 	    else
 	    {
-		if($this->is_email($HTTP_POST_VARS["email"]))
-		    $this->email = $HTTP_POST_VARS["email"];
+		if($this->is_email($_POST["email"]))
+		    $this->email = $_POST["email"];
 		else
 		    $this->error("ERROR: email is not a valid email address.");
 
-		if($this->is_email($HTTP_POST_VARS["mailinglist"]))
-		    $this->mailinglist = $HTTP_POST_VARS["mailinglist"];
+		if($this->is_email($_POST["mailinglist"]))
+		    $this->mailinglist = $_POST["mailinglist"];
 		else
 		    $this->error("ERROR: mailinglist is not a valid email address.");
 		
-		$this->job = $HTTP_POST_VARS["job"];
+		$this->job = $_POST["job"];
 		
 		if(!(($this->job == "subscribe") OR ($this->job == "unsubscribe")))
 		{
 		    $this->error("ERROR: job unknown.");
 		}
 		
-		$this->redirect_failure = $HTTP_POST_VARS["redirect_failure"];
-		$this->redirect_success = $HTTP_POST_VARS["redirect_success"];
+		$this->redirect_failure = $_POST["redirect_failure"];
+		$this->redirect_success = $_POST["redirect_success"];
 
 	    }
 
@@ -110,9 +108,9 @@
 		$subject = $this->job." to ".$this->mailinglist;
 		$body = $this->job;
 		$addheader = "";
-		$addheader .= "Received: from ". $HTTP_SERVER_VARS["REMOTE_ADDR"]
-		    ." by ". $HTTP_SERVER_VARS["SERVER_NAME"]. " with HTTP;\r\n\t".date("r")."\n";
-		$addheader .= "X-Originating-IP: ".$HTTP_SERVER_VARS["REMOTE_ADDR"]."\n";
+		$addheader .= "Received: from ". $_SERVER["REMOTE_ADDR"]
+		    ." by ". $_SERVER["SERVER_NAME"]. " with HTTP;\r\n\t".date("r")."\n";
+		$addheader .= "X-Originating-IP: ".$_SERVER["REMOTE_ADDR"]."\n";
 		$addheader .= "X-Mailer: mlmmj-webinterface powered by PHP/". phpversion() ."\n";
 		$addheader .= "From: ".$this->email."\n";
 		$addheader .= "Cc: ".$this->email."\n";