Zitat Zitat von Lucleonhart
Das mit der Kategorie ist sehr simpel:
PHP-Code:
$abfrage "SELECT * FROM downloads WHERE Kategorie LIKE '$search' "
PHP-Code:
<?php 
include("database.php"); // Datenbankverbindung wird in der Datei aufgebaut.
$abfrage mysql_query("SELECT downloads FROM files WHERE id LIKE '$thisid' "); //Aktuelle Klickzahl abfragen.
$ergebnis mysql_fetch_object($abfrage); //PHP blabla
if ($ergebnis->downloads == "") { $downloads 0; } else { $downloads $ergebnis->downloads; } //Wenn Tabelle noch leer ist 0 statt "" nehmen.
$downloads++; //Um 1 erhöhen
$eintrag mysql_query("UPDATE files Set downloads = '$downloads' WHERE id LIKE '$thisid' "); //Eintragen
?>
Yeah! MySQL Injection detected!
Man sollte IMMER Variablen filtern die Userinput beinhalten (könnten).

PHP-Code:
$search mysql_escape_string($search);
$abfrage "SELECT * FROM downloads WHERE Kategorie LIKE '$search' "
PHP-Code:
<?php 
include("database.php"); // Datenbankverbindung wird in der Datei aufgebaut.
$thisid mysql_escape_string($thisid); // dürfte so funktionieren
$abfrage mysql_query("SELECT downloads FROM files WHERE id LIKE '$thisid' "); //Aktuelle Klickzahl abfragen.
$ergebnis mysql_fetch_object($abfrage); //PHP blabla
if ($ergebnis->downloads == "") { $downloads 0; } else { $downloads $ergebnis->downloads; } //Wenn Tabelle noch leer ist 0 statt "" nehmen.
$downloads++; //Um 1 erhöhen
$eintrag mysql_query("UPDATE files Set downloads = '$downloads' WHERE id LIKE '$thisid' "); //Eintragen
?>