gum spam detection / email validation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    gum spam detection / email validation

    detect spam in a string,
    this function will return true if spam is detected or false if there is no spam:
    PHP Code:
    function gum_spam_check($str)
    {
        
    $arr = array('.co','.net','www.','http:','wen.','mobisex','.in','.ru','.tk'); 
        foreach(
    $arr as &$value)
        {
            if(
    stristr($str$value))
            {
                return 
    true;
                break;
            }
        }
        return 
    false;

    Advertise your mobile site for FREE with AdTwirl


    #2
    I find it easier and more efficient to use akismets api

    Comment


      #3
      Originally posted by CreativityKills View Post
      I find it easier and more efficient to use akismets api
      yes you are right askimet is much better, but its not free.
      Advertise your mobile site for FREE with AdTwirl

      Comment


        #4
        gum spam detection

        @Gumslone

        Nice Coding......

        Iam going to change it to another important function.
        this function will return true if email id is valid or false if there email is invalid.

        PHP Code:
        <?php

        function email_check($email) {

        $valid = array('@','gmail.com','yahoo.com','msn.com');

        foreach(
        $valid as $var) {

        if(
        stristr($email,$var)) {

        return 
        true;
        break;

        }

        else

        return 
        false;

        }
        }
        ?>
        Last edited by CuteAmit; 26.04.11, 07:41. Reason: error

        Comment


          #5
          email validation / email check

          Originally posted by CuteAmit View Post
          @Gumslone

          Nice Coding......

          Iam going to change it to another important function.
          this function will return true if email id is valid or false if there email is invalid.

          PHP Code:
          <?php

          function email_check($email) {

          $valid = array('@','gmail.com','yahoo.com','msn.com');

          foreach(
          $valid as $var) {

          if(
          stristr($email,$var)) {

          return 
          true;
          break;

          }

          else

          return 
          false;

          }
          }
          ?>
          your function doesnt work it will return true if you check any work which contains @, also there are better ways to check if the email is valid.

          to validate email you can use something like this:
          PHP Code:
          function check_email($str)
          {
          if( 
          preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*
           \@([a-z0-9])*(\.([a-z0-9])([-a-z0-9_-])([a-z0-9])+)*$/i'
          ,$str))
          return 
          true;
          else return 
          false;

          or i found at php.net another way, which is:
          PHP Code:
          function check_email($str)
          {
          if(!
          filter_var($strFILTER_VALIDATE_EMAIL)) {
               return 
          false;
           } else {
               return 
          true;
           }


          Advertise your mobile site for FREE with AdTwirl

          Comment


            #6
            Originally posted by GumSlone View Post

            or i found at php.net another way, which is:
            PHP Code:
            function check_email($str)
            {
            if(!
            filter_var($strFILTER_VALIDATE_EMAIL)) {
                 return 
            false;
             } else {
                 return 
            true;
             }


            Nice & pretty function to validate email address.

            @GumSlone

            Can you explain how it works ??

            Comment


              #7
              last year i got some problem with lava native spam detecting function .if user input text like "some text ok.in our home or some text .come at 12pm" the function detect ".in" and ".com" as a domain and return false !
              PHP Code:
              /* I don't know everything hehe */ 
              Find me on facebook

              Comment

              Working...
              X