Random Post: Gotta Love GoDaddy.com
RSS .92| RSS 2.0| ATOM 0.3
  • Home
  • About Me
  •  

    Getting Old…

    May 31st, 2008

    Genetics works in weird ways… I take after my mom’s side the most physically, but hair wise, I’m on my dad’s side of the gene pool.

    I used to have a full head of hair when I was younger…

    But genetics started taking over and as the top of my head thinned, I started cutting my hair shorter to make it look less obvious…

    Finally, I just got tired of trying to make it “look fuller” up top… So…

    I shaved my head today for the first time in my life…  It took a few minutes to get the nerve up, but I finally told iDudette to take the buzzer and take it all off… Still planning on shaving it clean, but the above is about an hour after I buzzed it close.


    Microwaving a Cellphone (Do not try!)

    May 27th, 2008

    Saw this over on Gizmodo and thought I’d pass it along.  Good stuff.

    YouTube Preview Image

    Utilizing Akismet Spam Blocker in a PHP Contact Form

    May 14th, 2008

    I have a contact form on my company’s website that I have had serious problems with in the past… The past being before I implemented Akismet into the code.

    Akismet is a service provided by Automattic (the creators of Wordpress) and is an excellent API based spam blocking system. I’ve been using it for quite a while on my blog and rogue spams hardly EVER make it into my comments. Probably somewhere in the neighborhood of only 1-2 out of thousands make it through.

    I will post both the basic code for a contact form as well as the Akismet PHP5 Class (from Alex) and the include file I created to utilize the PHP5 Class.

    Here is the basic form (named contact.php), with the PHP code on top, that I use.

    <?php
    if ($_SERVER["REQUEST_METHOD"] == “POST”)
    {
    include ‘akismet.php’;

    $to = “YOUR EMAIL ADDRESS“;
    $subject = $_REQUEST["Subject"];
    $message = $_REQUEST["Message"].”<BR><BR>”.$_REQUEST["Phone"].”<BR>”.$_REQUEST["URL"];
    $from = $_REQUEST["Email"];

    $headers = ‘From:’.$from.”\r\n” .
    ‘X-Mailer: PHP/’ . phpversion() .”\r\n”.
    ‘Content-type: text/html’.”\r\n”.
    ‘Date: ‘.date(”r”).”\r\n”;

    mail($to, $subject, $message, $headers);

    echo “Message Sent!”;
    die();
    }
    ?>
    <html>
    <head>
    <title>My Contact Form</title>
    </head>
    <body>

    <form action=”contact.php” method=”POST”>
    <table align=”left”>
    <tr>
    <td align=”right”>Your name:</td>
    <td><input name=”Name” type=”text”></td>
    </tr>
    <tr>
    <td align=”right”>Website:</td>
    <td><input name=”URL” type=”text”></td>
    </tr>
    <tr>
    <td align=”right”>Your email:</td>
    <td><input name=”Email” type=”text”></td>
    </tr>
    <tr>
    <td align=”right”>Subject:</td>
    <td><input name=”Subject” type=”text”></td>
    </tr>
    <tr>
    <td align=”right”>Message:</td>
    <td><textarea name=”Message” style=”width: 224px; height: 83px”></textarea></td>
    </tr>
    <tr>
    <td align=”right”>Your phone:</td>
    <td><input name=”Phone” type=”text”>(Optional)</td>
    </tr>

    <tr>
    <td> </td>
    <td><input name=”Submit” type=”submit” value=”submit”></td>
    </tr>
    </table>
    </form>

    </body>
    </html>

    contact.php includes the code I created to use the Akismet PHP5 Class mentioned earlier.

    Here is the code for the akismet.php. Be sure to change the $WebsiteURL variable to your website address and $APIKey variable to the API key you already have. If you do not have one, signup for a Wordpress.com account and you can get one free.

    <?php
    //Akisment PHP5 Class from Alex (http://www.achingbrain.net/stuff/php/akismet)
    include ‘Akismet.class.php’;

    //ENTER YOUR API KEY ON THE LINE BELOW!
    $APIKey = ‘YOUR_API_KEY‘;

    //Enter your web site address below. This is used as a parameter in the API call to Akismet…
    $WebsiteURL = ‘YOUR_WEBSITE_ADDRESS‘;

    //Call to check for valid API Key…
    $akismet = new Akismet($WebsiteURL, $APIKey);

    //Check to see if your API key is valid, if not, it will tell you so and stop.

    if($akismet->isKeyValid()) {}else{echo “Your API key is NOT valid!”;die();}

    if ($_SERVER["REQUEST_METHOD"] == “POST”) {

    //CHANGE the $_REQUEST items to match your form field input element names

    $akismet = new Akismet($WebsiteURL, $APIKey); //
    $akismet->setCommentAuthor($_REQUEST["Name"]);
    $akismet->setCommentAuthorEmail($_REQUEST["Email"]);
    $akismet->setCommentAuthorURL($_REQUEST["URL"]);
    $akismet->setCommentContent($_REQUEST["Message"]);
    $akismet->setPermalink($_SERVER["HTTP_REFERER"]);

    //IF THE MESSAGE IS FOUND TO BE SPAM, A MESSAGE WILL BE DISPLAYED. Customize as needed.

    if($akismet->isCommentSpam()) {
    echo “For some reason, your message was flagged as a possible SPAM message.”;
    die();
    }
    //IF THE MESSAGE MAKES IT TO THIS POINT, IT IS VALID AND THE SCRIPT THAT CALLED THIS
    //FILE WILL CONTINUE PROCESSING THE INPUT ACCORDINGLY…

    }
    ?>

    Click here to download a ZIP of the three files used in this example.

    If you have any questions, leave a comment here and I’ll do my best to answer in a timely manner…


    Microsoft Surface Parody

    May 5th, 2008

    The new Microsoft Surface technology looks pretty slick, albeit a bit expensive.  Perhaps someday, after I make a bunch of $$ on my Apple Stock (AAPL), I’ll be able to afford one. :-)

    Check out this video below with a “new” voiceover.  Funny Stuff…

    YouTube Preview Image