Glavna stranica | Popis datoteka | Članovi klasa u datoteci

downfile.php

Dokumenacija za ovu datoteku.
00001 <?
00002 /**************************************************************************************
00003  Studentski Informacijski servis, 2004
00004  **************************************************************************************
00005  downfile.php
00006  download personalnih downloada
00007 
00008 
00009  Srdjan Segvic - srle
00010  **************************************************************************************
00011  **************************************************************************************
00012  This program is free software; you can redistribute it and/or modify
00013  it under the terms of the GNU General Public License as published by
00014  the Free Software Foundation; either version 2 of the License, or
00015  (at your option) any later version.
00016 
00017  This program is distributed in the hope that it will be useful,
00018  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  GNU Library General Public License for more details.
00021 
00022  You should have received a copy of the GNU General Public License
00023  along with this program; if not, write to the Free Software
00024  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00025  **************************************************************************************/
00026 session_start();
00027 $id = $_SESSION['id'];
00028 
00029 if (isset($_GET['file_id'])) {
00030   $id_files = $_GET['file_id'];
00031   include ('../connect.php');
00032   $sql = "SELECT *
00033           FROM   downloadi_personal 
00034           WHERE  down_personal_ID = '$id_files'
00035           AND    student_id='$id'";
00036   //echo $sql;
00037   $result = @mysql_query($sql) or die(mysql_error());
00038 $nr = mysql_num_rows($result);
00039 if ($nr==1){
00040   $data = @mysql_result($result, 0, "down_blob");
00041   $name = @mysql_result($result, 0, "down_ime");
00042   $size = @mysql_result($result, 0, "down_size");
00043   $type = @mysql_result($result, 0, "down_tip");
00044  //$data = stripslashes($data);
00045 
00046   $name = str_replace(" ", "_", $name);
00047 
00048  header("Content-type: $type");
00049  header("Content-length: $size");
00050  header("Content-Disposition: octet/stream; filename=$name");
00051   
00052   echo $data;
00053   }
00054   else {
00055         echo "GRESKA!";
00056   }
00057 }
00058 ?>

Generirano Thu Sep 16 17:16:00 2004 projekt: SiS.Student generator: doxygen 1.3.2