function SES() { /* debug. if you want to see what vars/values it is capturing, set debug to 1, otheriwse set it to 0. you'll have to view source to see the debugged info, its in HTML comments */ var debug = 0; /* create a list of 'fake' extensions you would like to accept at the end of the URL. Leave blank for nothing. this is more for visual appeal, and really serves no purpose. */ var valid_extensions = "html,htm,cfm,asp,jsp"; /* default extension to use (with the period). leave blank if your extension list above is blank. */ var url_suffix = ".html"; //Lets get the path we want to parse out var path_to_parse = replacenocase(cgi.path_info, cgi.script_name, ""); query_string = path_to_parse; /* the path_to_parse variable is either empty or it contains a / (slash) delimitted list. If its not empty, we need to make sure that the list it contains has a length of at least 2, or else its useless. we need 2 because we need a variable name, and a value. */ if (listlen(path_to_parse, "/") gte 2) { // set a default value for var_name var_name = ""; // loop through each element in the path_to_parse list for (x = 1; x lte listlen(path_to_parse, "/"); x = x + 1) { // if var_name is empty, we know that this item in the list is // going to be the name of our variable if (var_name eq "") { var_name = trim(listgetat(path_to_parse, x, "/")); // lets make sure that the value of var_name can be a syntactically //valid variable name if its not, we'll simply skip ahead and move on if (not refind("^[A-Za-z][A-Za-z0-9_]*$", var_name)) { var_name = ""; x = x + 1; } // if var_name isnt blank, then lets set it as a variable and give it a // value of this item in the list } else { value_to_set = listgetat(path_to_parse, x, "/"); // let's see if we need to remove an "extension" from the end if (trim(valid_extensions) neq "" and x eq listlen(path_to_parse, "/")) { for (ext = 1; ext lte listlen(valid_extensions); ext = ext + 1) { extension = "." & listgetat(valid_extensions, ext); if (right(value_to_set, len(extension)) eq extension) { value_to_set = left(value_to_set, len(value_to_set) - len(extension)); url_suffix = extension; break; } } } setvariable('url.' & var_name, value_to_set); // see if we need to output some debugging if (isdefined("debug") and debug) { writeoutput("" & chr(10)); } // set var_name back to blank to continue on with the loop var_name = ""; } } } return true; }