PHP Tutorials

  • By
    Editable Content Using MooTools 1.2, PHP, and MySQL

    Everybody and their aerobics instructor wants to be able to edit their own website these days. And why wouldn't they? I mean, they have a $500 budget, no HTML/CSS experience, and extraordinary expectations. Enough ranting though. Having a website that allows for...

  • By
    Knowing Website State Using PHP

    When I create a website, I create an "app-top.php" file to place website settings in. It's just easier to place a bunch of variable is that file, include it at the top of pages, and know that you only need to change one file if...

  • By
    Assign Anchor IDs Using PHP

    Last week, I challenged my readers to create a PHP script that finds anchors in an HTML document and assigns an ID to the element IF the element doesn't have an ID already. Jeremy Parrish stepped up to the challenge. The PHP The...

  • By
    Whitelisting:  You Set The Rules For Security

    We all know what blacklisting is when it comes to strings: removing specified "bad" characters. While this helps to secure user input, it isn't as secure as whitelisting. Whitelisting is the process of saying "Let me tell you what you can give me" whereas...

  • By
    Create HTML Elements Using PHP: html_element Class

    I love creating HTML elements using the MooTools JavaScript library. It's easy, fast, and the JavaScript code to create the element is beautiful. That got me thinking -- why don't I do this using PHP? When you build as many dynamic CMS-like websites...

  • By
    PHP and Echo

    As any beginner PHP could tell you, the echo function outputs data to the screen (or command line depending on how you're using PHP). Some, however, may not know that PHP's "echo()" isn't really a function at all. From PHP.net: "echo() is not actually a...

  • By
    Generate Readable Byte Labels Using PHP

    Whenever you manage disk space, it's infinitely easier to read when when the bytes are displayed in KB, MB, GB... format. When reading files on the disk, the server returns the disk space in bytes so it's on us programmers to program file sizes for...

  • By
    Manage Server Hard Disk Using PHP

    PHP provides some sweet functions to manage the server's hard disk. Here's how to use them. copy() Copies a file from a source file. disk_free_space() Returns the number of bytes remaining on the disk. disk_total_space() Returns the size of the disk in bytes. file_exists() Confirms whether or not a file exists. unlink() Deletes a file...

  • By
    Facebook Sliders With Mootools and CSS – Now With Image Generation!

    A few weeks back, I posted Facebook Sliders With Mootools and CSS, which explain how to create Facebook-style sliders that control the height, width, and opacity of an image: After tinkering around a bit, I modified the script to use PHP to save the resulting...

  • By
    Tips for Protecting Querystring Keys & Values in PHP

    The easiest way to pass information to a page is by placing information in the URL. This, of course, is referred to as the querystring and the information in the querystring can be accessed by using $_GET['varname']. Simple, yes. Insecure, possibly. Here...