A product of my lethargy is a program called quickscript. Why is it called quick script you ask? Well, let's break down that word. The adjective quick obviously applies to script and so therefore the script is QUICK but what is the script? Well, the script is anything a script can be, in programming terms that is. So therefore we have surmised that it is a quick programming script. What part of the script is quick you ask? Well the execution part is actually quite horribly slow in comparison to the traditional flat file based method. The ability to create and utilize the script on the web without ever opening a FTP client is what justifies the use of the adjective quick.
Here's the script:
require('dbconnect.php');
if(isset($_GET['id']) && is_numeric($_GET['id'])){
$query = "SELECT * FROM scripts WHERE id = ".mysql_real_escape_string($_GET['id'])." LIMIT 1";
$result = mysql_query($query) or die('Query failed Couldn\'t get script from database!');
if($row = mysql_fetch_array($result)){
$content = $row['content'];
$type = $row['type'];
$lastuse = $row['lastuse'];
if($type == "php"){
eval($content);
}
else{
header("Content-type: ".$type);
echo $content;
}
$update_query = "UPDATE scripts SET lastuse = NOW( ) WHERE id = ".mysql_real_escape_string($_GET['id'])." LIMIT 1";
mysql_query($update_query) or die("Failed while updating timestamp");
}
else{
echo "No database entry matching this ID";
}
}
else{
echo "No ID was found!";
}
PHP Highlighting brought to you by the php function "highlight_file();".
As you can see it is incredibly simple and will probably save me a few minutes of my time everyday. If you can read PHP you've probably noticed that it records the time the script was last accessed back to the database. This is purely for information purposes and has hitherto been completely useless.
At this point your inner dialogue may be saying "Gee, this guy must make a lot of scripts to require something like this and if he doesn't then this whole script is a gigantic fallacy and what he's done is waste his time!". Well, I don't really know how to respond to such logical reasoning. It appears as though I have indeed wasted my time. Really though, I have a bit of a problem with creating a new flatfile script on my server just so I can temporarily mess with people in a message board.
With that in mind I would like to note that I haven't actually created an admin script for this. I modify everything using phpMyAdmin. Due to the scripts simplicity I think creating an admin script would waste even more time than creating quickscript did. Which got me thinking, about 80% of the stuff I've made has had such a simple database structure that I could have all the table modifications manually through PHP my admin instead of creating my own custom phpMyAdmin interface with everything labeled in pink and purple and with soft rounded edges so I don't cut myself.
I'm not sure if this is an actual release or not. You can copy and use the script without regard to properly giving me credit. It took about ten minutes to make. Use it as you like.