slight prob with this

Started on the old forum in April 2011 · view the original in the archive · old links redirect here

9 replies · 448 views · started 15 years ago · 1 min read

3 participants
nclemale36 Lead · 537 posts #1

hi guys . i have editted a file that is used for mms which gets the file .i want it to use on my uploaders prob i have is some ppl mainly ppl with phones are only getting the main menu link and not the file that they clicked on . it works fine for me on all my browsers and even my ****ty old nokia phone lol .

think its something to do with headers and i need a lil help fixing it.

heres the code

<?php
include("../web/config.php");
include("../web/core.php");
$conms = mysql_connect($dbhost,$dbuser,$dbpass);
$condb = mysql_select_db($dbname);
$file = $_GET["file"];
$sid = $_GET["sid"];
$file = mysql_fetch_array(mysql_query("SELECT filename, uid from ibwf_mp3 WHERE id='".$file."'"));
    $uid = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_ses WHERE id='".$sid."'"));
        $uid = $uid[0];
    if ($file[1] == $uid){
    header("Location: files/".$file[0]);
}
    else{
        header("Content-type: text/html");
        echo "<html><a href=\"index.php?action=main&sid=$sid\">Main Menu</a></p></html>";
    }
?>

cheers

kei_ki7 Senior · 431 posts #2

Use PHP code so text looks fine.

try changing this

header("Location: files/".$file[0]);

to this

header("Location: ./files/".$file[0]);

Did I help you? You can help me too Your donations will help me finance my studies.

kei_ki7 Senior · 431 posts #4

try using

readfile('files/' . $file[0]);

Did I help you? You can help me too Your donations will help me finance my studies.

kei_ki7 Senior · 431 posts #6

Change MIMETYPE to your File mime-type

header('Content-Type: MIMETYPE');
readfile('files/' . $file[0]); 

Did I help you? You can help me too Your donations will help me finance my studies.

kei_ki7 Senior · 431 posts #8

example:

if you need GIF output

header('Content-type: image/gif');
readfile('files/' . $file[0]);  

if you need JPEG output

header('Content-type: image/jpeg');
readfile('files/' . $file[0]);  

if you need PNG output

header('Content-type: image/png');
readfile('files/' . $file[0]);  

if you need BMP output

header('Content-type: image/bmp');
readfile('files/' . $file[0]);  

Did I help you? You can help me too Your donations will help me finance my studies.

something else Fellow · 2,296 posts #9

its letting you download the files because you uploaded them .... hence your id is $file[1]

change to something like:

<?php
include("../web/config.php");
include("../web/core.php");
$conms = mysql_connect($dbhost,$dbuser,$dbpass);
$condb = mysql_select_db($dbname);
$file = $_GET["file"];
$sid = $_GET["sid"];
$file = mysql_fetch_array(mysql_query("SELECT filename, uid from ibwf_mp3 WHERE id='".$file."'"));
    $uid = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_ses WHERE id='".$sid."'"));
        $uid = $uid[0];
    if ($file[0] != ''){
    header("Location: files/".$file[0]);
}
    else{
        header("Location: index.php?action=main&sid=$sid");
    }
?>
nclemale36 Lead · 537 posts #10

omg your right. i never tested anyone elses uploaded files. its giving me a pop up now asking if i want to save getfile.php . i will try above and get back to u

Added after 14 minutes:

thanks something_else seems to be working for one of my users that it wasnt working for before . .

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close