When I run mytest.php I get the following message, but nothing shows in the database.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Robert Brookner
    New Member
    • Oct 2010
    • 2

    #1

    When I run mytest.php I get the following message, but nothing shows in the database.

    echo "pls wait some one have downloaded the file until he uploads you have to wait";

    Code:
    My database setup:
    
    CREATE TABLE IF NOT EXISTS `uploadedfiles` (
    
      `ID` int(11) NOT NULL auto_increment,
    
      `filename` varchar(30) NOT NULL,
    
      `path` varchar(100) NOT NULL,
    
      `size` int(11) NOT NULL,
    
      PRIMARY KEY  (`ID`)
    
    ) ENGINE=MyISAM DEFAULT CHARSET=ascii AUTO_INCREMENT=1 ;

    mytest.php:

    Code:
    <?php
    ?>
    <a href="filedownload.php?fileid=1&path=/./download/&filename=master 2000 thru 2005.xls"><b><u><font size =4>Download master 2000 thru 2005.xls file</b></u></font></a></center>
    <br>
    <a href="filedownload.php?fileid=2&path=/./download/&filename=master 2006 thru 2010.xls"><b><u><font size =4>Download master 2006 thru 2010.xls file</b></u></font></a></center>
    Dbcon.php:
    Code:
    <?php
    $dbname = 'xxxx';
    $link = mysql_connect("localhost","xxxx","xxxx") or die("Couldn't make connection.");
    $db = mysql_select_db($dbname, $link) or die("Couldn't select database");
    ?>
    
    filedownload.php:
    
    <?php
    $file = $_REQUEST['filename'];
    $file_id = $_REQUEST['fileid'];
    $dir = $_REQUEST['path'];
    
    include "Dbcon.php";
    
    $rs = mysql_query("select * from uploadedfiles where fileid = $file_id and downloaded = 1");
    if (mysql_affected_rows() == 0) {
          mysql_query("update uploadedfiles set downloaded=1, downloadedtime = 'somedatetiem' where fileid = $file_id");
          $dir="path";
          if (isset($_REQUEST["filename"])) {
                $file=$dir.$_REQUEST["filename"];
                header("Content-type: application/force-download");
                header("Content-Transfer-Encoding: Binary");
                header("Content-length: ".filesize($file));
                header("Content-disposition: attachment;" filename .basename($file));
                readfile("$file");
    
          } else {
                echo "No file selected";
          }
    } else {
          echo "pls wait some one have downloaded the file until he uploads you have to wait";
    }      
    ?>
    Last edited by Niheel; Oct 12 '10, 11:09 PM. Reason: Merged question details and fixed code tags
  • JKing
    Recognized Expert Top Contributor
    • Jun 2007
    • 1206

    #2
    I am sorry but I don't see a message in your post?
    What message are you receiving?

    Comment

    Working...