66) { $PAR_fbopsid = SubStr($PAR_fbopsid, 0, 66); } } // // //-------------------------------------------------------------------------------- //Obtains the AUTHUSERID and assigns it into a global variable. FALSE is //assigned if the parameter is not passed. Invalid characters are removed, //possibly leading to the empty string if the passed entity is empty or //contains only invalid characters. // //Unit-tested on 20060408. // function PAR_get_authuserid() { global $PAR_authuserid; if ((! isset($_GET["authuserid"])) && (! isset($_POST["authuserid"]))) { $PAR_authuserid = FALSE; return; } else if (isset($_POST["authuserid"])) { $starting_point = $_POST["authuserid"]; } else if (isset($_GET["authuserid"])) { $starting_point = $_GET["authuserid"]; } //Trim all disallowed characters. $starting_point = STRFUNC_force_into_subset($starting_point, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); //Force the string to be all lower case. $starting_point = StrToLower($starting_point); //If the string is now of zero length, treat this parameter //as not existing. if (strlen($starting_point) == 0) { $PAR_authuserid = FALSE; return; } //And assign to the global, which we may be just newly creating. $PAR_authuserid = $starting_point; } // // //-------------------------------------------------------------------------------- //Obtains the AUTHUSERPASSWD and assigns it into a global variable. FALSE is //assigned if the parameter is not passed. Invalid characters are removed, //possibly leading to the empty string if the passed entity is empty or //contains only invalid characters. // //Passwords are not trimmed here. The password is never displayed (so HTML //encoded scripting attacks, etc. shouldn't be possible), and it is better //if downstream software can parse it and potentially display error //messages. // //Passwords will only be accepted as a POST parameter (they should not be //on the command line. // function PAR_get_authuserpasswd() { global $PAR_authuserpasswd; if (! isset($_POST["authuserpasswd"])) { $PAR_authuserpasswd = FALSE; return; } $PAR_authuserpasswd = $_POST["authuserpasswd"]; } // // //-------------------------------------------------------------------------------- //Obtains the SDDT and assigns it into a global variable. FALSE is //assigned if the parameter is not passed. Invalid characters are removed, //possibly leading to the empty string if the passed entity is empty or //contains only invalid characters. // //Unit-tested on 20060408. // function PAR_get_sddt() { global $PAR_sddt; if ((! isset($_GET["sddt"])) && (! isset($_POST["sddt"]))) { $PAR_sddt = FALSE; return; } else if (isset($_POST["sddt"])) { $starting_point = $_POST["sddt"]; } else if (isset($_GET["sddt"])) { $starting_point = $_GET["sddt"]; } //Trim all disallowed characters. $starting_point = STRFUNC_force_into_subset($starting_point, "0123456789"); //And assign to the global, which we may be just newly creating. $PAR_sddt = $starting_point; } // // //-------------------------------------------------------------------------------- //Obtains the SDTIM and assigns it into a global variable. FALSE is //assigned if the parameter is not passed. Invalid characters are removed, //possibly leading to the empty string if the passed entity is empty or //contains only invalid characters. // //Unit-tested on 20060408. // function PAR_get_sdtim() { global $PAR_sdtim; if ((! isset($_GET["sdtim"])) && (! isset($_POST["sdtim"]))) { $PAR_sdtim = FALSE; return; } else if (isset($_POST["sdtim"])) { $starting_point = $_POST["sdtim"]; } else if (isset($_GET["sdtim"])) { $starting_point = $_GET["sdtim"]; } //Trim all disallowed characters. $starting_point = STRFUNC_force_into_subset($starting_point, "0123456789"); //And assign to the global, which we may be just newly creating. $PAR_sdtim = $starting_point; } // // //-------------------------------------------------------------------------------- //Obtains the TODAYNOW and assigns it into a global variable. TRUE is assigned //if ANY value is present for the variable, or FALSE otherwise. // function PAR_get_todaynow() { global $PAR_todaynow; if ((isset($_GET["todaynow"])) || (isset($_POST["todaynow"]))) { $PAR_todaynow = TRUE; } else { $PAR_todaynow = FALSE; } } // // //-------------------------------------------------------------------------------- //Obtains the MENULVLADJST and assigns it into a global variable as either: // FALSE if the parameter is not passed. // -1 if the menu level is to be decremented. // 1 if the menu level is to be incremented. // function PAR_get_menulvladjst() { global $PAR_menulvladjst; if ((! isset($_GET["menulvladjst"])) && (! isset($_POST["menulvladjst"]))) { $PAR_menulvladjst = FALSE; return; } else if (isset($_POST["menulvladjst"])) { $starting_point = $_POST["menulvladjst"]; } else if (isset($_GET["menulvladjst"])) { $starting_point = $_GET["menulvladjst"]; } //Trim all disallowed characters. $starting_point = STRFUNC_force_into_subset($starting_point, "uUdD"); //And assign to the global, which we may be just newly creating. if (($starting_point == "d") || ($starting_point == "D")) $PAR_menulvladjst = -1; else if (($starting_point == "u") || ($starting_point == "U")) $PAR_menulvladjst = 1; else $PAR_menulvladjst = FALSE; } // // //-------------------------------------------------------------------------------- //Obtains the LOGOUT parameter. If this parameter is set to ANY value, //it is a cue to log out the user. // function PAR_get_logout() { global $PAR_logout; if ((! isset($_GET["logout"])) && (! isset($_POST["logout"]))) { $PAR_logout = FALSE; } else { $PAR_logout = TRUE; } } // // //-------------------------------------------------------------------------------- //Obtains the ACKLEVEL and assigns it into a global variable as an integer. //FALSE is assigned if the parameter is not passed or if it is passed but is //invalid. // function PAR_get_acklevel() { global $PAR_acklevel; if ((! isset($_GET["acklevel"])) && (! isset($_POST["acklevel"]))) { $PAR_acklevel = FALSE; return; } else if (isset($_POST["acklevel"])) { $starting_point = $_POST["acklevel"]; } else if (isset($_GET["acklevel"])) { $starting_point = $_GET["acklevel"]; } //Trim all disallowed characters. $starting_point = STRFUNC_force_into_subset($starting_point, "0123456789"); //Remove any leading zeros. while ((strlen($starting_point) > 1) && (SubStr($starting_point, 0, 1) == "0")) $starting_point = SubStr($starting_point, 1); //At this point, the value can't help but syntactically be an integer or the //empty string. if (strlen($starting_point) == 0) { $PAR_acklevel = FALSE; //Empty string. } else if (strlen($starting_point) > 2) { $PAR_acklevel = FALSE; //Too big as an integer. } else { $starting_point = (int)$starting_point; if (($starting_point >= 0) && ($starting_point <= 100)) { $PAR_acklevel = $starting_point; } else { $PAR_acklevel = FALSE; //Out of range as an integer. } } } // // //-------------------------------------------------------------------------------- //End of $RCSfile: par.inc,v $. //-------------------------------------------------------------------------------- ?>