Require user to type an specific word in form in order to get form submitted?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • matheussousuke
    New Member
    • Sep 2009
    • 249

    Require user to type an specific word in form in order to get form submitted?

    To prevent spam, I need the user text to have the <html> tag in the beginning, because the site is about blogger/myspace templates, so the system gotta recognize that there is a <html> tag somewhere in the text.

    I think it can be easily done with condition function, but I don't know how where from start.
  • Joseph Cobham
    New Member
    • Jan 2012
    • 23

    #2
    i dont realy understand your question can you expanciate on what you want...are you trying to search for the occurence of <html> in the submitted string?

    Comment

    • matheussousuke
      New Member
      • Sep 2009
      • 249

      #3
      It's like:

      1 - User is typing, then he submits the form.
      2 - On submission, user get a message saying: The content you typed is not a myspace/blogger template, please use a template.
      3 - To know if he's using a template or not, the system will see if in the submitted text there was a <html> tag, but the user doesn't know about.

      I think that's a little like that "Required field" function, but here there is no if (empty) function.

      Comment

      • Joseph Cobham
        New Member
        • Jan 2012
        • 23

        #4
        i hope this should help you

        if not let me know

        Code:
        <?php
        
        $word_a = "<html>";
        $word_b = "</html>";
        $main = $_POST['variable_name'];
        
        #the main varible will be submitted by your form. Change the variable_name for the real name of your variable on the form
        
        $errors = array();
        #this will hold any error messages if found
        
        if (strpos($main, $word_a) === false) 
        {
        $errors[] = "Our Systems Detected that this is not a valid blogger/myspace template - Missing <html> tag";
        }
        
        if (strpos($main, $word_a) !== false)
        {
        echo "Your success messages or you could leave it blank";
        }
        
        if (strpos($main, $word_b) === false)
        {
        $errors[] = "Our Systems Detected that this is not a valid blogger/myspace template - Missing </html> tag";
        }
        
        if (strpos($main, $word_b) !== false)
        {
        echo "Your success messages or you could leave it blank";
        }
         ?>
        i hope this helps...let me know if not

        Comment

        • Joseph Cobham
          New Member
          • Jan 2012
          • 23

          #5
          i hope this should help you

          if not let me know

          Code:
          <?php
          
          $word_a = "<html>";
          $word_b = "</html>";
          $main = $_POST['variable_name'];
          
          #the main varible will be submitted by your form. Change the variable_name for the real name of your variable on the form
          
          $errors = array();
          #this will hold any error messages if found
          
          if (strpos($main, $word_a) === false) 
          {
          $errors[] = "Our Systems Detected that this is not a valid blogger/myspace template - Missing <html> tag";
          }
          
          if (strpos($main, $word_a) !== false)
          {
          echo "Your success messages or you could leave it blank";
          }
          
          if (strpos($main, $word_b) === false)
          {
          $errors[] = "Our Systems Detected that this is not a valid blogger/myspace template - Missing </html> tag";
          }
          
          if (strpos($main, $word_b) !== false)
          {
          echo "Your success messages or you could leave it blank";
          }
           ?>
          i hope this helps...let me know if not

          Comment

          • matheussousuke
            New Member
            • Sep 2009
            • 249

            #6
            Woa, that's awesome, I have to finish a few coding here, after it, I'll use ur script and let u know. Thx a lot :D

            Comment

            • matheussousuke
              New Member
              • Sep 2009
              • 249

              #7
              Bebore using it, have to insert a scroll bar, but is it possible to do that as php?

              Comment

              • Joseph Cobham
                New Member
                • Jan 2012
                • 23

                #8
                to insert a scroll bar using php?...if yes i don't think that's necessary insert your scroll bar using html and css. is the code working fine?

                Comment

                • matheussousuke
                  New Member
                  • Sep 2009
                  • 249

                  #9
                  I still haven't tested it. I'm having an issue with the submitted content, it has to be inside a scroll bar after submitted, because it takes too much space.

                  Comment

                  • Joseph Cobham
                    New Member
                    • Jan 2012
                    • 23

                    #10
                    may be this may work for you

                    the html
                    Code:
                    <div class=sub_content"><?php echo $submitted_content; ?></div
                    the css
                    Code:
                    .sub_content
                    {
                    overflow: scroll;
                    max-width: specify the width you want here eg 500px;
                    max-height: specify the height you want here eg 350px;
                    }
                    that should fix it for you.

                    Comment

                    • matheussousuke
                      New Member
                      • Sep 2009
                      • 249

                      #11
                      Where u from, Joseph?

                      Comment

                      • Joseph Cobham
                        New Member
                        • Jan 2012
                        • 23

                        #12
                        am from nigeria...where are you?

                        Comment

                        • matheussousuke
                          New Member
                          • Sep 2009
                          • 249

                          #13
                          Currently Brazil.

                          I still haven't used your script because I haven't fixed the form issue, thought it was just the scroll bar, inserted it, but there is another bug now, can I pm you?

                          Comment

                          • matheussousuke
                            New Member
                            • Sep 2009
                            • 249

                            #14
                            Sorry, it's been 1 week since my last reply, I'm not being able to use ur script, it wont show the error messages.

                            Comment

                            • Joseph Cobham
                              New Member
                              • Jan 2012
                              • 23

                              #15
                              give me your full source code and how you implemented the script let me find out why there is no error message

                              Comment

                              Working...