Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Delphi > Form Validatioi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 1053 of 1133
Post > Topic >>

Form Validatioin

by "Brian" <not@[EMAIL PROTECTED] > Apr 23, 2006 at 01:14 AM

Hi

I have been having a lot of trouble of late with somebody trying to use my

form script to send Spam.

I have tried to lock them out but they keep changing IP address and I
can't 
so
I have removed following line to stop the emails, but I still get crap 
though

$headers .= "From:$Email <$Contact_Name>\n";

So I am now going to have to look at a better way of Form Validation

I found this script on the net to validate the email address, seem to work

fine (see below)

I now want to add two extra things

First, apart from the email address all the other fields are either
string, 
numbers or a combination,
they should never have anything else that, below is an example of what I
am 
getting through,
what's the best way to stop this?

counthry Content-Type: multipart/alternative; 
boundary=244c370b70207220fc95267404de5752 MIME-Version: 1.0 Subject: s
bcc: 
bressg6@[EMAIL PROTECTED]
 This is a multi-part message in MIME 
format. --244c370b70207220fc95267404de5752 Content-Type: text/plain; 
charset=\"us-ascii\" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit in
th 
shape iv an advance payment on th dowry. t fifteen quit stoppin runaway 
horses as on y suited to childher. fter that wint in almost entirely f r 
knockin down arnychists as they was about to shoot. 
saved --244c370b70207220fc95267404de5752-- .

Second, can anybody point me in the right direction to add one of those 
things where the user has to type in a number, but the number is shown as
a 
distorted graphic I'm guessing I need to set a cookie or something and
they 
test for it when the user types in the number. It there a graphic library
to 
do this?

Thanks

Brian



function checkaddaddress($email) {
   // First, we check that there's one @[EMAIL PROTECTED]
 symbol, and that the lengths are 
right
      if (!ereg("^[^@[EMAIL PROTECTED]
", $email)) {
        // Email invalid because wrong number of characters in one
section, 
or wrong number of @[EMAIL PROTECTED]
 symbols.
        return false;
      }
      // Split it into sections to make life easier
      $email_array = explode("@[EMAIL PROTECTED]
", $email);
      $local_array = explode(".", $email_array[0]);
      for ($i = 0; $i <sizeof($local_array); $i++) {
        if 
(!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$",

$local_array[$i])) {
          return false;
        }
      }
      if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain

is IP. If not, it should be valid domain name
        $domain_array = explode(".", $email_array[1]);
        if (sizeof($domain_array) <2) {
          return false; // Not enough parts to domain
        }
        for ($i = 0; $i <sizeof($domain_array); $i++) {
          if 
(!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", 
$domain_array[$i])) {
            return false;
          }
        }
      }
    return true;
    }
 




 2 Posts in Topic:
Form Validatioin
"Brian" <not  2006-04-23 01:14:11 
Re: Form Validatioin - Wrong Newsgroup DOH!
"Brian" <not  2006-04-23 01:20:00 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 20:00:05 CDT 2008.