validation regex php

Discussion in 'BlackHat Lounge' started by nonai, Apr 27, 2014.

  1. nonai

    nonai Power Member

    Joined:
    Oct 10, 2013
    Messages:
    524
    Likes Received:
    64
    my contact form is getting spammed to death. just this morning I received 100s of messages in my inbox. I dont want to use captcha. I dont have wordpress so there are no plugins that will help me.

    The one thing the spam messages have in common is that they contain a url in the phone number field. A url always has forward slashes because of the http://

    How can I disallow forward slashes so if a field has forward slashes, the form doesn't get submitted?

    People can be very unpredictable when entering their phone number so I want to allow

    numbers
    letters
    -
    dot
    (
    )
    :
    space

    why letters you ask? because some people might put "extension 123"

    how can I do that using php validation regex?

    This is something I found on another website but it's no good.
    Code:
    ^([\d\.()\:\- ]+)(ext(ension)?:\s+\d+)?$