הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   [PHP] עזרה ב HEADER (https://hosts.co.il/forums/showthread.php?t=30026)

Elad-A 01-09-06 08:33

[PHP] עזרה ב HEADER
 
עריכה:

הצלחתי לסדר שיוריד אבל הקבצים יוצאים פגומים.

זה הקוד:

PHP קוד:


<? ob_start(); ?>
<?php
function download_file($file



$query mysql_query("SELECT * FROM upload where id = '{$_GET['id']}'") or die("error"); 
$row mysql_fetch_array($query); 
$num mysql_num_rows($query); 
if(
$num == 0

die(
" לא קיימת הורדה התואמת לחפושך ") ; 

$id $row['id']; 
$name $row['name']; 
$size $row['size']; 
$type $row['type']; 
// By maor 
    
$filename           basename($file); 
    
$file_extension     strtolower(substr(strrchr($filename,"."),1)); 
    
$input  strtolower($_SERVER['QUERY_STRING']); 
    
$no_good_extensions = array("php"."php1","php2","php3","php4"); 
    
$return str_replace($no_good_extensions""$input); 
     if( 
$input != $return 
    { 
    die( 
" סוג הקובץ שאתה מנסה להוריד לא מורשה "); 
    } 
$file $row['name'];
header ("Content-type: application/$type"); 
header ("Content-disposition: attachment; filename=".$file.";"); 
header("Content-Length: ".filesize($file)); 
readfile($file); 
exit; 

download_file(date/$name);
?>

אם בא לכם לנסות אתם מוזמנים לבדוק:

http://elad.fire-serv.net/test.php

עריכה 2 :

הסתדרתי כבר תודה בכל מקרה.
תודה ל lalamen שעזר לי.

-roee- 01-09-06 11:05

לפני שתתעסק עם הקבצים והשטויות שים לב טוב טוב לשאילתה שלך...
PHP קוד:

$query mysql_query("SELECT * FROM upload where id = '{$_GET['id']}'") or die("error"); 

לא צריך להיות גאון כדי למחוק לך את הטבלה upload..

אם אני רושם בכתובת:
PHP קוד:

blabla.php?id=; DROP TABLE upload 


אני פשוט וקל מחוחק את הטבלה..

תשתמש ב intval

Elad-A 01-09-06 14:16

אתה מוזמן לנסות..


כל הזמנים הם GMT +2. הזמן כעת הוא 06:53.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ