[Openfirst-cvscommit] news getfile.php,NONE,1.1
Brought to you by:
xtimg
From: <i-...@us...> - 2003-10-06 23:06:23
|
Update of /cvsroot/openfirst/news In directory sc8-pr-cvs1:/tmp/cvs-serv10017/downloads Added Files: getfile.php Log Message: Initial upload. Retreives files from database or filesystem. --- NEW FILE: getfile.php --- <?php /* * openFIRST.downloads - getfile.php * * Copyright (C) 2003, * openFIRST Project * Original Author: Greg Inozemtsev <gr...@si...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ include("../config/globals.php"); if(isset($_GET["id"])){ $id=$_GET["id"]; } else{ header("Location: notfound.php"); } $query=ofirst_dbquery("SELECT FileData,mime,hits FROM ofirst_downloads WHERE ID='".$id."';"); if (ofirst_dbnum_rows($query)==0){ header("Location: notfound.php"); } else { $file = ofirst_dbfetch_object($query); ofirst_dbquery("UPDATE ofirst_downloads SET hits=".($file->hits+1)." WHERE ID='".$id."';"); if(ereg("location:*",$file->FileData)){ header("Location: ".substr($file->FileData,9)); } else{ header("Content-type: ".$file->mime); echo(base64_decode($file->FileData)); } } ?> |