4 * These are a handful of useful utilities
5 * Functions that don't belong anyplace else at
6 * the moment end up here
11 * Pad the end of a string with up to
12 * the max length of the string
15 function NBSPPadSuffix ($strInfo, $intMaxLength)
17 $intN = $intMaxLength - strlen($strInfo);
21 $strInfo = sprintf("%s ", $strInfo);
30 * properly quote the passed value
31 * or return NULL if there is no value at all
33 function SQLQuote ($strValue)
35 /* are we quoting a number or string? */
37 if (is_string($strValue) == true) {
40 if (strlen($strValue) == 0) { return "NULL"; }
41 if ($strValue == NULL) { return "NULL"; }
42 /* remove any '\' values */
43 $strValue = preg_replace("/\\\/", '', $strValue);
44 return "'". preg_replace("/\'/", "''", $strValue) ."'";
49 if (is_null($strValue)) { return "NULL"; }
50 if ($strValue == 0) { return "0"; }
51 else { return $strValue; }
57 * Get the HTML (GET or POST) parameters
60 function GetParameters ()
62 if ($_SERVER["REQUEST_METHOD"]=="POST") {
63 foreach ($_POST as $key => $value) {
64 // echo $key."=".$value."<br>\n";
65 $parameters[$key] = $value;
68 else if ($_SERVER["REQUEST_METHOD"]=="GET") {
69 foreach ($_GET as $key => $value) {
70 $parameters[$key] = $value;