1) { $notFound = true; $x = 0; while (($row = mysql_fetch_row($result)) && $notFound) { if ($x==0) { // i tilfælde af at vi ikkr finder noget ;))) if ($atoGalleryAdminCookie) { $tArr2 = explode("||", $atoGalleryAdminCookie); while (list(,$v) = each ($tArr2)) { if (ereg_replace("^".$cat."_", "",$v) == $v) { $tArr[] = $v; } } $tArr[] = $cat."_".$row[0]; $atoGalleryAdminCookie2TEMP = implode("||", $tArr); } else { $atoGalleryAdminCookie2TEMP = $cat."_".$row[0]; } $resultArrTemp = array($row[0], $row[1]); } if ($atoGalleryAdminCookie) { $oCArr = explode("||", $atoGalleryAdminCookie); if (!in_array($cat."_".$row[0],$oCArr)) { array_push($oCArr, $cat."_".$row[0]); $atoGalleryAdminCookie2 = implode("||", $oCArr); setcookie("atoGalleryAdminCookie", $atoGalleryAdminCookie2, time() + $cLF); $url = $row[1]; mysql_query("update gallery set hits = hits + 1, hitsHour = hitsHour + 1, hitsToday = hitsToday + 1 where galleryId = $row[0]"); $notFound = false; } } else { setcookie("atoGalleryAdminCookie", $cat."_".$row[0], time() + $cLF); $url = $row[1]; mysql_query("update gallery set hits = hits + 1, hitsHour = hitsHour + 1, hitsToday = hitsToday + 1 where galleryId = $row[0]"); $notFound = false; } $x++; } if ($notFound) { setcookie("atoGalleryAdminCookie", $atoGalleryAdminCookie2TEMP, time() + $cLF); $url = $resultArrTemp[1]; mysql_query("update gallery set hits = hits + 1, hitsHour = hitsHour + 1, hitsToday = hitsToday + 1 where galleryId = $resultArrTemp[0]"); $notFound = false; } } else { $url = errorUrl; } mysql_free_result($result); } else { $url = errorUrl; } mysql_close($dbLink); header("Location: $url"); ?>