Wrzucam aktualny kod. Wypróbowałem wasze propozycje, po drodze "kilka" kolejnych. Efekt jest ciągle ten sam a mi już ręce opadły. Efik, skoro testowałeś u siebie i działa to co zrobiłem źle?
<?php
function killer($e)
{
echo "<script>alert(".$e.");</script>";
}
if(isset($_GET['hash']))
{
$hash = $_GET['hash'];
try
{
if (! @include_once('php/connect.php'))
throw new Exception ('connect.php not exist</br>');
if (!file_exists('php/connect.php'))
throw new Exception ('connect.php not exist</br>');
else
require_once('php/connect.php');
}
catch(Exception $e)
{
killer(0);
}
require_once "php/connect.php";
$polaczenie = new mysqli($host, $db_user, $db_password, $db_name);
$polaczenie->set_charset("utf8");
$hash = htmlentities($hash, ENT_QUOTES, "UTF-8");
$hash = mysqli_real_escape_string($polaczenie, $hash);
if($rezultat = $polaczenie->query(sprintf("SELECT file FROM zamowienia WHERE hash='%s'", $hash)))
{
$ile = $rezultat->num_rows;
if($ile==1)
{
$wiersz = $rezultat->fetch_assoc();
$file = $wiersz['file'];
killer($file);
if(!(file_exists($file))) killer(1);
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Expires: 0');
header('Content-Length: ' . filesize($file));
$fp = fopen($file, 'rb');
fpassthru($fp);
}
else killer(2);
}
else killer(3);
}
?>