Introduction
All images hosted by Imgur.com You can view the full album at HTC EVO Pics at Imgur.com
I recently ventured into the realm of Smart Phones with my latest purchase of the HTC EVO 4G by Sprint. Really I have been holding off on upgrading phones mainly due to the fact that I found the data plans to be too much for my needs. Well I have had a mobile broadband card for just general trips with my computer. Well I was doing some searching and I found for less than double the price (about $10 less) of what it cost to run my mobile broadband I could get a new smart phone, so here I am with the new HTC EVO 4G and these are my findings about the phone, to hopefully help you decide if it is right for you.

The Look and Feel
The HTC EVO 4G is a pretty cool looking phone. HTC EVO is a decent sized phone. To put it into perspective here is the phone next to a credit card. The phone's colors can be changed by buying it either in one of the colors offered or by buying a "skin" for the EVO. The EVO fits pretty nice into my hands, I have probably average hands although at times the side of my hands press random items and makes my phone seem like it is wigging out, which is just mainly due to my lack of attentiveness and is easily remedied by paying a bit more attention to how I hold it.

The screen is amazing, I love the touch screen with the "flick" and "pinch" type technology. It is so easy to run and navigate through. It does get smudges depending on what is on your hands, but they are usually easily cleaned by a cleaning solution or just putting the phone into Stand-By and wiping it down with your shirt. I do not know how it works with the screen protectors as I did not buy any, but that may help with the smudges and preserve your screen. The 4 buttons at the bottom of the phone help the navigation and make it easy to get back to "Home" or find extra options for certain applications. All in all the EVO looks awesome and the EVO feels great in my hands.

The Software
HTC EVO has a superb interface, granted I have never used it's competitor the iPhone, but from what I can tell this interface is just great. Once you get the hang of it everything kind of just flows together and is pretty smooth and fluent motions. The "Home Screen", which has 6 screens around it when zoomed out, is fully customizable with Widgets. For instance, my home screen has 3 rows of applications with the top row being the Clock and Weather. I have not messed around with designing / rearranging it to be much different, but I will eventually get around to finding more widgets and implementing them. For now, I like how I have my HTC EVO setup.

Since the HTC EVO is ran off of the Android technology this allows for ample applications (both free and paid). So far I have found just about an application for all of my needs, such as a Craigslist App a GPS Mapping App a Ping.FM Posting App and an IRSSI + SSH Connection App so I can login to my SSH server and do IRC Chat from there! Not to mention it has awesome Speech to Text technology built in. If you talk clearly into the phone when this is activated, it does a really accurate translation, I was very impressed by the Speech to Text technology. The wide variety of applications that are offered for the HTC EVO, plus the fact that anyone can pretty much develop the Apps, just makes the EVO superb in that all you have to do is learn how to and boom, you can generate your own App!

The Hardware
I am no expert on Phones or phone hardware. Perhaps the biggest downside of the HTC EVO is the battery life right now. Since the screen is so big and with the 4G connection plus Bluetooth, GPS and WiFi / WiFi Tethering (requires a $30 / month charge) Capabilities, well they tend to drain the battery pretty fast. After probably a good 2-3 hours of "normal" usage (without talking on the phone) the HTC EVO tends to drop to half the battery. This is with WiFi enabled, WiFi tethering disabled, 4G disabled (no 4G in my area yet) and BlueTooth disabled. Just normal usage tends to drain the battery pretty good, luckily I have a USB car charger from a previous item I bought and I can just swap out the USB cord. Since it did come with 1 USB Cord and the HTC EVO can be charged by computer / laptop that is my main source. If I am just at my laptop typing, like I am now, I tend to have my HTC EVO connected up and charging, this may be overkill, but I would rather have it charged incase something comes up unexpectedly.


The HTC EVO comes with an 8GB MicroSD Card, it is not the biggest but works for an out of the box card. You can buy multiple 16GB Cards for around $30/card or go for the big boy 32GB MicroSD card, which will run you at $100+ right now. This brings me to my first pet-peeve about the HTC EVO. In order to switch out SD Cards you have to pull the battery out. This can be an annoyance, say you want to have a card with just your music on it and a card for just normal use, well you have to turn off the phone, pull the battery pull out the card put the new one in put the battery back in and wait for the HTC EVO to boot up (around a minute).

I love having the GPS ability of my HTC EVO, this will allow me to go hike trails and map where I have been or even drive to a location and generate a map / GPS data with way points. This is huge for me as this way I will not have to buy a "GPS" tracker separate, this is all done on my phone, not to mention that there is probably a TOM TOM type App, which I have not looked into / tried yet. With the GPS enabled, you can easily post where your current location is at and the Google Maps app auto detects your location and will pull up the map to where you are now. If you are not one who likes GPS, this is easily turned off (I tend to leave mine off unless I am going somewhere I want to track). But none the less is an awesome feature.

The bluetooth chip works as normal. I have not had any issues pairing the EVO with any headset yet and the sound quality is decent, although it could be a bit louder, which is another pet peeve about the EVO. The sound seems to be really soft when listening to media / using the speaker phone. I am pretty sure this is a hardware issue. But if you plan on listening to the EVO on Air planes, it maybe wise to buy those fancy headsets that does the noise canceling, as I cannot see being able to hear the tunes very well without some of those (given the max volume). But again, this issue is easy to work with and I may be missing a setting to turn up the main volume of the phone (I need to investigate that). But given that the HTC EVO is in it's early stages perhaps updates will alleviate the sound issue or maybe there is an App that can override the sound and boost it. All in all the hardware seems to be very sturdy and built / thought out very well, at least in my opinion.

Miscellaneous Items
There are some minor items I wish to address here as a buyer information. The HTC EVO has a special USB Cable needed, these cables are cheaply bought on Ebay (around $5). I plan on getting an extra cable to keep one at work, maybe one for the car and home. The sound on the EVO, as stated above, is not the best (The phone call quality is good, just the media / speaker phone sound). I wish it could go a bit louder and easier to hear. The SD Card being under the battery is another minor issue in that it is a pain to switch out cards, given that the 32GB MicroSD Cards are so expensive. The battery life, which is known, could have a better life, this may be alleviated later on with a better battery that can be purchased, I am hoping for that and will probably by the replaceable battery with extended life when it comes out.

But aside from the Cons the EVO has many Pros, which definitely out way the cons, such as the numerous number of Apps that are Free and work decent, it's flawless integration with Google Technology, such as Gtalk, Gmail, Gcal, Gvoice and other google services. And since it is Google Technology, you can rest assured that it will stay above and beyond the curve of technology in general, such as with the Speech to Text.

Ending Notes
Well I am very pleased with the HTC EVO 4G from Sprint. It is exactly what I wanted in a smart phone and more, in fact the HTC EVO is exactly what I have been looking for since the early 2000's when Palms / Windows Mobile were coming out. The HTC EVO's ability to Sync with Google Calendars flawlessly, integrate Google Voice, so your number always shows up from Google Voice and it's software seriously sets the HTC EVO above anything I have used before (which as stated wasn't anything recent). The main thing that I like about the HTC EVO is Android backed software. If you are thinking about buying the HTC EVO I would highly recommend it, I have not regretted my purchase yet.


Introduction
I just bought my new HTC EVO 4g after doing my research and waiting for a week for the backorders to clear up. Well I finally received my HTC EVO 4g and was going to start off with it by Wireless Tethering. Well following my original instructions, Free Wireless Tethering (HotSpot), yielded now results due to an OTA update that ships with the newest EVO's. Well I set out to find a new method to Root my EVO 4g and to my delight I found it! And my success would not have been remotely possible without the help from the XDA Developer Forums and particularly the thread by jiqqaman titled SimpleRoot .1 ---- 3 Click Root w/ nand unlock!!, which unfortunately, I found out was not the right thread for the newest OTA. For the newest OTA, this thread, SimpleRoot OTA 1.47.651.1 Edition, is the correct one and I have uploaded the file to my site for the first 400 downloads. You can download SimpleRoot for OTA 1.47 here to show my support and appreciation, but it will be limited to 400 downloads. If as time goes on I feel I can spare the bandwidth I will up the download limit. Your IP will be logged on the download, and only allowed to download once. Please do not download more than once as a courtesy to my server and everyone else. Without further delay, here is my trials and errors in attempting to root my new HTC EVO 4g!

Background on Rooting EVO Attempts
I spent the majority of the night testing and retesting. At first I just tried to install UnRevoked with Wireless Tether, well since the new OTA, of course this would not work. Because my phone was brand spanking new, it came with the OTA updated. The newest OTA caused some minor heartache once I found out that it blocked most prior Root attempts. Well I was thoroughly bummed and in search of an answer. I went over to the XDA Developer Forums and found a thread, (see SimpleRoot .1 ---- 3 Click Root w/ nand unlock!! link above) and tried as I might to get it to root my HTC EVO. I kept getting “Main Version is Older!" error, which thoroughly baffled me and confused me. Well I searched that forums and found make shift “solutions", which none worked. Finally I went back to google and searched the XDA Site...well I found a similar post SimpleRoot OTA 1.47.651.1 Edition that was for the newest OTA, /facepalmed my self to oblivion. I was following the old guide and not the new one. Well since I started following the newest SimpleRoot guide, let's just say things go a bit smoother. So now that the background informations is set, here is the actual guide of the steps I took.

Root the HTC EVO
Pre-Requisite Alert!!!!
Before attempting this you will need the Microsoft .NET 4 Framework installed and HTC Sync . So obviously this will only work on a Windows Computer. If you are an avid Linux User like myself, simply find yourself a copy of a Windows, I chose Windows XP as I had a CD for it and install it. You should be able to accomplish this within the 30-day Trial Period.

Disclaimer:
The following instructions can potentially HARM or BRICK or BREAK your HTC EVO phone. Follow them at your own risk. This is simply a “learning guide" and nothing else. I take no responsibility in any adverse effects that may come to your phone from this. This may void your phone warranty or your phone companys TOS, so be sure to read them before trying and know that you are TRYING THIS AT YOUR OWN RISK. ALSO NOTE: This may remove your 4G capabilities. If you have 4G Available and want to continue using it, DO NOT PROCEED!

The Steps to Root HTC EVO
First of all the software will be needed, as long as the download limit of 400 has not been reached, you should be able to download it here, if it has well see the forum for extra download links using Megaupload. Once the files are downloaded, extract them anywhere you want. I chose the Windows Desktop, given that it was just a temporary install. Once they are extracted it is time to do some prep work on your phone. First up, you will have to wipe all your data. If you have data (I did not as my phone was brand new) I would suggest finding ways to back it up, I do not know of any but I am sure Google.com can assist you in finding more information about backing your data up. Your phone needs to be in USB Debugging mode, to do this you will goto MENU > Settings > Applications > Development > USB Debugging and check it. This is a key step and the rest will not work without that mode set.

Open the SimpleRoot program, I believe it is called OTARoot. Once it is opened up you should see an image like below with 4 buttons:

Now before you connect up, make sure that you do want to do this. If you are, connect your phone up and press the first button “Push files + Factory Reset". A command prompt screen should pop up and give you instructions, be sure to follow them. Read the whole thing first before you act. The factory reset I had to manually execute it on the phone, the instructions should tell you how.

Once the factory reset and the instructions tell you to move on to Step 2 it is time to push the second button “Clear Browser". I am sure this does what it says, but I cannot recall exactly. Just be sure to read and re-read the instructions before acting on them that pop up. Once it is finished, time to move onto Step 3, which is “Use Flash Hack". Now this step I think I messed up on which gave me the “Main Version is Older" error. Make sure that after you goto the website it instructs you to, to refresh the page after it is loaded, if you do not well, it is not a complete loss as there is a way around that problem. It is better to follow the instructions.

If you did not follow the instructions, to re-mediate the problem that comes up with “flash_image" not found, simply copy the flash_image from the extract OTA SimpleRoot archive to your Phone. This is a pain because you have to un-plug your phone from the computer, plug it back in, set the USB Mode to Disk Drive and copy the flash_image to the root of the SD Card. Once that is done, un-plug your phone again, switch it back to Charge Only and then re-run Step 4.

Step 4, “Reboot + Scan" is the most important step. Make sure to read the instructions fully. This will basically install the earlier version of the OTA which will allow you to root your HTC EVO device. After the image is pushed, the initial boot will take around 5 minutes. So be patient. Once it is back online, you are set up! If the USB Cable is still connected, on the SimpleRoot program goto Extras > Clean Root Files. This will clear up your SD Card automatically. Once that is done, you can unplug your device, set the USB Debugging mode off if you want and poof! You have a Rooted device.

Wireless Tethering on HTC EVO
Since my ultimate goal was to setup my device as a WiFi hotspot, here are those instructions as well, I credited the writer / originator with the link up top, please feel free to view that post if you want. For ease of the guide I will post similar instructions here.

First up we have to allow “unknown source" applications to be installed (you can change this back after installing the following software if you like). To do this on your EVO Press Menu > Settings > Applications > Check the Unknown Sources. Once this is done, go back to the Home screen.

Next, open your EVO's Internet Browser (Applications > Internet) and browse to: Unrevoked and download / install their application. This is straight forward simply click on the screen when prompted. Once it is downloaded and installed, it is time to get the Wireless Tethering software installed.

Open your Internet Browser and browse to http://code.google.com/p/android-wifi-tether/downloads/list Or, I setup a goo.gl located at http://goo.gl/4lac (after the 4 it is an L just lowercased) to shorten the amount of typing you would need to do. Download the “wireless_tether_2.0.5-pre2.apk" and install it to your HTC EVO. Once downloaded and installed go back to the Home screen. Goto the Applications and open up Unrevoked (you will need to do this anytime you turn off the tethering or reboot the phone BEFORE you start the Wireless Tethering). Once at unrevoked press “Start" this will take a few seconds and will go green. Once the start is no longer green or you get a message that says “Rooted" go back to the Home screen to the Applications and start up the “Wireless Tethering" This should start up and you are good to go! Modify your settings for the SID / WPA Key etc and now you have a Wireless HotSpot with your new EVO.

Conclusion
Rooting the HTC EVO OTA 1.47 has been a great journey and learning experience for me. It was frustrating at times finding all the quirks of information, but in the end I got it done. If you find your self needing advanced help I can try via comments, but probably better to post the threads listed above, they are much smarter than I am and have more experience with the EVO. I am mainly writing this as a log for me in-case I accidentally update my phone and have to do this again. Hope it all works well and this guide saves you some hassle in the future.

Gods Speed!

EDIT:
Changed the unrevoked part, as that is not needed. The image should be rooted with out it.

by Frost

Introduction
The past few days I have been digging and diving and reading through many different tutorials about setting up SVN (or Subversion) through Apache2 on Debian based Linux Distro's. After many trials and errors and taking down my webserver a few times I finally was able to get a full on SVN Server for my main website up and running with Authentication over SSL, and here is my tale.

The Line of Thinking
I have always wanted an SVN server for my main web server but never really had the time or motivation to figure out how to do SVN through command line (SSH) and on a Debian Linux Distro. Well the past couple days I have spent countless hours working on my main Xubuntu install getting SVN figured out and working. Then porting that over to my Server which has Debian Etch installed on it. How I wanted my SVN repository setup was what made sense to me for a web server. I stuck to the basic Tree with "trunk" and "branch" but decided to omit the "tags" since it is a website I am "versioning". Here is the tree structure:

    | ___ branch
    |         ___ www
    | ___ trunk
    |         ___ www

This structure suited my needs perfectly, as I wanted my other developer (it is only me and one other person) to be able to setup a webserver locally with branch then once the code is working under branch copy it over to trunk. Anything in trunk could at anytime be copied to webroot via a shell script. So I have stressed many times to only copy / commit working projects / files to trunk. Since this makes sense in my mind, it may not in yours, so do what you feel is best, I just found that structure to work for my needs.

Preparing The Server
Whether you are going to be setting up SVN on your local server just for your self to keep track of projects or on your remote server there are some steps to take to setup the server, with the first one being making sure you have the packages installed that need to be installed. If you are using Debian, the aptitude package manager. Here are a list of packages that are needed (Note I am assuming you are working under Apache2):

subversion
libapache2-svn

So a simple command (seen below) can make sure you have these packages installed:

sudo apt-get install subversion libapache2-svn

Once that has been done, we need to make sure that DAV and SSL (if SSL is wanted) are enabled by doing some simple commands:

sudo a2enmod dav
sudo a2enmod ssl

If for whatever reason you need to disable a module, the opposite to a2enmod is a2dismod (dis for disable). This is much easier then manually creating the symbolic links, and I would suggest you to use it.

Now that we have our webserver prepared (sort of) to at least handle Subversion Repositories the DAV mod and SSL connections, let's get to creating the subversion repository.

Creating the Subversion Repository
The subversion creation is really straight forward. I put my repositories under /var/svn/project_name, this is just a preference, feel free to choose where you want to put the repository, just remember the location as we will need it when we get to the VHosts file later on.

Before we get to far into the subversion, I love to create a template directory structure to do for the initial import, so here is a bash script, using a similar path to the one above to setup the structure I have outlined in this script:

cd /var
mkdir svn
cd svn
mkdir -p template/branch/www
mkdir -p template/trunk/www

Using the directory I stated above, here are the commands I would use to create the initial repository:

cd /var/svn
mkdir project_name
svnadmin  create project_name
chown -R www-data:www-data project_name
chmod -R g+rws project_name
svn import templates/ file:///var/svn/project_name/ -m "Initial import for structure."

Those commands are pretty straight forward. We need to change the owner (chown) to be www-data so Apache can effectively create / delete items to and from the repository. We also need to change the mode (chmod) to g+rws which essentially sets that any user part of the group www-data has read / write / and to set the user / group id upon execution. Viola we should have a fully working Subversion Repository (well almost fully working).

by Frost

Introduction
Recently I had a pretty massive fiasco at work which nearly gave me a heart attack. Apparently one of the harddrives in our Network File Server decided to give out and the backups I had been doing stopped working (have not ran for a month or two) due to a Windows Patch. As most of anyone who has been in the situation of losing important data that you thought was backed up, it is very nerve racking, especially since all the data recovery programs I have ever used never re-created the folder structure. Well your troubles are over, Recuva is an excellent file un-delete recovery program that is also free!

Recuva
Through out the day when I realized that the file server's harddrive had been erased I was doing research for free solutions to file recovery / un-deletion. In my research I tried a few different programs, which worked but not very well until I came across Piriform's Recuva program. This program seemed well developed and they offered a portable solution (meaning you can install the software onto a Jump Drive and run the recovery software from that Jump Drive. This is an ideal solution, as installing any new software onto a harddrive can put your data at risk of not being recoverable (due to over-writing). To say the least I was extremely excited about the Free Recuva Software from PiriForm and could not wait to try it.

Using Recuva
When I started the software up it had a quick recover option or a deep scan, since the deleted data that I was trying to recover was highly sensitive I opted for the deep scan. This took about 5 hours on a 250 GB (gigabyte) harddrive. I let the Recuva Program do it's thing and left the computer fully alone during this time. When I came back I was astonished to see not only did it find all the files (and then some) but it also had the full paths listed! Well before you get too excited and hit "Recover" there is a simple setting you need to know about. Inside the Recuva Options you will need to check a check box "Recover with path Name" this will do just that! It will take those paths and recover the files with that path name.

Now when using this program it is necessary to recover all the files you want to an external harddrive, so you will need a harddrive of comparable size to the data you are recovering. Not doing so, which the program may not allow, can cause data to be over-written and un-retrievable from that point on. Just be aware of that before you try to do this recovery to have that. Then just check all the files you want to recover (if you want to select all click on the first one, Hold Shift then press End then press space and it should select all files). Now you just have to wait. Since I recovered to a USB drive (that was not 2.0) it took a fair amount of time (roughly 6-7 hours). But was well worth the wait.

After the recovery I verified the files and 99% of the files were recovered succesfully and worked flawlessly. One of the other nice benefits of Recuva is that it adds _X (where X is a number) to any duplicated files (meaning the other one was previously erased / different version). This is very handy as you can enter the file and pick which version you want to keep, especially incase one is corrupted.

Ending Notes
Well I had to learn a hard lesson this day, but I was so excited there was a free File Recovery / Un-Delete program that worked great (I would put this over programs such as Recover4All, which you have to pay for anyday). I have donated to PiriForm for this program, as I always support software that has helped me. This was a massive help and I think PiriForm for making it. Hopefully you will not require Piriform's Recuva services, but if you do you now know that PiriForm Recuva is definately the software for your file recovery / restoration / un-deletion needs!

by Frost

Introduction
In reference to How To: Join / Combine MP3’s for Free on Windows, I decided to create a tutorial for combining / joining MP3s on Linux for Free as well. Although the process is slightly different it is still the same process, so let's get to it.

Initial Steps
First up we will use the Cat command to combine files, this is highly useful for combining text file, but will also combine binary files flawlessly. Before we plunge head first into combining MP3's we need to first remove any ID3 tag information from the files. In order to do this I installed a program called "eyeD3" on my Ubuntu system through Synaptic Package Manager. The command for eyeD3 to remove all tags is as follows:

eye3D --remove-all /path/to/mp3-files/*

This will remove all versions of ID3 tags on any MP3 in the directory pointed to. Doing this will prevent some MP3 players from acting weirdly (such as skipping over parts of the joined MP3). Now that we have our files setup, time to combine the files.

by Frost

Introduction
Recently I have found a need to setup an ICS (Internet Connection Sharing) system for personal uses. Doing so was actually really simple and so I decided to post a guide just to help anyone who is timid about setting up their own personal network with internet to be ready to take it on in full! All you will need is at least 2 computers (only 1 needs XP on it), a hub, an internet connection and a willingness to try!

The ICS Setup in XP
Before we dive into the ICS setup in XP let's do a few check lists items. First of all make sure you have a hub for a Cross-over Ethernet wire (to directly connect computer to computer). If you have a hub, make sure the cross-over setting is turned off (as depending on your NIC, it should not be on). On the XP Machine, I would make sure the Windows Firewall is on, as you want some type of filter for your network to prevent bad stuff from getting through. As a side note, if you are worried about network security I would suggest investing in a HUB. Now that you have your setup (and network wires). It is time to connect them all together. I should note, if you have a DSL / Cable connection that comes in over the NIC you will need another NIC or Wireless card to allow connections from the other computers to the host computer (or connect the modem with USB if available). As this can only be done with more than one type of network card (one for the incoming connection the other for the LAN connection).

The Actual ICS in XP
Now that we know we have the correct ha dware to do ICS in XP we simply have to right click on the connection in Network Connections find your internet connection card and right click on it then go to Properties. Under the Advanced Tab there should be a simple check box to "Share this Internet Connection" Check that and viola your connection is now shared. You should now be able to go on to one of the computers you connected to the HUB or directly with a cross-over ethernet wire and test the connection (you may have to disable / re-enable the connection) and should be able to get to the internet.

Ending Notes
Sharing an internet connection without a router using a Windows XP box is very easy and simple. Doing this method may not be as reliable or secure as using a Router, but is a cheap and easy method to share an Internet Connection among multiple computers! You can even use the same scheme to setup a wireless network, except instead of using a Land line card for serving the other computers you would use a wireless card and set it up as an Access Point.

Either way, hopefully that helps you out to setup a connection that is easy for personal use where security may not be a huge concern!

by Frost

Introduction
In attempting to figure out my next PHP Tutorial to post I decided to do another basic tutorial, as it does seem a lot of people want basic PHP tutorials. As such I decided to do a tutorial about how to pull data from MySQL using GET data in PHP while filtering / sanitizing the data. Using the method provided in this tutorial you should be able to use in a multitude of ways, such as a profile page a "view contents" page etc. Pull out the Mountain Dew and let's get cracking!

The Setup
Setting up a simple DB for testing is necessary, at least just for this tutorial so we will do a view contents table that will hold a viewid, title and content. Keeping things simple is essential so only add fields you need. Time for the SQL Structure:

CREATE TABLE view_content (
	viewid INT NOT NULL auto_increment,
	title VARCHAR(50) NOT NULL,
	content TEXT NOT NULL,
	PRIMARY KEY (viewid)
);

Now for the test data:

INSERT INTO view_content VALUES (1, 'Test 1', 'Testing Content 1.'),
	(2, 'Test 2', 'Testing Content 2.'),
	(3, 'Test 3', 'Testing Content 3.');

Now that we have our SQL table created and the test data added we will go about how to pull this information from the database.

Retrieving the Data from SQL
Gathering the data from MySQL will probably be the most difficult part about the script, as everything else should be straight forward, so given that you have basic MySQL knowledge this should be a peice of cake. Let's just get down to the nitty gritty:

<?php
/**********************
File: view.php
Author: Frost
Website: http://www.slunked.com
***********************/
 
// Be sure to change these values to match your databases.
mysql_connect("localhost", "username", "password") or trigger_error("MySQL Connection Failed: " . mysql_error());
mysql_select_db("database") or trigger_error("MySQL Select DB Failed: " . mysql_error());
 
//Check if we have GET data and if so static cast it to an integer.
// Casting it to INT will prevent SQL Injection etc.
$viewID = isset($_GET['id'])?(int) $_GET['id']:false;
 
if ($viewID) {
	// Well we have a valid integer let's try to grab it:
	$sql = "SELECT viewid, title, content FROM view_content WHERE viewid = {$viewID} LIMIT 1";
 
	$result = mysql_query($sql) or trigger_error("Retrieving View Contents Failed: " . mysql_error());
 
	// verify that we have 1 result
	if (mysql_num_rows($result) == 1) {
		$row = mysql_fetch_assoc($result) or trigger_error("Fetching Row failed: " . mysql_error());
 
		$output = <<<OUT
			View ID: {$row['viewid']}<br />
			Title: {$row['title']}<br />
			Content: {$row['content']}<br />
OUT;
	}else {
		$output = "An invalid view id was passed.";
	}	
}else {
	$output = "An invalid view id was passed.";
}
 
echo $output;
?>

As you can see we make sure that we first have a valid ID to attempt to retrieve, if not then we display an appropriate error message. If so we fetch the data and put the data into a string to display at a later point in time. As a note, the URL to access a "view" would be something like http://www.yoursite.com/view.php?id=x . That is that.

Ending Notes
Not a very long tutorial, but sometimes it is simple enough to not require much more than just the script. As stated this is a very simple and broken down "view" script to help you grab the concept and be able to use this for your own site / needs. The key to remember, if you choose not to use an ID be sure to escape any GET / POST data that will be used against the database with mysql_real_escape_string(), if you do not you will be opening yourself up to SQL injection. I did not use that method in this script because we were using an integer which can be statically casted to prevent SQL Injections. As always if you found this script useful, please link to it!

by Frost

Introduction
Recently I had a need to combine multiple MP3 files into one. Looking at the many different MP3 Joiner / combiners I found most of them to be bulky and just not what I was looking for in an MP3 Joiner / Combiner. After doing some digging into the Windows Command Line I came across a flag for a common function, "Copy" that intrigued me. After reading up on the flag of the Copy command in Windows I decided to give it a try with some tests. Where this came about was I copied some Books on CD to my harddrive a while ago (and the CD's have long since been scratched beyond fixing) so now I have about 15 files per chapter for 30 chapters. I would rather combine them into 30 MP3 files instead of the massive amount of files. Well let's take a look at the results of my findings!

/B Flag for Copy Function in Windows
The copy command in Windows has a flag that is /B, which is used for binary copying. Intrigued by this feature I pulled to random MP3 files into a new folder to do some testing, as I have previous used copy functions to combined some text files, I figured why not? It should work the same with the binary files, as that is what MP3's are. My first test, as said, was very basic and simple:

copy /B mp3_1.mp3 mp3_2.mp3 mp3_12_combined.mp3

Which in return provided me with a joined mp3 1 and 2 file. Such a simple command to join MP3's.

by Frost

Introduction
Recently I had an inquiry about how I would go about creating a directory in a PHP script using a FORM with POST / GET data. Creating a Directory from a PHP script using PHP is not all that easy and should be done with caution, as you want to make sure that you validate the input and prevent un-wanted characters from being used to create a directory. Use this script with caution and I would even go so far as to hiding it behind a User Login script and require a valid user.

The Form
For simplicity we will use a very basic input form to submit POST data to the PHP script (I opted to use POST because it is my preference for a php script like this). You can use GET, just be sure to reflect that in the form and on the PHP script. The components of the PHP script will simply be the <form> tags and 2 input tags (one for directory name and one for submit). Here it is:

<?php
/**********************
File: createDir.php
Author: Frost
Website: http://www.slunked.com
***********************/
?>
<html>
<head><title>Make Directory</title></head>
<body>
	<h2>Make Directory on Server</h2>
	<form name="phpMkDIRForm" method="POST" action="createDir.php">
	Enter a Directory Name (Alpha-Numeric only): <input type="text" value="" name="dirName" /><br />
	<input type="submit" name="create" value="Create Directory" />
	</form>
</body>
</html>

The form is really straight forward, we will add more to this form onto our next step which is creating the actual PHP script.

by Frost

Introduction

Helping out on forums with PHP problems, perhaps the main issue that I come across is people posting how to fix "Warning: Cannot modify header information - headers already sent by". In light of that issue I decided to try and put yet another blog / how to document out there to fix this error, hopefully people come across and find the information I have provided useful, so lets dive into PHP's headers already sent by error!