twigaG

No Profile Photo

Real Name:

(United Kingdom)

Latest Contributions

  • Regexp not quite as expected (regular expressions)

    Hello, I've got some user input going into file.php?l=

    I only want to allow A-Za-z0-9 spaces, commas, and curved brackets,
    and if anything else is there, give an error.

    At the moment it does stop $ or ^ or & ...
    but not *,
    also it doesn't stop r% or "asa or a£a
    which I would like it to.

    Any help would be greatly appreciated, thanks.

    $expr = '/^[^A-Za-z0-9()-, ]+$/';
    $p = preg_match($expr,stripslashes(urldecode($_GET['l'])));
    if($p==0) {
    //all is fine, go ahead
    }
    else {
    //error, get out of there
    }

  • Efficient Array Matching

    Hello.
    I currently have an array of ~2500 items, each one of length about 10characters, just A-Za-z0-9, no extra characters.

    Here's the pseudo-code of what I want:

    CODE
    if($inputstring matches any item in array)
        { redirect to "/path-to/$inputstring" }
       else
         { redirect to "/different-path-to/$inputstring" }

  • More Htaccess

    Okay, now I have another question.
    I've added the code:

    QUOTE
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^/]+)/intelligence/web/hex-to-rgb/([^/]+)\/$ intelligence/web/customhextorgb.php?site=$1&value=$2

    to the .htaccess file, but it isn't quite working as I would expect

  • Another Htaccess Question

    I have now solved the problem, so I'll quickly explain the problem and solution

    The mission:
    Trying to make
    http://domain.ext/alpha/intelligence/world/capital/rwanda
    actually display the file stored at:

  • T-shirt Design At Threadless

    I've submitted a design for critique at threadless,
    http://www.threadless.com/critique/7942/Wa...lors_Separately
    and would love to know what you think.

    You can leave your messages there, or here if you don't have an account.

    Cheers.