## Wrap up the mail function so we can prepend a tag to the subject# line that indicates what testbed. Useful when multiple testbed# email to the same list.## functionTBMAIL($to,$subject,$message,$headers=0){global$THISHOMEBASE;$subject=strtoupper($THISHOMEBASE).": $subject";if($headers)returnmail($to,$subject,$message,$headers);elsereturnmail($to,$subject,$message);}

## Verify a URL.#functionVERIFYURL($url){global$HTTPTAG;if(strlen($url)){if(strstr($url," ")){USERERROR("URL ($url) is malformed; spaces are not allowed. "."Please go back and fix it up.",1);}if(strcmp($HTTPTAG,substr($url,0,strlen($HTTPTAG)))){USERERROR("URL ($url) must begin with $HTTPTAG. "."Please go back and fix it up.",1);}

## Verify a URL.#functionCHECKURL($url,&$error){global$HTTPTAG;if(strlen($url)){if(strstr($url," ")){$error="URL is malformed; spaces are not allowed!";return0;}if(strcmp($HTTPTAG,substr($url,0,strlen($HTTPTAG)))){$error="URL is malformed; must begin with $HTTPTAG!";return0;}$fp=@fopen($url,"r");if(!$fp){$error="URL is not valid; Cannot be accessed!";return0;}fclose($fp);}return1;}## Check a password.#functionCHECKPASSWORD($uid,$password,$name,$email,&$error){global$TBCHKPASS_PATH;$mypipe=popen(escapeshellcmd("$TBCHKPASS_PATH$password$uid '$name:$email'"),"w+");if($mypipe){$retval=fgets($mypipe,1024);if(strcmp($retval,"ok\n")!=0){$error="$retval";return0;}return1;}TBERROR("Checkpass Failure! Returned '$mypipe'.\n\n"."$TBCHKPASS_PATH$password$uid '$name:$email'",1);}