Kód:
<?php
$mysql_host="****";
$mysql_login="****";
$mysql_pass="****";
$mysql_database="****";
mysql_connect("$mysql_host", "$mysql_login", "$mysql_pass");
mysql_select_db("$mysql_database");
//create connection
$connection = mysql_connect("$mysql_host", "$mysql_login", "$mysql_pass") or die ("Couldnt connect to the server.");
//select database
$db = mysql_select_db("$mysql_database",$connection) or die ("Couldnt select the database.");
// Database connection stuff here
$dl=$_GET['dl'];
$q="SELECT * from cws_downloads where dl_md5='$dl'";
$result= mysql_query($q);
$webgarden = strpos($refer,"webgarden");
$nadruhou = strpos($refer,"nadruhou");
$wgz = strpos($refer,"wgz");
$estranky = strpos($refer,"estranky");
$blog = strpos($refer,"blog");
$ic = strpos($refer,"ic");
$jyxo = strpos($refer,"jyxo");
$idnes = strpos($refer,"idnes");
$noru = strpos($refer,"norunof");
if ($webgarden==true or $nadruhou==true or $wgz==true or $estranky==true or $blog==true or $ic==true or $jyxo==true or $noru==true or $idnes==true):
header ("Location: http://mojweb.cz/");
exit;
endif;
while ($row=mysql_fetch_array($result))
{
$File=$row["dl_url"];
$File2=$row["dl_klip"];
$File3=$row["ukazka"];
$filena=$row["dl_name"];
$Counter =$row["dl_count"];
$Cukaz =$row["dl_ukaz"];
$Cklip =$row["dla_klp"];
if ($typ=="klip"){
$mm_type="Content-type: video/x-ms-wmv";
$q="update cws_downloads set dla_klp=$Cklip+1 where dl_md5='$dl'";
$kel="wmv";
$FileURL=$File2;
}
if ($typ=="mp3"){
$mm_type="application/octet-stream";
$q="update cws_downloads set dl_count=$Counter+1 where dl_md5='$dl'";
$kel="mp3";
$FileURL=$File;
}
if ($typ=="ukazka"){
$mm_type="application/octet-stream";
$q="update cws_downloads set dl_ukaz=$Cukaz+1 where dl_md5='$dl'";
$kel="mp3";
$FileURL=$File3;
}
$filename = "$filena.$kel";
$result= mysql_query($q) or die
("Could not update download count for \"$dl\"... Contact Webmaster");
readfile($FileURL);
header("Content-Type: " . $mm_type);
header("Content-Length: " .(string)(filesize($FileURL)) );
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary\n");
readfile($FileURL);
}
?>
pomozete mi najst chybu v tomto scripte zevraj je zacykleny
dakujem.