Archive for the ‘PHP Scripts’ Category

Create Your Own URL Shortener

Sunday, February 13th, 2011

I don’t really pay attention to twitter that often,but I did notice more and more people are starting to use personalized url shorteners. There’s a lot of free services out there you can use, but if you have somewhere you can host a simple php script, why not make your own?

I ended up buying, and that’s what I’m going to set this up on. If I wanted to make things shorter, I could take off the /tyn but then I dont think it’d make as much sense. redirects back to this page, for example. If you need help picking out a short domain name, try out

To create my own shortener, I decided just to use php’s base_convert function which will convert to and from bases 2-36. For a personal url shortener, you shouldn’t need more than base 36. I did end up having to write a base 62 converter class for sh0tz so that I can keep urls short, but that’s another post another time.



Wednesday, August 18th, 2010

This is based off of du.php, and is basically the same thing except it lets you click on folders to navigate through the directory structure and see how much space each directory is taking up.

It uses php’s shell_exec function to call the du utility on the directories it’s in. So if your host doesn’t allow you to use shell_exec, this isn’t going to work for you. If they do allow shell_exec, but do not allow ssh access then this is perfect.


du.php – PHP Disk Usage script

Monday, August 16th, 2010

I’m starting to copy my scripts from but figured I’d start with this one so I can get the syntax hilighting/formatting down with wordpress.

 // $a = shell_exec('df -h');
//echo getenv('DOCUMENT_ROOT');
echo shell_exec('pwd');
$a = shell_exec('du -hx *');
//$a = shell_exec('ls -l');
echo '<h2>Disk space</h2>< pre>';
echo $a;
echo '< /pre>';