Page 1 of 1

code for php4

Posted: Wed Feb 06, 2008 6:09 am
by shaqa
This code below doesnt work with php 4 how to convert to work with php4 also the Error at the 1 script and echo at the second doesnt work?

Code: Select all

function checkfile($link, $name) {
 
if (@file_get_contents($link, NULL, NULL, NULL, "50000")) {
header("Content-type: audio/mpeg;\r\n");
$head = "Content-Disposition: attachment; filename=\"$name\";\r\n";
header($head);
readfile($link);
}else{
die($lang[Error]);
}
}
$name = $a2f . $_GET[name];
$link = "http://www.downloaded.com/files/" . $_GET['file'] . "/?id=" . $_GET['idx'];
checkfile($link, $name);
$a2f = "www.mysite.com_";


also how to add $a2f to this second script below which work with php 4?

Code: Select all

<?php
if(!@fopen("http://www.downloaded.com/Afiles/" . $_GET['file'], r)) {
echo "Sorry, The file has been removed.";
}else{
header("Location: http://www.downloaded.com/files/" . $_GET['file'] . "/?id=" . $_GET['id']);
}
?>

Re: code for php4

Posted: Wed Feb 06, 2008 11:43 am
by Christopher
What is the error? And what does not work?

Re: code for php4

Posted: Wed Feb 06, 2008 5:08 pm
by shaqa
i see blank page
and i dont know how to implement script one to the script 2 with new variables,,when file doesnt exist and when dowloding file to show my website name+file

Re: code for php4

Posted: Wed Feb 06, 2008 11:22 pm
by Festy
First of all don't use '@' syntax as it suppresses the error and you won't be able to see the error message in your browser. Secondly, if you're getting a bland page then most probably it's a syntax error. Check your code carefully.

Re: code for php4

Posted: Thu Feb 07, 2008 3:55 am
by shaqa
im not php programmer to fix these thinga for this i made this request here!

I want to add $a2f to header("Location: http://www.downloaded.com/files/" . $_GET['file'] . "/?id=" . $_GET['id']); and also add a echo reply that work if the file doesnt exist!

Re: code for php4

Posted: Thu Feb 07, 2008 10:58 am
by califdon
shaqa wrote:im not php programmer to fix these thinga for this i made this request here!

I want to add $a2f to header("Location: http://www.downloaded.com/files/" . $_GET['file'] . "/?id=" . $_GET['id']); and also add a echo reply that work if the file doesnt exist!
But this is a forum for php programmers. We would like to help, but not many of us have time to write or revise scripts.

Re: code for php4

Posted: Fri Feb 08, 2008 4:48 am
by shaqa
califdon wrote:
shaqa wrote:im not php programmer to fix these thinga for this i made this request here!

I want to add $a2f to header("Location: http://www.downloaded.com/files/" . $_GET['file'] . "/?id=" . $_GET['id']); and also add a echo reply that work if the file doesnt exist!
But this is a forum for php programmers. We would like to help, but not many of us have time to write or revise scripts.
i understand and its right what you are saying.
but if somebody can help ill appreciate, and i think dont have tu much time for php genuis :) to resolv my problem.i know in this forum have to much php proffesionals....anyway,,,ill wait for help