GetDotted Domains

Viewing Thread:
"Shouldn't have tried to learn PHP..."

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Tue 29/04/03 at 17:02
Regular
Posts: 787
I knew it, I'll go fine for a few minutes and then crash and burn!

I've learnt how to make a flashy little form now! (Yay!)

Anyway, how would I manage to create a list of files within a directory?

Say I wanted to print all of the files in the directory

http://members.lycos.co.uk/phi11ip/pics/

What would I do?

Is it easy, or slightly harder than I expect in which I'll just leave it!

Thanks.
Thu 01/05/03 at 22:52
Regular
"Chavez, just hush.."
Posts: 11,080
7. The upload of web pages and other files to the Freeola server and the sending of e-mails and attachments from any Freeola1000 address or hosted domain is permitted only via a dial-up networking connection to the official Freeola 0845 Dial-up dial-up numbers. Any other method will be regarded as a hacking attempt with appropriate action taken against the perpetrator.

Ah...

I was all looking forward to that...

Good job none of the files work then isn't it!
Thu 01/05/03 at 22:38
Regular
"Chavez, just hush.."
Posts: 11,080
Oh, OK.
Thu 01/05/03 at 22:34
Regular
"It goes so quickly"
Posts: 4,083
On Freeola??

They won't allwo it :)
Thu 01/05/03 at 22:29
Regular
"Chavez, just hush.."
Posts: 11,080
OK, why doesn't this script allow me to upload swf files...


//user defined variables
$abpath = "./games"; //Absolute path to where games are uploaded. No trailing slash
$sizelim = "no"; //Do you want size limit, yes or no
$size = "2500000"; //What do you want size limited to be if there is one
$number_of_uploads = 3; //Number of uploads to occur

if ($_REQUEST['submitted']){ // Begin processing portion of script

//all file types to upload
$cert1 = "flash/swf"; //swf flash


$log = "";

for ($i=0; $i<$number_of_uploads; $i++) {

//checks if file exists
if ($img_name[$i] == "") {
$log .= "No file selected for upload $i
";
}

if ($img_name[$i] != "") {
//checks if file exists
if (file_exists("$abpath/$img_name[$i]")) {
$log .= "File $i already existed
";
} else {

//checks if files to big
if (($sizelim == "yes") && ($img_size[$i] > $size)) {
$log .= "File $i was too big
";
} else {


//Checks if file is an image
if (($img_type[$i] == $cert1) or ($img_type[$i] == $cert2) or ($img_type[$i] == $cert3) or ($img_type[$i] == $cert4) or ($img_type[$i] == $cert5) or ($img_type[$i] == $cert6) or ($img_type[$i] == $cert7) or ($img_type[$i] == $cert8) or ($img_type[$i] == $cert9) or ($img_type[$i] == $cert10) or ($img_type[$i] == $cert11) or ($img_type[$i] == $cert12) or ($img_type[$i] == $cert13) or ($img_type[$i] == $cert14) or ($img_type[$i] == $cert15) or ($img_type[$i] == $cert16) or ($img_type[$i] == $cert17)) {
@copy($img[$i], "$abpath/$img_name[$i]") or $log .= "Couldn't copy Flash game 1 to server
";
if (file_exists("$abpath/$img_name[$i]")) {
$log .= "File $i was uploaded
";
}
} else {
$log .= "File $i is not an Flash game
";
}
}
}
}


}

?>



Flash game Report


Log:


echo "$log";

?>




exit;
} // End processing portion of script
?>


Files to upload:


for ($j=0; $j<$number_of_uploads; $j++) {
?>


}
?>



---------

It was designed for images but I changed it to allow me to upload swf files...

It hasn't changed that much, only the file types but it still won't work.

If you want to see the original I'll post it.

Wed 30/04/03 at 21:49
Regular
"Chavez, just hush.."
Posts: 11,080
Done it.

I've found a script that works!

I'm also quite surprised how much I've learnt in the two days I've tried it too!
Wed 30/04/03 at 21:22
Regular
"It goes so quickly"
Posts: 4,083
You don't appear to have a set Value for $File_name.
Wed 30/04/03 at 21:12
Regular
"Chavez, just hush.."
Posts: 11,080
I just can't get any uploading scripts to work.

I've tried on Freeola to test them but it still doesn't work...

Grrr..
Wed 30/04/03 at 19:40
Regular
"Chavez, just hush.."
Posts: 11,080
That one doesn't seem to work.

Fatal error: Maximum execution time of 10 seconds exceeded in listing.php on line 22

I found another one which is OK, it creates a thumbnail of all the images in the folder which could be quite useful.

Oh, and this script doesn't seem to be working no matter how hard I try:

This is the form page:






This is the PHP file:

if ($File_name){
if (copy($FileToUpload, "./photos/$File_name")){
echo 'File Name :' . $File_name .';
echo 'File Size :' . $File_size .';
echo 'The file was successfully uploaded!';}
else
echo 'Your file could not be copied.';
unlink($FileToUpload);
?>

I got a parse error on line 4 I think, my crapy attempt to fix it was this:


if ($File_name){
if (copy($FileToUpload, "./photos/$File_name")){
print ("The name of the file is $File_name");
print ("The size of the file is $File_size");
print ('The file was successfully uploaded!");}
else
print ("File not uploaded");
unlink($FileToUpload);

?>

But then I get a parse error on the last line. The close php tag.

Does anybody have any simple file/image uploading scripts?
Wed 30/04/03 at 19:05
Regular
"It goes so quickly"
Posts: 4,083
Try putting this in a PHP file, into the directory you want listings for:

$Folders = "";
$Folder_Count = 0;
$Files = "";
$File_Count = 0;
print "
\n";
print "\n";
print " \n";
print " \n";
print " \n";
print " \n";
$dh = opendir("");
while ( gettype($file = readdir($dh)) != boolean) {
if ( is_dir("$file")) {
if ($file != ".") {
if ($file != "..") {
$Folders .= "\t$file\"Folder\"
\n";
$Folder_Count++;
}
}
}
if ( is_file("$file")) {
$Files .= "\t\"File\"$file
\n";
$File_Count++;
}
}
closedir($dh);
print " \n";
print " \n";
print " \n";
print " \n";

$Folder_Text = ($Folder_Count == 1)?"Folder":"Folders";
$File_Text = ($File_Count == 1)?"File":"Files";

print " \n";
print " \n";
print " \n";
print " \n";
print "
FOLDERSFILES
\n$Folders\n";
print "
\n$Files\n";
print "
$Folder_Count $Folder_Text$File_Count $File_Text
\n";
print "
\n";
?>
Wed 30/04/03 at 18:52
Regular
"Unknown Legend"
Posts: 305
Apache I think...

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Unrivalled services
Freeola has to be one of, if not the best, ISP around as the services they offer seem unrivalled.
The coolest ISP ever!
In my opinion, the ISP is the best I have ever used. They guarantee 'first time connection - everytime', which they have never let me down on.

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.