Jump to content

rpcob

Members
  • Posts

    10
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

rpcob's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. @ PFMaBiSmAd that's what i was thinking, but i was hoping to get around that. The url is http://url.com/download/?nav=display&file=12. The download link on the page send you to http://url.com/download/?nav=get&file=12. So I need to break the nav.php and display.php?
  2. i turned on error report all and removed the content-type header. Made no difference
  3. I've tried three different attempts to force php to download. None of them are working correctly. Can anybody help me get this working? The text/garbage that displays on the screen looks like it was a zip opened in a text editor. I have also tried this http://stackoverflow...rbage-on-screen with no luck either First: Returns a page full of garbage $fid = $_GET['file']; $results = mysql_query("SELECT filename FROM files WHERE id=$fid"); if (mysql_numrows($results) == 0){ echo "<b>File not found</b>"; return; } $file = mysql_result($results,0,"filename"); $fileurl = 'http://url.com/files/'.$file; // Set headers header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=$fileurl"); header("Content-Type: application/zip"); header("Content-Transfer-Encoding: binary"); // Read the file from disk readfile($fileurl); exit(); Second: Returns same garbage (.zip file) $fid = $_GET['file']; $results = mysql_query("SELECT filename FROM files WHERE id=$fid"); if (mysql_numrows($results) == 0){ echo "<b>File not found</b>"; return; } $file = mysql_result($results,0,"filename"); $fileurl = 'http://url.com/files/'.$file; header('Content-Description: File Transfer'); header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="'.basename($fileurl).'"'); //<<< Note the " " surrounding the file name header('Content-Transfer-Encoding: binary'); header('Connection: Keep-Alive'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($fileurl)); readfile($fileurl); Third: Returns same garbage, but also alters page layout $fid = $_GET["file"]; $results = mysql_query("SELECT filename FROM files WHERE id=$fid"); if (mysql_numrows($results) == 0){ echo '<b>File not found</b>'; return; } $file = mysql_result($results,0,'filename'); $fileurl = "http://url.com/files/".$file; // Inform browser that this is a force-download header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); // Inform browser that data can be binary in addition to text header('Content-Disposition: attachment; filename='.basename($fileurl)); header('Content-Transfer-Encoding: binary'); // Inform browser that this page expires immediately so that an update to the file will still work. header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($fileurl)); // Push actual file. ob_clean(); flush(); readfile($fileurl); exit(); Any help, insight, direction, or links would be greatly appreciated. Thank you. On a side note there are .zip, .rar, and .txt files. Do i just add content type lines?
  4. I'm on a vps. There isn't much they are willing to do
  5. I installed everything using powerstack and yum. I've checked over config files and havnt noticed anything. My phpinfo worked once then stopped. http://93.174.91.26/content/serverinfo.php. All other php pages just show up blank or return with error 500. I can't seem to figure out what's wrong. I'm running the newest versions of everything. I'm on redhat centOS 5
  6. Is basename possible? Seems like it would give a blank output. Could you please provide the code?
  7. I know this topic is everywhere but I cant find a solution to my particular problem. I have been using a download center script for about a year. http://download.redgalaxy.net/ However, the title is static, keeping with the predefined one. I am trying to get the title to change so it matches the file name shown on the display page "index.php/?nav=display&file=25". I have spent days trying to figure something out with absolutely no luck. Does anyone have an idea how to get the title to change when dynamically? Out of desperation i used an onload javascript but it doesnt work with crawlers. Thank you in advanced. Index.php <?php /* PHP Download Center Copyright (C) 2007 Chris LaPointe 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 3 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. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ //error_reporting(E_ERROR); define("PHP_DOWNLOADCENTER", 1); include_once('settings.php'); //Include all files in 'inc' directory $path = 'inc/'; $handle = opendir($path); while (false !== ($file = readdir($handle))) { if (substr($file, 0, 1) != '.') include($path.$file); } closedir($handle); //Start session for me! session_start(); if (mysql_connect($mysql_host, $mysql_username, $mysql_password) == FALSE){ if (file_exists("install.php")){ echo '<HTML><HEAD><meta http-equiv="refresh" content="0;url=install.php"></HEAD></HTML>'; exit; }else{ die("Fatal error. Unable to access database. In addition, unable to go to install.php to setup access!"); } } if (mysql_select_db($mysql_database) == FALSE){ if (file_exists("install.php")){ echo '<HTML><HEAD><meta http-equiv="refresh" content="0;url=install.php"></HEAD></HTML>'; exit; }else{ die("Fatal error. Unable to access database. In addition, unable to go to install.php to setup access!"); } } //because of the way it is handled, there should never be any HTML passed via arguments //do a check here foreach ($_GET as $key => $value){ $_GET[$key] = strip_tags(html_entity_decode($value, ENT_NOQUOTES), '<i><b>'); } //Run the now (Just code, ie login code) if ( isset($_GET['now']) ){ $nowfile = "pages/".$_GET['now'].'.now.php'; if (file_exists($nowfile)){ include($nowfile); }else{ echo "<b>Warning:</b> Now file '$nowfile' doesn't exist"; } } ?> <HTML> <HEAD> <TITLE><?php echo $page_title; ?></TITLE> <link rel="stylesheet" type="text/css" href="style.css"> </HEAD> <BODY> <!--TOP SECTION (banner)--> <table width=100% border=0 cellspacing=2 cellpadding=0> <TR> <TD valign="top"><img src="theme/page/banner.gif"></TD> <TD valign="middle"><div align="right"><?php include('ads/ad_top.php'); ?></div></TD> </TR> </TABLE> <!--MIDDLE SECTION--> <table width=100% border=0 cellspacing=2 cellpadding=0> <TR> <TD width=150px valign="top"><?php require('left.php'); ?></TD> <TD valign="top"> <table width=100% border=0 cellspacing=2 cellpadding=0> <TR><TD><?php include('nav.php'); ?></TD></TR> <TR><TD><?php include('body.php'); ?></TD></TR> </table> </TD> </TR> </table> <BR> <div align="center"><font size="1"> This page is under the <a href="http://gplv3.fsf.org/">GPLv3</a> by <a href="http://www.redgalaxy.net" target="_blank">Red Galaxy</a>. Each file is copyrighted by its respective owner.<BR> This page is not to be held responsible for any uploaded files. It is each user's responsibility to check the legality of files they upload.<BR> Please contact <i><?php echo $info_name; ?></i> at <?php echo str_replace('@', "'AT'", str_replace('.', "'DOT'", $info_email)); ?> with any questions.<BR> <?php echo $info_misc; ?></font> </div> </BODY> </HTML> <?php mysql_close(); ?> nav.php <?php if (!defined('PHP_DOWNLOADCENTER')) exit; ?> <table width=100% border=0 cellspacing=0 cellpadding=0> <TR> <TD> <a href="?nav=home">Home</a> | <a href="?nav=recent">Recent Files</a> </TD> <TD align="right"> <form action="?nav=search_results" method="post"><INPUT type="text" size="20" name="search"><INPUT type="submit" value="Search"></form> </TD> </table> body.php <?php if (!defined('PHP_DOWNLOADCENTER')) exit; if (!isset($_GET['nav'])){ $location = 'pages/home.php'; }else{ $location = 'pages/'.$_GET['nav'].'.php'; } if (isset($_GET['message'])){ echo '<div align="center">'; echo BeginBorder("Message", "50%"); echo stripslashes(urldecode($_GET['message'])); echo EndBorder(); echo '</div>'; } if (file_exists($location)) include($location); else include("pages/404.php"); ?> display.php <?php $fid = $_GET['file']; $results = mysql_query("SELECT * FROM files WHERE id=$fid LIMIT 1"); if (mysql_numrows($results) == 0){ echo "File not found. It may have been removed."; return; } $who = getUserNameById(mysql_result($results,0,"uid")); echo BeginBorder(mysql_result($results, 0, "title"), "90%"); ?> <TABLE width=100% border=0 cellspacing=0 cellpadding=0> <TR><TD width=50% valign="top"> <TABLE width=100% border=0 cellspacing=1 cellpadding=2> <TR bgcolor=#F0F0F0> <TD width=50%>Name:</TD> <TD><?php echo mysql_result($results, 0, "title"); ?></TD> </TR> <TR bgcolor=#F0F0F0> <TD>File:</TD> <TD><?php echo mysql_result($results, 0, "filename"); ?></TD> </TR> <TR bgcolor=#F0F0F0> <TD>Size:</TD> <TD><?php echo round( mysql_result($results, 0, "filesize")/1024/1024,2).'MB'; ?></TD> </TR> <TR bgcolor=#F0F0F0> <TD>Extension:</TD> <TD><?php echo mysql_result($results, 0, "filetype"); ?></TD> </TR> <TR bgcolor=#F0F0F0> <TD>Category:</TD> <TD><?php echo mysql_result($results, 0, "category"); ?></TD> </TR> <TR bgcolor=#F0F0F0> <TD>User:</TD> <TD><?php echo $who; ?></TD> </TR> <TR bgcolor=#F0F0F0> <TD>Date Uploaded:</TD> <TD><?php echo mysql_result($results, 0, "date"); ?></TD> </TR> <TR bgcolor=#F0F0F0> <TD>Download Count:</TD> <TD><?php echo mysql_result($results, 0, "dcount"); ?></TD> </TR> <TR bgcolor=#F0F0F0> <TD>Downloads This Month</TD> <TD><?php echo mysql_result($results, 0, "dmonth"); ?></TD> </TR> </TABLE> </TD> <TD valign="top"> <center> <a href="<?php echo '?nav=download&file='.$fid; ?>"><img src="theme/download.png" border=0></a> <?php if (mysql_result($results, 0, 'private') == '1') echo "<br>You must be logged in to download this file.</b>"; ?> </center><BR><BR> <?php //PREVIEW IMAGE IF EXISTS $realname = mysql_result($results, 0, "filename"); $small_preview = 'images/'.$realname.'.small.jpg'; $large_preview = 'images/'.$realname.'.large.jpg'; if (file_exists($small_preview)){ echo "<div align='center'><a href='$large_preview' target='_blank'><img src='$small_preview' border='0'></a></div><BR>"; } //ADMIN CONTROLS if (isUserAdmin()){ echo '<b>Admin:</b> <a href="?nav=delete&file='.$fid.'">Delete This File</a> | <a href="?nav=edit&file='.$fid.'">Edit</a><BR>'; } ?> </TD></TR> </TABLE> <HR> <b>Description:</b><BR> <?php echo mysql_result($results, 0, "description"); ?> <?php echo EndBorder(); ?>
  8. rpcob

    Php help

    I was looking through the forum... is this something that would work for me? http://www.phpfreaks.com/forums/index.php/topic,269559.0.html
  9. rpcob

    Php help

    That was what i was looking for. Do you have any quick examples to give me for linking the event to loading a specific page in the iframe?
  10. rpcob

    Php help

    Hello, I don't know what I'm looking for otherwise i would have already searched. I have a site with events that are updated weekly on the main page. I am looking to link the events on the main page to a page with info on that event. On the page i have an iframe. How can i set it up to where the right iframe opens on the page depending on the event they click on from the main page. Or not even use iframes at all and just have it all on the page and have the information show depening on the php id. Thank you. I know nothing about php. Just how to manipulate exisitng code.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.