type in your query to search makeyougohmm
Things that ... make you go hmmtechnology music video art news reviews and muse on the web

July 26, 2003

B29: Interactive blogging game: code to cleanse

default — by TDavid @ 10:10 pm PST

Here is the form cleansing code described in my last entry.  Here’s a PHP function I whipped up to scan the player name field:

function checkPlayer($in) {
  if(strlen($in) < 3) {
    errorForm(”player name must be at least 3 characters ($in)”);
  }
  if(strlen($in) > 15) {
    errorForm(’player name must be between 3 and 15 alphanumeric characters. Your submitted name is greater than 15 characters’);
  }
  if(!ereg(”^[a-zA-Z0-9]+$”, $in)) {
    // oops!
    errorForm(’player name must be between 3 and 15 alphanumeric characters. Your submitted name contained illegal characters’);
   }
}

In my next interactive blogging game entry, it is cookie and file writing time.

Did this post make you go hmm?

F = please no more posts like thisD = not among your best stuffC = average postB = good post, I liked itA = great post, please create more like this (Hmm, no ratings yet)

Loading ... Loading ...

RSS Feed comments for this post No Comments »

Your feedback is welcome below
TrackBack URI: http://www.makeyougohmm.com/20030726/104/trackback/

Leave a comment


By leaving a comment you consent to the Official Hmm Comment Policy

Return Home

Copyright 2003-2008 KMR Enterprises All Rights Reserved. Privacy Policy