// Database details $dbHost ='localhost'; $dbUser = "olgDBUser"; $dbPass = "xpford65olg!"; $dbName = "olg_users"; $version=''; $imagesAllowed=''; $bgsAllowed=''; $tablePrefix=''; $domain=''; $dateJoined=''; $atsis=0; $redirectToHtml=false; /********************************************************* ** Function: dbconnect() ** ** Desc: Perform database server connection and ** ** database selection operations ** *********************************************************/ function dbConnect() { // Access global variables global $dbHost; global $dbUser; global $dbPass; global $dbName; // Attempt to connect to database server $link = @mysql_connect($dbHost, $dbUser, $dbPass); // If connection failed... if (!$link) { // Inform Flash of error and quit fail("Couldn't connect to database server"); } // Attempt to select our database. If failed... if (!@mysql_select_db($dbName)) { // Inform Flash of error and quit fail("Couldn't find database $dbName"); } return $link; } function getUserData($path){ global $dbName; global $version; global $imagesAllowed; global $bgsAllowed; global $tablePrefix; global $domain; global $dateJoined; global $atsis; global $redirectToHtml; $parts=preg_split('/cliffhoskingart.com/',$path,2); $domain=$_SERVER['HTTP_HOST']; $domain = "cliffhoskingart.com"; $domain=str_replace('www.','',$domain); $domain=str_replace('.s13668.gridserver.com','',$domain); $domain=$domain . $parts[1]; $ownPage='www.'. $domain; // Common functions $link = dbConnect(); $table='olgUsers'; $query = "SELECT * FROM $table WHERE domain = '$domain'"; $result = mysql_query($query); if(mysql_num_rows($result)!=0){ $dbName = 'olg_client_' . mysql_result($result,0,'dbName'); $version = mysql_result($result,0,'version'); $dateJoined = mysql_result($result,0,'dateJoined'); $active = mysql_result($result,0,'active'); $atsis = mysql_result($result,0,'atsis'); if($active=='no'){ header('Location: http://www.onlinegalleries.com.au'); } } else { echo 'failed to find user'; } if($version=='lite'){ $imagesAllowed=20; $bgsAllowed=5; //comment these 2 out while testing lite version out of lite area $dbName = "olg_litedata"; $tablePrefix=basename($path) . '_'; //$cmsFileSize=1400; //$kbAllowed=500; } //see if we should redirec straight to the html version $link = dbConnect(); $table=checkVersion('Config'); $query = "SELECT displayOptions FROM $table"; $result = mysql_query($query); $displayOptions = mysql_result($result,0,'displayOptions'); if($displayOptions>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 "
$val
"; } print "