code for php4

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shaqa
Forum Commoner
Posts: 62
Joined: Mon Aug 13, 2007 9:11 am

code for php4

Post 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']);
}
?>
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: code for php4

Post by Christopher »

What is the error? And what does not work?
(#10850)
shaqa
Forum Commoner
Posts: 62
Joined: Mon Aug 13, 2007 9:11 am

Re: code for php4

Post 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
Festy
Forum Commoner
Posts: 28
Joined: Wed Jan 30, 2008 10:01 pm

Re: code for php4

Post 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.
shaqa
Forum Commoner
Posts: 62
Joined: Mon Aug 13, 2007 9:11 am

Re: code for php4

Post 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!
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: code for php4

Post 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.
shaqa
Forum Commoner
Posts: 62
Joined: Mon Aug 13, 2007 9:11 am

Re: code for php4

Post 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
Post Reply