!!!! The NEW Biggest thread !!!!

Smith6612

I ate all of the x10Pizza
Community Support
Messages
6,518
Reaction score
48
Points
48
I'm guessing you've got a UPS. We've got a similar set-up, our router is plugged into our UPS, and if nothing else is using it I can be online for a good couple of hours before the batteries go flat (I've got a laptop.)

I have several BIG UPSs that can run my gaming computer, all of my networking gear and all of my computers for a while (about 4 hours). Lightning had shot a power sub-station nearby which made us lose power for a few hours. There are plans at my house to get a whole house generator for when we get a rid of our copper telephone and put it on fiber optic, as if I have to get another UPS in the house, it'd become a mess should all of the batteries on them fail at the same time.
 

TechAsh

Retired
Messages
5,853
Reaction score
7
Points
38
I have several BIG UPSs that can run my gaming computer, all of my networking gear and all of my computers for a while (about 4 hours). Lightning had shot a power sub-station nearby which made us lose power for a few hours. There are plans at my house to get a whole house generator for when we get a rid of our copper telephone and put it on fiber optic, as if I have to get another UPS in the house, it'd become a mess should all of the batteries on them fail at the same time.
We've only got a small APC UPS (ES-700 or something), it's enough to power our (reasonable good) desktop, a Speedtouch Wi-Fi Router and a Linksys SLU2 (Slug) with a 500GB hard drive for 10-15 mins.
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
Ok, heres one to recursively remove files from a directory and also files from any sub directories.
It then removes all the folders :p
PHP:
$dir_stack = array('test/');
$i = 0;
while ($i <= count($dir_stack)-1)
{
	echo $dir_stack[$i].'<br>';
	if ($dir = opendir($dir_stack[$i]))
	{
		while (false !== ($file = readdir($dir)))
		{
			if ($file != "." && $file != ".." && preg_match('/\.{1}/',$file))
			{
				unlink($dir_stack[$i].$file);
			}
			elseif ($file != "." && $file != "..")
			{
				array_push($dir_stack,$dir_stack[$i].$file.'/');
			}
		}
		closedir($dir);
	}
	$i++;
}
$i = count($dir_stack)-1;
while ($i >= 0)
{
	rmdir($dir_stack[$i]);
	$i--;
}
 

tnl2k7

Banned
Messages
3,131
Reaction score
0
Points
0
Could try this
PHP:
$path='test/';
if ($dir = opendir($path))
    {
        while (false !== ($file = readdir($dir)))
        {
            if ($file != "." && $file != "..")
            {
                unlink($path.$file);
            }
        }
        closedir($dir);
        rmdir($path);
    }
:p

Think I got it now Defec, based my script upon yours and tweaked it to suit the calls the arcade uses. I've just implemented the function into the arcade's game deletion script and it seems to work. I'm going to continue with a complete rewrite of the administration panel soon, making the main site work is hard. I think I'm aiming for a July 2009 launch lol, there's a LOT of stuff that needs rewriting; you can really tell I was an uber noob when I wrote this stuff. In other news, if this works I might stick the source on SourceForge, but the code for 0.9 is awful and ain't going nowhere lol.

Edit: Stupid me, can't remove folders with this. I was wondering if it was possible to use is_dir() to check if it's a directory and remove the files from it, but this would only to go so far into the tree. I want to keep it OO, but this is getting more complicated now...Any ideas on how to make the code in my post above delete ALL subdirectories as well as the files?

-Luke.
 
Last edited:

TechAsh

Retired
Messages
5,853
Reaction score
7
Points
38
This is my 1500th post. Yay!!!!!!!!!!!!!!!!

I'm catching up with you Vigge.
 

DeadBattery

Community Support Team
Community Support
Messages
4,018
Reaction score
120
Points
0
And I'm catching up with everyone! :lol:
Hey, does anyone know a good place to start learning PHP?
I know have Lighttpd which runs faster than Apache so I can use my computer a lot better. :)
 

Mitch

New Member
Messages
908
Reaction score
0
Points
0
attachment.php

Lol, i am saying to myself that the bmx tricks-tournement had started.
 

Attachments

  • lol.jpg
    lol.jpg
    30.6 KB · Views: 32

DeadBattery

Community Support Team
Community Support
Messages
4,018
Reaction score
120
Points
0
Thanks TechAsh and Luke, I am halfway through w3's PHP Basics now. :)
 

Smith6612

I ate all of the x10Pizza
Community Support
Messages
6,518
Reaction score
48
Points
48
LOL the n00btubers are back in Star Wars: Battlefront II today. I keep getting hit by them, but they are running into my land mines since I play as a heavy. It's always funny yelling into the game saying "HAH! You n00btube me, I land mine you n00bishly by placing mines on a door" :D
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
Edit: Stupid me, can't remove folders with this. I was wondering if it was possible to use is_dir() to check if it's a directory and remove the files from it, but this would only to go so far into the tree. I want to keep it OO, but this is getting more complicated now...Any ideas on how to make the code in my post above delete ALL subdirectories as well as the files?

-Luke.


Thats why I posted this one just above the quoted post of yours
PHP:
$dir_stack = array('test/');
$i = 0;
while ($i <= count($dir_stack)-1)
{
    echo $dir_stack[$i].'<br>';
    if ($dir = opendir($dir_stack[$i]))
    {
        while (false !== ($file = readdir($dir)))
        {
            if ($file != "." && $file != ".." && false == is_dir($dir_stack[$i].$file))
            {
                unlink($dir_stack[$i].$file);
            }
            elseif ($file != "." && $file != "..")
            {
                array_push($dir_stack,$dir_stack[$i].$file.'/');
            }
        }
        closedir($dir);
    }
    $i++;
}
$i = count($dir_stack)-1;
while ($i >= 0)
{
    rmdir($dir_stack[$i]);
    $i--;
}
Just changed the preg_match('/\.{1}/',$file) to is_dir($dir_stack[$i].$file) as it would be more predictable :p

EDIT
Works like a dream, folders within folders with files all over the place. Anything in the array $dir_stack is treated as TO BE DELETED.
 
Last edited:

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
Thank you B.

@tnl: If you want to make that OO I would recomend rather creating a file handling class. Would seem silly to turn 1 function that only has 1 argument into a class all on its own :p
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
Not bad.

You might want to remove the 2 blank spaces(&nbsp) before the Free space/bandwidth
Code:
<br>Free Space in %: <br> &nbsp; <img....
Also I have further worked on the stat bar so it can have a gradient from and to what ever RGB color you want via the query string. Also has a 3D switch that will bring in a 2nd gradient to white and back again across the x axis.
eg
index.php
index.php

funny how the img tag is not working for me now :(
http://www.defectalisman.com/class/...255.255&sg=0.125.125&eg=255.15.15&time=1&s=3D

to switch off the parse timer just remove the time=1 totaly from the qs.
Updated version can be found here -> http://www.defectalisman.com/examples/statBar.rar
 
Last edited:

Mitch

New Member
Messages
908
Reaction score
0
Points
0
hey defec, what do you think about my implention of the cpanelAPI http://jagf.net/ ? (look at the bottom)

Wow, you really have got a lot of disk space.
total 10000 mb, but you only use 500 mb.

360 Dergree Snake:
mrghosty - 340,282,000,000,000,014,192,072,600,942,972,764,160
Link: http://forums.x10hosting.com/arcade.php?do=stats&gameid=495

30k Starfighter:
mrghosty - 4,263,240,000,000
Link: http://forums.x10hosting.com/arcade.php?do=stats&gameid=494
Can these highscores be real?
 
Last edited:

DeadBattery

Community Support Team
Community Support
Messages
4,018
Reaction score
120
Points
0
Thanks Mitch, I have posted a thread regarding this in the staff section. :)
 

kkenny

Active Member
Messages
1,950
Reaction score
0
Points
36
Woww. I need to be the 1,060th poster on this thread. I feel special D
 
Top