This commit is contained in:
Tobias Reich 2014-08-22 23:04:59 +02:00
parent 988a9075f3
commit 45cbf0c238

View File

@ -215,6 +215,10 @@ class Photo extends Module {
# Check dependencies # Check dependencies
self::dependencies(isset($this->database, $checksum)); self::dependencies(isset($this->database, $checksum));
# Escape
$checksum = mysqli_real_escape_string($this->database, $checksum);
if (isset($photoID)) $photoID = mysqli_real_escape_string($this->database, $photoID);
# Exclude $photoID from select when $photoID is set # Exclude $photoID from select when $photoID is set
if (isset($photoID)) $query = "SELECT id, url, thumbUrl FROM lychee_photos WHERE checksum = '$checksum' AND id <> '$photoID' LIMIT 1;"; if (isset($photoID)) $query = "SELECT id, url, thumbUrl FROM lychee_photos WHERE checksum = '$checksum' AND id <> '$photoID' LIMIT 1;";
else $query = "SELECT id, url, thumbUrl FROM lychee_photos WHERE checksum = '$checksum' LIMIT 1;"; else $query = "SELECT id, url, thumbUrl FROM lychee_photos WHERE checksum = '$checksum' LIMIT 1;";