Debug info:

SESSION:
"; print_r($_SESSION); echo "FILES:
"; print_r($_FILES); echo "POST:
"; print_r($_POST); echo "SERVER:
"; print_r($_SERVER); echo ""; } } function main() { global $cfg; $conn = db_connect(); processLanguage($conn); processGalleryHits($conn); processCartActions($conn); $smarty = new Smarty; $smarty->compile_check = true; $smarty->compile_dir = "data/templates_c/o-line-photos.nl/"; $smarty->template_dir = "frontend/o-line-photos.nl"; $smarty->assign("cfg", $cfg); processPage($smarty, $_GET["page"], $conn); db_disconnect($conn); } function validSubmitReferer() { $allowed = array("www.o-line-photos.nl", "o-line-photos.nl"); $url = explode("/", $_SERVER["HTTP_REFERER"]); // temp hack return true; if (in_array($url[2], $allowed)) { return true; } else { return false; } } function processGalleryHits($conn) { if (is_numeric($_POST["numberofgalleryhits"])) { $_SESSION["galleryHits"] = $_POST["numberofgalleryhits"]; $urlParts = parse_url($_SERVER["HTTP_REFERER"]); parse_str($urlParts["query"], $array); $array["start"] = 0; loadPage("/?".http_build_query($array), $conn); } elseif(!$_SESSION["galleryHits"]) { $_SESSION["galleryHits"] = 32; } } function processPage($smarty, $page, $conn) { if (!$page) { loadPage(false, $conn); } $userinfo = processUserInfo($smarty, $conn); $languageContent = getLanguage(); $categories = buildCategorieArray($conn); $smarty->assign("categorien", drawCategories($categories, 0)); $smarty->assign("language", $languageContent); $smarty->assign("returnurl", $_SERVER["REQUEST_URI"]); switch ($page): default: getDynamicPage($_GET["page"], $smarty, $conn); break; case "frontpage": processFrontpage($smarty, $conn); break; case "browsephotos": processBrowsePhotos($smarty, $conn); break; case "browsephotographers": processBrowsePhotographers($smarty, $conn); break; case "preparecard": showPrepareCard($smarty, $conn); break; case "photodetail": showPhotoDetails($smarty, $categories, $_GET["id"], $conn); break; case "exifinformation": showExifInformation($smarty, $_GET["id"], $conn); break; case "login": loginAction($languageContent, $smarty, $conn); break; case "logout": logoutAction($smarty, $conn); break; case "register": registerAction($languageContent, $smarty, $conn); break; case "notloggedin": $smarty->assign("returnurl", $_SERVER["HTTP_REFERER"]); $smarty->assign("template", "notloggedin.tpl"); $smarty->display("index.tpl"); break; case "notloggedinseller": $smarty->assign("template", "notloggedinseller.tpl"); $smarty->display("index.tpl"); break; case "registerphotographer": registerPhotographerAction($languageContent, $smarty, $conn); break; case "forgotpassword": forgotPasswordAction($languageContent, $smarty, $conn); break; case "search": showSearchPhotos($smarty, $_POST["search"], $conn); break; case "showCart": showCart($smarty); break; case "mypurchases": showMyPurchases($smarty, $conn); break; case "mybriefcase": showMyBriefcase($smarty, $conn); break; case "unlinkmr": unlinkmr($conn); break; case "mygallery": showPhotoOwner($smarty, $conn); break; case "mysales": showMySales($smarty, $conn); break; case "mybonus": showMyBonus($smarty, $conn); break; case "silvercode": showSilverCode($smarty, $conn); break; case "myearnings": showMyEarnings($smarty, $conn); break; case "requestpayout": requestPayout($smarty, $conn, $languageContent); break; case "processpayout": processPayout($conn, $smarty, $languageContent); break; case "payoutcomplete": PayoutComplete($conn, $smarty, $languageContent); break; case "managemr": showMyModelRelases($smarty, $_SESSION["user_id"], $conn); break; case "showmrrelations": showLinkedPhotos($smarty, $_SESSION["user_id"], $conn, $languageContent); break; case "processnewmr": processNewModelRelease($conn); break; case "deletemr": processDeleteModelRelease($conn); break; case "messages": showMyMessages($smarty, $conn); break; case "placeassignment": placeAssignments($smarty, $conn, $languageContent); break; case "delass": delAssignments($conn); break; case "browseassignment": showAssignments($smarty, $conn); break; case "editasn": placeAssignments($smarty, $conn, $languageContent); break; case "uploadforassignemt": showUploadPhotos($languageContent, $smarty, $conn, $_GET['id']); break; case "editprofile": showEditProfile($smarty, $_SESSION["user_id"], $conn); break; case "uploadphotos": showUploadPhotos($languageContent, $smarty, $conn, 0); break; case "showUploadResults": showUploadResults($languageContent, $smarty, $conn, $_GET['id']); break; case "massuploadrequest": massUploadRequest($conn, $languageContent); break; case "editphoto": showEditPhoto($smarty, $conn); break; case "buycredits": showBuyCredits($smarty, $conn); break; case "paymentsuccess": processPaymentSuccess($smarty, $conn); break; case "ideal": processIdeal(); break; case "checkout": processCheckOut($smarty, $conn); break; case "contact": showContact($languageContent, $smarty); break; case "downloadphoto": require_once("inc/download.inc.php"); processDownloadPhoto($conn); showMyPurchases($smarty, $conn); break; case "setDelete": processesPhotoDelete($conn); break; case "sendCard": processSendCard($conn, $smarty, $languageContent); break; case "showCardPhoto": showCardPhoto($conn); break; case "cartSent": showCartSent($smarty, $languageContent); break; case "showCardPreview": showCardPreview($conn, $smarty, $languageContent); break; case "showCard": showCard($conn, $smarty, $languageContent); break; case "enlarge": showEnlarge($conn, $smarty, $languageContent); break; case "claimprice": claimPrice($languageContent, $conn, $smarty); break; case "claimdone": claimDone($conn, $smarty, $languageContent); break; case "codecheck": codeCheck($conn, $smarty, $languageContent); break; case "etalage": etalagePicture($conn, $smarty); break; case "deletefrompurch": processDeleteFromPurchases($conn); break; endswitch; } function processFrontpage($smarty, $conn) { if (!$_GET["section"]) { $smarty->assign("template", "frontpage_main.tpl"); } elseif(is_numeric($_GET["section"])) { $smarty->assign("template", "content.tpl"); $smarty->assign("content", getPage($_GET["section"], $conn)); } $smarty->display("frontpage.tpl"); } function getDynamicPage($page_id, $smarty, $conn) { $smarty->assign("content", getPage($page_id, $conn)); $smarty->assign("template", "content.tpl"); $smarty->display("index.tpl"); } function loadPage($redirect, $conn) { db_disconnect($conn); if (!$redirect) { header("Location: /?page=frontpage"); } else { header("Location: ".$redirect); } die(); } function getPage($page, $conn) { if (!is_numeric($page)) { loadPage(false, $conn); } $sql = sprintf("SELECT html FROM paginas WHERE id = %d", mysql_escape_string($page)); $results = mysql_query($sql, $conn) or die(mysql_error()); if (mysql_num_rows($results)) { list($html) = mysql_fetch_row($results); return stripslashes($html); } else { return false; } } function getCategory($category, $conn) { switch($_SESSION["language"]): case "uk": $sql = sprintf("SELECT cat_uk FROM photo_categorys WHERE id = %d", mysql_escape_string($category)); break; case "nl": $sql = sprintf("SELECT cat_nl FROM photo_categorys WHERE id = %d", mysql_escape_string($category)); break; endswitch; $results = mysql_query($sql, $conn) or die(mysql_error()); if (mysql_num_rows($results)) { list($category) = mysql_fetch_row($results); return $category; } } function checkAllFields($array, $notRequiredArray) { foreach ($array as $field => $value) { if (is_array($value)) { if (checkAllFields($value, $notRequiredArray) == false) { return false; } } else { if (!trim($value) && !in_array($field, $notRequiredArray)) { return false; } } } return true; } function getError($languageContent, $template, $message) { return $languageContent["mainpage"][$template]["errors"][$message]; } function buildCategorieArray($conn) { switch ($_SESSION["language"]): default: case "uk": $sql = sprintf("SELECT id, top_id, cat_uk AS categorie FROM photo_categorys WHERE actief = 1 ORDER BY top_id ASC, categorie ASC", mysql_escape_string($_SESSION["language"])); break; case "nl": $sql = sprintf("SELECT id, top_id, cat_nl AS categorie FROM photo_categorys WHERE actief = 1 ORDER BY top_id ASC, categorie ASC", mysql_escape_string($_SESSION["language"])); break; endswitch; $results = mysql_query($sql, $conn) or die(mysql_error()); if (mysql_num_rows($results)) { while ($record = mysql_fetch_assoc($results)) { $categorien[$record["top_id"]][] = array("id" => $record["id"], "menuitem" => ucfirst(htmlspecialchars($record["categorie"]))); } return $categorien; } else { return false; } } function drawCategories($menu, $current) { $categories .= "\n"; return $categories; } function getDonations($conn) { $sql = "SELECT * FROM donations"; $results = mysql_query($sql, $conn) or die(mysql_error()); if (mysql_num_rows($results)) { while ($record = mysql_fetch_assoc($results)) { $donations[$record["id"]] = array("donation" => $record["donation"], "image" => $record["image"]); } } return $donations; } function getCountrys($conn) { $sql = "SELECT * FROM countrys ORDER BY country ASC"; $results = mysql_query($sql, $conn) or die(mysql_error()); if (mysql_num_rows($results)) { while ($record = mysql_fetch_assoc($results)) { $countrys[$record["id"]] = $record["country"]; } } return $countrys; } function getCountrysAdvanced($conn) { $sql = "SELECT * FROM countrys ORDER BY country ASC"; $results = mysql_query($sql, $conn) or die(mysql_error()); if (mysql_num_rows($results)) { while ($record = mysql_fetch_assoc($results)) { $countrys[$record["id"]] = $record; } } return $countrys; } ?>