Griffith Designs

Archive for October, 2010

PHP Empty a Folder

by webmasterjunkie on Oct.30, 2010, under Designs, Internet, PHP, Programming, Service, Web

Well been working on some cron jobs for my latest site, and had to find a way to dump all the files in the temporary folder. If you are looking to do this in PHP, here you go:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function empty_directory_folder ($dir, $deleteMe) {
    if (!$dh = @opendir ($dir)) return;
    while (false !== ($obj = readdir($dh))) {
        if($obj == '.' || $obj == '..') continue;
        if (!@unlink ($dir . '/' . $obj)) empty_directory_folder ($dir . '/' . $obj, true);
    }
    closedir ($dh);
    if ($deleteMe){
        @rmdir ($dir);
    }
}
// Call the function like this
// You can change the second argument to true if you want to delete the folder too
empty_directory_folder ('../tmp', false);
Leave a Comment :, more...

Working on a New Website

by webmasterjunkie on Oct.19, 2010, under Designs, PHP, Programming, Service, Web

Well, I am working with my old friend from the down under, yes Australia, on a new website. We are both hoping this one sells for as much as the last one we did together. This one is focused on blog traffic trading. Almost like the popular 2leep system. Right now I am working the code through while he gets his design together. Once all is said and done, we hope to get the site up and running by the end of the month. There are a few bugs in the code base, but PHP is relatively easy for me to fix. As soon as we get to that point, I’ll update with a link.

Leave a Comment :, , more...

PHP Percentage Function

by webmasterjunkie on Oct.15, 2010, under Internet, PHP, Programming

OK, sometimes you need a quick way to get a percentage, so here’s a little PHP code you can use to get one.

1
2
3
4
5
6
7
8
9
function get_percent ($part, $whole) {
    $numberOne = $part / $whole;
    $numberTwo = $numberOne * 100;
    $numberThree = number_format ($numberTwo, 0)
    $number = $numberThree . "%";
    return $number;
}
// Call the function like this:
print "You received a " . get_percent (21, 30) . " on your test.";
Leave a Comment :, , , more...

Photo Montage Complete

by webmasterjunkie on Oct.14, 2010, under Internet, Service, Video, Web

Well, my photo montage assignment is complete, another satisfied client. After all was said and done there were over 150 images which were size in Photoshop, Transitioned in After Effects and put on DVD from Encore. I love you Adobe. Now on to more coding work with an old friend. Last website we did together sold for over $500,000 so maybe this one will do as well.

Continue reading “Photo Montage Complete” »

Leave a Comment :, , , , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Connect