3){ //go straight to html version //header('Location: home.php'); //redirect handled by js now so that # info can be used to redirect user to correct page in html version $redirectToHtml=true; } } getUserData(getcwd()); /********************************************************* ** ** ** Nothing below here needs to be changed for each install ** ** ** *********************************************************/ //variables for image sizes $bigWidth=950; $bigHeight=600; //reduced these 2 by 10 $midWidth=615; $midHeight=385; $thumbWidth=80; $thumbHeight=80; //function to back slash user submitted data //prevents hacking login function make_safe($variable) { $variable = addslashes(trim($variable)); return $variable; } /********************************************************* ** Function: fail() ** ** Params: $errorMsg - Custom error information ** ** Desc: Report error information back to Flash ** ** movie and exit the script. ** *********************************************************/ function fail($errorMsg) { // Output error information and exit print $errorMsg; exit; } function checkEmail($email) { // Define regular expression $regexp = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"; if (eregi($regexp, $email)) { return true; } else { return false; } } //function to output errors in a list function outputErrors($arr){ print ""; foreach($arr as $key => $val) { print "

$val

"; } print ""; } /* Function directory($directory,$filters) reads the content of $directory, takes the files that apply to $filter and returns an array of the filenames. You can specify which files to read, for example $files = directory(".","jpg,gif"); gets all jpg and gif files in this directory. $files = directory(".","all"); gets all files. */ function directory($dir,$filters){ $handle=opendir($dir); $files=array(); if ($filters == "all"){while(($file = readdir($handle))!==false){$files[] = $file;}} if ($filters != "all"){ $filters=explode(",",$filters); while (($file = readdir($handle))!==false) { for ($f=0;$f 255)) { return "ERR: Range mismatch in one or more values (0-255)"; } else { $arrColors[$x] = strtoupper(str_pad(dechex($arrColors[$x]), 2, 0, STR_PAD_LEFT)); } } } return implode("", $arrColors); } function getRandomImage(){ $link = dbConnect(); $table=checkVersion('galleries'); $query = "SELECT galleryData FROM $table WHERE active=1 AND loginRequired=0 ORDER BY RAND() LIMIT 1"; $result = mysql_query($query); $data = mysql_result($result,0,'galleryData'); $a = json_decode(json_encode(simplexml_load_string($data)),1); //strange behaviour if there was only one image in gallery //if data type of first product is array there are multiple images in gallery //otherwise there is just one image and the file name needs to be accessed differently if(is_array($a[product][0])){ $randomImageIndex=array_rand($a[product]); $randomImage=$a[product][$randomImageIndex][image]; }else{ //just one image in gallery - return it $randomImage=$a[product][image]; } return $randomImage; } function getGalleryName($id){ if($id!='' && is_numeric($id)){ $link = dbConnect(); $table=checkVersion('galleries'); $query = "SELECT galleryHeading FROM $table WHERE galleryID=$id"; $result = mysql_query($query); if ($result && mysql_num_rows($result)==1){ $row = mysql_fetch_array($result); $heading=$row['galleryHeading']; return urldecode($heading); } } } ?>