The Director!

The Director! is essentially a URL redirection/shortening service. Similar to tinyurl.com or many of the other ones in existence.

The difference? I wrote this, and I didn't write the other ones and probably lots of other stuff that I don't know about the other ones.

But seriously, this is a service you can deploy for yourself or your clients without relying on other services. This comes with the same issues as other services:

  1. If you go offline, or change your links, the internet breaks.
  2. You could get evil, and replace a good link with an evil one.

Project Status

Status Released (Download - 35.9kb)
Released Verion 0.1 (Change Log - Release Date: June 28, 2010)
In Development 0.2 (Roadmap - Release Date: ???)
Bugs/Bug Tracker http://bugs.cornempire.net/view_all_bug_page.php?project_id=1

Description

The Director! is written using PHP, designed to run on apache. Its most useful feature relies on the apache rewrite module. The Director! breaks down like this:

  • There is a single script that handles all redirection and stat tracking
  • There is a database that stores all of the link redirections and tracking
  • There are supporting scripts that allow you to manage the links and view the stats

Development of The Director! will take place in a number of phases, with a release after each phase. Features of each phase will be discussed below.

Installation and Configuration

Requirements

You will need PHP, apache (with mod_rewrite for nice redirection), and a mysql database available (it is possible to share a database, but that requires additional configuration on your part)

Installation

  • Unzip the files into the directory that is web accessible. Do not put the files in the directory you intend to use as your forwarding point (if you are using mod_rewrite).
  • Create a DB user for the database (or use an existing user if you only have one database available. If this is the case, you will need to configure a prefix in the next section). Below is a mysql example:
mysql> create database director; <-- You can skip this step if you use the mysql command line tool to create the DB.  If you create the DB ahead of time, you will need to comment out the first line of the db.sql script.
Query OK, 1 row affected (0.00 sec)

mysql> create user 'director'@'localhost' IDENTIFIED BY 'somepass40ouioei54#9$#$';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON director.* TO 'director'@'localhost' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
  • Run the SQL commands in the db.sql file. This will create the database/tables and set up the default passwords.

If you want to use an existing database, you will need to add a prefix in front of the three tables in the db.sql file before you run it.

Configuration

  • Rename the config.dist.php file to config.php and enter in your values for the database and the other configuration settings:
define('DBHOST','localhost'); //Database host, most likely localhost
define('DBUSER',''); //Username of your database user
define('DBPASS',''); //Password of your user
define('DB','director'); //The name of the database.  Change this if you have to share a database
define('DEBUG',false); //Probably want to leave this false unless you are developing something new for it
define('DBPREFIX',''); //This is the DB Prefix, if you are sharing a database, and had to modify the db.sql file, add that prefix here.

if(DEBUG){
	error_reporting(E_ALL);
	ini_set("display_errors", 1);
}
  • Go to http://{YOUR URL}/director/login.php EX: http://www.yoursite.com/pathtodirector/login.php
  • Log in with the Edit Information account, and the password directoredit.
  • Update the passwords for the system by clicking on the SEttings link.
  • If you are planning to use the apache rewrite functionality, also set rewrite to Yes and Rewrite Root to the directory that you plan to base your redirection in.

This doesn't have to be an actual directory on your server. It only needs to be a virtual directory. For example, if I wish to have my redirects go through a directory called go on my server, I would set rewrite root to: http://www.cornempire.net/go/

  • Also configure the Default Page setting. This is where people go if they enter an invalid link into your site. So an example would be: http://www.cornempire.net/scripts/badredirection.php This would be an information page telling the user what went wrong, or maybe the default page of your homepage.
  • OPTIONAL: The next step is configuring apache rewrite. A .htaccess.dist file is included in the package. If you have .htaccess enabled on your server, you can rename .htaccess.dist to .htaccess, and then modify to suit your configuration. If you do not have .htaccess configured, you can copy these settings into the Virtual Host section of your apache config. Here is an example configuration:
RewriteEngine on
RewriteRule ^/go/(.*) /scripts/director.php?linkname=$1

In the above example /go/ is the virtual directory where all of our redirects will point: http://www.cornempire.net/go/somelink

/scripts/director.php is where The Director! is installed. This command rewrites any request that comes to our site in our virtual directory go, and passes it to director.php which looks up where the user is trying to get, and forwards them there.

  • Now you should have a working instance of The Director!. Create a link, and then try accessing it to see if everything is working correctly. Check the troubleshooting section below if you have problems. If you problem is unresolved by the process below, use the links above to submit a bug to the developers.

Troubleshooting

Could not connect: Access denied for user 'director'@'localhost' (using password: YES)

If you get an error like this, you have an incorrect password or user entered, or have the permissions messed up. Start from the top of the installation instructions and make sure that you created the database user correctly, and that you created the config.php file with the correct values.

Operation

 [diagram]

thedirector/start.txt · Last modified: 2010/10/01 19:59 (external edit)
CC Attribution-Noncommercial-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0