All work hosted here dates from 2010 or earlier. Please check out these sites for more recent work samples:
- Pew Pew Laser Blog: Personal blog - handed coded from scratch.
- Stack Overflow: Answers and Questions.
- GitHub: My GitHub repos - including the Mug of Sublime Text, html5-slideshow and other various open source contributions.
Throughout my web sites I've used PHP to improve the functionality and maintainability of each site. Here, I discuss in detail the PHP features behind each site, as well as provide some standalone scripting examples.
Resume Site PHP Features
This resume web site uses a few PHP variables to improve the upon the standard header, navigation, body, and footer architecture. The header uses many variables defined by each page to create unique elements such as a title. The footer closes all elements and adds statistic tracking to the page.
- $title: I've specified this variable for each php page here. It is then used in the title HTML element, and in the h2 element.
- $bodyid: This is one of the five main sections of the site, and allows the CSS-based navigation bar to highlight the current location within the site.
ReFIT PHP Features
The donation form uses the POST array to harvest the strings submitted on the form. I have employed PHP to strip certain characters from the input fields so as to prevent injection hacks. I then use PHPmail to send an email to the donation coordinator.
Although ReFITPortland.org has very low traffic, the client began receiving some odd emails from the form after it had been up for a few months. A spider kept submitting the form to send spam to the recipient email addresses. I have deployed the following CAPTCHAs:
- One hidden input field has a hard coded value which is inspected when the form is processed. If the string is not the expected value, then the user is presented with an error message, and the email is not sent.
- Another hidden input field is populated with the server's current time as the page is loaded. This time is then compared to the time when the form was submitted. If the difference between those times is too short, the script assumes an automated spider has filled out the form, and again gives an error message instead of sending the emails. I used this unobtrusive method of spider detection because it was important not to hinder possible site benefactors with extra steps to submit the form.
Taylor's Beach Cottage PHP Features
The content (photos, titles, copy and testimonials) for the virtual tour page is controlled via an associative array. Example:
$tour = array ( "1" => array ( "the_house", "The House", "This very cute house has a lovely front yard with plenty of room for relaxing.","Thank you so much for letting us use your beautiful beach house. We had such a wonderful time. It is a fabulous house. The kitchen was well stocked with everything you could possibly need for cooking.
- Jason, Joanne and the Girls" ), "2" => array ( "driveway", "Accessible Entry", "The driveway offers a very easy entrance.", "Thanks so much, what a wonderful retreat!
- Julie, Newberg OR" ), "3" => array ( "outside", "Another view of Outside", "Another view of outside the house.", "Thank you so much for sharing your wonderful cottage with us!
-Gwen & Jim, Portland OR" ), ... "27" => array ( "bedroom_2", "Master Bed", "Another view of the master bedroom.", "" ), "28" => array ( "bedroom_3", "Bedroom", "A private bedroom with a beach theme.", "" ) );
The virtual tour index reads this array, and counts through the main array to create a page of image thumbnails. Each thumbnail link contains a page location, image name, and title for the image's alt text; each of which is dynamically generated from the array.
When viewing a specific photo, the page reads the image name, title text, descriptive copy, and any comments and writes those to the browser. The script also generates the row of other pictures at the bottom of the page, allowing the user to navigate forwards and backwards through the photographs.
I chose GET rather than POST for the method so that if URL is bookmarked or emailed, the visitor's intended photo would be displayed.