Captcha form validation ?

Hi -
Is there any plans to make the Captcha image form validator available for asp vbscript users as well?
Bjørn-T

Captcha is good until they hack around it.  I had a form with Capthca  that was being spam every other day.  I came up with an additional steps in the form processing code to check for spam if they get pass Captcha.
1. Most spam has a link in the content.  I coded a loop that checks each form field that checks for the string url.
foreach (string name in Request.Form.AllKeys)
                if (name != "submit")
                    value = Request.Form[name];
                    checkvalue(value);
    public void checkvalue(string somevalue)
                if (somevalue.IndexOf("[url=") != -1)
                    Response.Redirect("home.htm");
2. To catch spam without the string url.  Most spam bots are dumb and they will place a value in every text in a form. So, I place a hidden field in the form that is blank.  In the form processing code, I check to see if that hidden field is still blank. If the hidden field has a value, I redirect the bot.
            string hiddentext= Request.Form["hiddentext"];
            if (hiddentext.Length > 1)
                Response.Redirect("index.html");   //Wonder if I could redirect the bot to the FBI or cybercrime office
Results:
   This web site does not have anymore spam.  This works great until the hackers figure it out.  The example code is written in C#, but can easy rewritten in PHP or Classis ASP.
Note: the loop can be use to check for the bots that are trying to hack SQL databases by looking for the common SQL injections attacks strings like 'SET%20'.
David Pearson
www.saludalabs.com
www.workhorsecreative.net

Similar Messages

  • Tabular Form Validation not working in tabular form APEX 4.0

    Hi,
    I am using APEX 4.0. I have a tabular form with Tabular form validation done with it.
    Item not null is the validation.. so if I dont type any value in the any of the fields in the tabular form and press the Submit button, the first time error is shown... but when I click the Submit button again, with still the empty rows the page is submitted.
    How to resolve this issue?
    Edited by: Suzi on Oct 5, 2010 11:13 AM

    Look at this thread - Re: Validations of tabular forms in 4.0

  • Is there a way to bypass the form Validation

    I'm getting really upset with the Coldfusion built-in form validation for any HTML formfield ending by _date , _required, _time and so on...
    My application proposes to the users to create some Properties for an object and later on to modify the values for all these properties.
    I've got a piece of code building dynamically some form fields named just like the properties (by a simple cfloop on a DB query getting the property list).
    And a registering page to records the new value in the DB.
    But it crashes onto the classical "
    Form entries are incomplete or invalid.
    I can't control what the users set as property name (one of them was Checklist_required).
    Is there any way to prevent this error by disabling this auto validation ?
    (I'd like to avoid having to rename any field dynamically created and rename any forms variables before registering them on the DB : it's just NO WAY for me to rename the properties created by the users)

    Fober1, that's not how it works.  It's pretty much the ultimate example of the disjoint between how HTML forms work and how the naive CFML Cfform / cfinput design wished they work.
    When a request is being processed by the coldfusion server, it just looks at the list of FORM (POST) variable names (whether it came from cfform or not; URL/GET params are exempt), and for those with certain suffixes (_date, _required, etc.), and it assumes their existence is intended to request validation another field without that suffix.  It doesn't actually know or care whether form submission, nor the HTML rendered in the user's browser, actually came from "cfform" or "cfinput".   The composition of the request that comes in (when a user clicks on "submit", or a hacker uses any tool imaginable) is out of the server's hands.  The cfform code is not used during form submission processing, because the receiving template (the form action="this_one.cfm") doesn't even have to be the same template that has the cfform in it. There could be multiple conflicting cfforms directing users to request the same template on a single site, with or without the validation, even without considering what a whole other person might decide to send to your server.
    The fact that it can work as intended for a typical user is irrelevant, because the purpose of validation is to deal with the atypical situation.  A malicious or merely mischievous user that wanted to circumvent the validation would simply modify a copy of the page to leave out the "validation request" fields.    For the developer to truly validate the input, additional code must be written, making the feature not only inadequate, but a complete waste of time.  There absolutely should be a way to disable it at worst; Ideally, it would be taken out of coldfusion completely.  It's not only useless, it's a security risk, wooing programmers to write code that doesn't do what they think it does.
    The error message it gives isn't so great, either, and it's a pity that it can't show more than one validation message at a time, either.  If more than one input is invalid, you could end up going through one round after another of submit + back button.
    edit: I forgot to add the other important reason that this feature should never have existed: It is a nuisance to everyone else who doesn't want to use it at all, too!  Those suffixes simply couldn't have been a worse choice, colliding with probably thousands of peoples' variable names.  Why not "*_cfval_date" "*_cfval_time" etc?

  • Form validation working on one page, but not the other....

    Hope someone can help with this.
    I have a page below with a load of contact forms which all work fine :
    http://www.goodsafariguide.com/judges/judges.php
    I've trued to recreate (admittedly mostly by saving as....) the same functionality here :
    http://www.goodsafariguide.com/awardssite/judges/
    They do work when fulled in correctly, but there's a glitch with the validation.
    Basically when you fill in a form incorrectly, the page reloads, with the form's accordion closed. When you open it up, its showing the ugly looking error at the top of the form.
    Any ideas what's causing it to act like this, as opposed to the way it works in the first link?
    Thanks.

    Iain71 wrote:
    I've trued to recreate (admittedly mostly by saving as....) the same functionality here :
    http://www.goodsafariguide.com/awardssite/judges/
    They do work when fulled in correctly, but there's a glitch with the validation.
    When looking at the source code I note that - unlike the first page - this one doesn´t contain any references to the ADDT form validation libraries ("../includes/tng/scripts/FormValidation.js" and "../includes/tng/scripts/FormValidation.js.php"), meaning that the validation can´t work.
    Cheers,
    Günter

  • What is your strategy for form validation when using MVC pattern?

    This is more of a general discussion topic and will not necessarily have a correct answer. I'm using some of the Flex validator components in order to do form validation, but it seems I'm always coming back to the same issue, which is that in the world of Flex, validation needs to be put in the view components since in order to show error messages you need to set the source property of the validator to an instance of a view component. This again in my case seems to lead to me duplicating the code for setting up my Validators into several views. But, in terms of the MVC pattern, I always thought that data validation should happen in the model, since whether or not a piece of data is valid might be depending on business rules, which again should be stored in the model. Also, this way you'd only need to write the validation rules once for all fields that contain the same type of information in your application.
    So my question is, what strategies do you use when validating data and using an MVC framework? Do you create all the validators in the views and just duplicate the validator if the exact same rules are needed in some other view, or do you store the validators in the model and somehow reference them from the views, changing the source properties as needed? Or do you use some completely different strategy for validating forms and showing error messages to the user?

    Thanks for your answer, JoshBeall. Just to clarify, you would basically create a subclass of e.g. TextInput and add the validation rules to that? Then you'd use your subclass when you need a textinput with validation?
    Anyway, I ended up building sort of my own validation framework. Because the other issue I had with the standard validation was that it relies on inheritance instead of composition. Say I needed a TextInput to both check that it doesn't contain an empty string or just space characters, is between 4 and 100 characters long, and follows a certain pattern (e.g. allows only alphanumerical characters). With the Flex built in validators I would have to create a subclass or my own validator in order to meet all the requirements and if at some point I need another configuration (say just a length and pattern restriction) I would have to create another subclass which duplicates most of the rules, or I would have to build a lot of flags and conditional statements into that one subclass. With the framework I created I can just string together different rules using composition, and the filter classes themselves can be kept very simple since they only need to handle a single condition (check the string length for instance). E.g. below is the rule for my username:
    library["user_name"] = new EmptyStringFilter( new StringLengthFilter(4,255, new RegExpFilter(/^[a-z0-9\-@\._]+$/i) ) );
    <code>library</code> is a Dictionary that contains all my validation rules, and which resides in the model in a ValidationManager class. The framework calls a method <code>validate</code> on the stored filter references which goes through all the filters, the first filter to fail returns an error message and the validation fails:
    (library["user_name"] as IValidationFilter).validate("testuser");
    I only need to setup the rule once for each property I want to validate, regardless where in the app the validation needs to happen. The biggest plus of course that I can be sure the same rules are applied every time I need to validate e.g. a username.
    The second part of the framework basically relies on Chris Callendar's great ErrorTipManager class and a custom subclass of spark.components.Panel (in my case it seemed like the reasonable place to put the code needed, although perhaps extending Form would be even better). ErrorTipManager allows you to force open a error tooltip on a target component easily. The subclass I've created basically allows me to just extend the class whenever I need a form and pass in an array of inputs that I want to validate in the creationComplete handler:
    validatableInputs = [{source:productName, validateAs:"product_name"},
                         {source:unitWeight, validateAs:"unit_weight", dataField:"value"},
                   {source:unitsPerBox, validateAs:"units_per_box", dataField:"value"},
                        {source:producer, validateAs:"producer"}];
    The final step is to add a focusOut handler on the inputs that I want to validate if I want the validation to happen right away. The handler just calls a validateForm method, which in turn iterates through each of the inputs in the validatableInputs array, passing a reference of the input to a suitable validation rule in the model (a reference to the model has been injected into the view for this).
    Having written this down I could probably improve the View side of things a bit, remove the dependency on the Panel component and make the API easier (have the framework wire up more of the boilerplate like adding listeners etc). But for now the code does what it needs to.

  • Script for Form validator in head causes error

    When I use the Window/Behaveiors/ to create a form validator, Dreamweaver CS5 puts script in the Head of page, and seems to work ok. But when I validate page with W3c it says there are errors with code and as Dreamweaver created this I have no idea what to do to put right, so could someone please help. This is code generated by Dreamweaver, all other pages have past with flying colors!
    <script type="text/javascript">
    function MM_validateForm() { //v4.0
      if (document.getElementById){
        var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
        for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
          if (val) { nm=val.name; if ((val=val.value)!="") {
            if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
              if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
            } else if (test!='R') { num = parseFloat(val);
              if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
              if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
                min=test.substring(8,p); max=test.substring(p+1);
                if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
          } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
        } if (errors) alert('The following error(s) occurred:\n'+errors);
        document.MM_returnValue = (errors == '');
    </script>

    If the script is working fine in all browsers, you could put it in an external JS file and link to it, then the W3C validator won't find an error.
    If you don't know already, learn about how to do this:
    http://www.hypergurl.com/jsfiles.html

  • Submit by email not working as form validation failed.

    Ive created a form with mulitple pages. Three pages require form validation.
    Each page is a unique process so I'm trying to use the "Submit button" to only submit that
    particular page. I've created dummy fields as defaults to cure the validation problem but
    can't seem to get the e-mail button to work. I also created a email dummy button with the
    scripting:
    EmailSubmitButton.execEvent("click");
    I did this to try to force the the form to be sumitted via PDF. I am a novice at this so please
    help. I'd be happy to send the form as well for review

    You may need to enable usage rights in your form. You must have version 8 to do this. Open the form in Acrobat Pro (not Livecycle), click on Advanced tab, then select "enable usage rights in Adobe Reader"

  • Form Validations

    How to perform form validations in ADF. And also can i customize the behaviour of "Required" property of a UIComponent? I dont want alert boxes to be shown Can i change that?

    you might want to think about using one of the popup LOV item types for your employee ID field. popup LOVs are great for cases where you don't want to weigh your page down w/large lists of values. about your validation, if you really want to do it client-side, then javascript's probably the way to go (search google for code). if you do that, though, let the record show that you'd have to fetch your valid values down to your page for your comparison logic, anyhow. i'd consider using a regular htmldb validation for your emp id field. you seemed concerned in your post with the page submission. i'm assuming that's because you didn't want processing to occur unless the validation passes. if that's the case, fear not, it's a simple matter to set your processing to occur only after your validations have passed. check out the available "Process Point"s and "Computation Point"s for htmldb Processes and Computations to see what i mean.
    hope this helps,
    raj

  • PHP Form Validation and Radio Group

    Hi David,
    I'm trying to set the initial state of a radio group to none.
    Please look at the file http://ecopethandbags.com/contact.php. The initial state is set to "No"
    In Dreamweaver, I've set the initial state to "Unchecked"
    I don't understand the code for the radio buttons in my file (see attachment).
    What I am trying to do is to have the radio group initially unchecked but required.
    I have 2 questions:
    1) - How can I control the initial status of the radio group when I use the PHP form validation?
    2) - How can I set the validation so, when one of the radio buttons is not checked by the user, a warning flag like "Please make a choice" comes up.
    Thank you much!

    Just change the following section of code:
    <?php
    if (!$_POST || isset($missing) && $_POST['subscribe'] == 'n') {
      echo 'checked="checked"';
    } ?>
    Remove the !$_POST || like this:
    <?php
    if (isset($missing) && $_POST['subscribe'] == 'n') {
      echo 'checked="checked"';
    } ?>
    The checked="checked" will be inserted into the code only if the form has been submitted, but neither radio button has been selected.

  • David Powers --- Regarding form validation with dreamweaver behaviors

    I am in the chapter teaching about form validation with the Zend Framework. I have done the entire lesson with the lesson files and everything works perfectly...
    but I went back to use the form valdation techniques for my own site and it is not working properly. In the book, Chapter 6 teaches how to create a user login and editing the database through the site. But in chapter seven the form validation does not build on top of this and therefore does not teach how to integrate the form validation with the registered user already set up.
    I have user registration completly working on my site and everything runs fine. I am trying to add the form validation but it is all completly ignored. When I leave a field blank it simply takes me to another blank page that reads "Column 'first_name' cannot be null"
    here is index.php code...
    <?php require_once('Connections/CSSU_Write.php'); ?>
    <?php require_once('Connections/CSSU_Read.php'); ?>
    <?php require_once('script/user_registration.php');
    ?>
    <?php
    if (isset($_POST['password'])) {
              $_POST['password'] = sha1($_POST['password']);
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO sign_up (first_name, family_name, user_email, password, gender, bday_month, bday_day, bday_year) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['first_name'], "text"),
                           GetSQLValueString($_POST['last_name'], "text"),
                           GetSQLValueString($_POST['email'], "text"),
                           GetSQLValueString($_POST['password'], "text"),
                           GetSQLValueString($_POST['gender'], "text"),
                           GetSQLValueString($_POST['bday_month'], "text"),
                           GetSQLValueString($_POST['bday_day'], "text"),
                           GetSQLValueString($_POST['bday_year'], "text"));
      mysql_select_db($database_CSSU_Write, $CSSU_Write);
      $Result1 = mysql_query($insertSQL, $CSSU_Write) or die(mysql_error());
      $insertGoTo = "login.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    ?>
    <?php
    // *** Validate request to login to this site.
    if (!isset($_SESSION)) {
      session_start();
    $loginFormAction = $_SERVER['PHP_SELF'];
    if (isset($_GET['accesscheck'])) {
      $_SESSION['PrevUrl'] = $_GET['accesscheck'];
    if (isset($_POST['email'])) {
      $loginUsername=$_POST['email'];
      $password=$_POST['password'];
      $MM_fldUserAuthorization = "";
      $MM_redirectLoginSuccess = "logoOutRedirect.php";
      $MM_redirectLoginFailed = "logoOutRedirect.php";
      $MM_redirecttoReferrer = false;
      mysql_select_db($database_CSSU_Write, $CSSU_Write);
      $LoginRS__query=sprintf("SELECT user_email, password FROM sign_up WHERE user_email=%s AND password=%s",
        GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
      $LoginRS = mysql_query($LoginRS__query, $CSSU_Write) or die(mysql_error());
      $loginFoundUser = mysql_num_rows($LoginRS);
      if ($loginFoundUser) {
         $loginStrGroup = "";
              if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
        //declare two session variables and assign them
        $_SESSION['MM_Username'] = $loginUsername;
        $_SESSION['MM_UserGroup'] = $loginStrGroup;               
        if (isset($_SESSION['PrevUrl']) && false) {
          $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
        header("Location: " . $MM_redirectLoginSuccess );
      else {
        header("Location: ". $MM_redirectLoginFailed );
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>CSSU</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div class="container">
      <div class="header">
      <div class="logo">
                <a href="index.php">
                  <h1/>
            .CSSU { UNIVERSITY; }
            </h1>
            <h2>
            <code><<code>!</code>-- Learn/Apply/Master --></code>
            </h2>
        </a>
      </div> 
        <!-- end .header --></div>
        <div class="headerBar">
        <div id="nav">
                  <ul id="links">
                      <a href="#"><li>CSSU</li></a>
                      <a href="#"><li>Classes</li></a>
                      <a href="#"><li>Pricing</li></a>
                      <a href="#"><li>Degree</li></a>
                  </ul>
        </div>
        <form name="form2" method="POST" action="<?php echo $loginFormAction; ?>" class="form2">
        <p>
            <label for="email" id="email" class="loginLabel">Email:</label>
            <input type="email" name="email" class="loginField" />
            <label for="password" id="password" class="loginLabel">Password:</label>
            <input type="password" name="password" class="loginField" />
                  <input type="submit" value="Log In" name="submit" class="submit login" />
        </p>
        </form>
        </div>
      <div class="container2">
      <div class="sidebar1">
        <h1>Sign Up</h1>
        <h2>Earn an Official CSS Masters Certification!</h2>
        <table>
        <form name="form1" method="POST" action="<?php echo $editFormAction; ?>" class="form1">
        <tr >
            <td class="formLabel"><label for="firstName" id="firstNameLabel" >First Name:</label>
                      <span>
                         <?php
                                  if ($_POST && isset($errors['first_name'])) {
                                            echo $errors['first_name'];
                                  ?>
                </span>
            </td>
            <td><input type="text" name="first_name" class="inputField" id="firstName" /></td>
        </tr>
        <tr>
            <td class="formLabel"><label for="lastName" id="lastName" >Last Name:</label></td>
            <td><input type="text" name="last_name" class="inputField" /></td>
        </tr>
        <tr>
            <td class="formLabel"><label for="yourEmail" id="yourEmail" >Your Email:</label></td>
            <td><input type="user_email" name="email" class="inputField" /></td>
        </tr>
        <tr>
            <td class="formLabel"><label for="yourEmail2" id="yourEmail2">Re-enter Email:</label></td>
            <td><input type="email" name="reEnter_email" class="inputField" /></td>
        </tr>
        <tr>
            <td class="formLabel"><label for="password" id="password">New Password:</label></td>
            <td><input type="password" name="password" class="inputField" /></td>
        </tr>   
        <tr>
            <td class="formLabel"><label for="gender" id="gender" class="formLabel">I am:</label></td>
          <td><select name="gender" class="selectMenu selectMenu1 gender">
              <option value="select">Select Sex:</option>
              <option value="male" name="male">Male</option>
              <option value="female" name="female">Female</option>
                        </select>
          </td>
              </tr>
               <tr>
            <td class="formLabel"><label for="bday">Birthday:</label></td>
               <td>
            <select name="bday_month" class="selectMenu selectMenu1 bday">
              <option value="male">Month:</option>
              <option value="January">January</option>
            </select>
    <select name="bday_day" class="selectMenu bday">
              <option value="Day">Day:</option>
              <option value="1">1</option>
                        </select>
    <select name="bday_year" class="selectMenu bday">
              <option value="Year">Year:</option>
            </select>
         </td>
        </tr>
        <tr>
                  <td class="submitTd" colspan="2"><input type="submit" value="Sign Up" name="submit" class="submit signup" /><td>
        </tr>
        <input type="hidden" name="MM_insert" value="form1" />
        </form>
        </table>
        <!-- end .sidebar1 --></div>
      <div class="content">
        <h1>CSSU</h1>
        <!-- end .content --></div>
      <div class="footer">
        <!-- end .footer --></div>
        </div> <!-- end container2 -->
      <!-- end .container --></div>
    </body>
    </html>
    And here is user_registration.php code just for the first_name field...
    <?php
    $errors = array();
    if ($_POST) {
      // run the validation script
      require_once('library.php');
      try {
              // main script goes here
              $val = new Zend_Validate_Regex('/^[a-z]+[-\'a-z ]+$/i');
              if (!$val->isValid($_POST['first_name'])) {
                $errors['first_name'] = 'Required field, no numbers';
      } catch (Exception $e) {
              echo $e->getMessage();
    And from here, here is the library.php code....
    <?php
    $library = '.../html/zend/library';
    set_include_path(get_include_path() . PATH_SEPARATOR . $library);
    require_once('Zend/Loader/Autoloader.php');
    try {
    Zend_Loader_Autoloader::getInstance();
      $write = array('host'     => 'hostname',
                                             'username' => 'cssu',
                                             'password' => 'password',
                                             'dbname'   => 'cssu');
      $read  = array('host'     => 'hostname',
                                             'username' => 'cssu',
                                             'password' => 'password',
                                             'dbname'   => 'cssu');
      // Comment out the next two lines if using mysqli
      // and remove the comments from the last two lines
      $dbWrite = new Zend_Db_Adapter_Pdo_Mysql($write);
      $dbRead = new Zend_Db_Adapter_Pdo_Mysql($read);
      //$dbWrite = new Zend_Db_Adapter_Mysqli($write);
      //$dbRead = new Zend_Db_Adapter_Mysqli($read);
    } catch (Exception $e) {
              echo $e->getMessage();
    I replaced some code here to protect myself, but the library.php file is completely functional and has been tested... I am sure the problem ins't in here.
    Please let me know if you need any further code to help you out. I am brand new to PHP and so far everything has ran smoothly up til now. I have my Zend Framework uploaded to my server and tested that my site is connecting to it properly. Any help on this would be so so awesome! This is for a school project and I can't move on until this is resolved! Thank you so much for trying!
    You can also view the issue at my website... all the files have been uploaded to the server. www.CSSU.com

    I am in the chapter teaching about form validation with the Zend Framework. I have done the entire lesson with the lesson files and everything works perfectly...
    but I went back to use the form valdation techniques for my own site and it is not working properly. In the book, Chapter 6 teaches how to create a user login and editing the database through the site. But in chapter seven the form validation does not build on top of this and therefore does not teach how to integrate the form validation with the registered user already set up.
    I have user registration completly working on my site and everything runs fine. I am trying to add the form validation but it is all completly ignored. When I leave a field blank it simply takes me to another blank page that reads "Column 'first_name' cannot be null"
    here is index.php code...
    <?php require_once('Connections/CSSU_Write.php'); ?>
    <?php require_once('Connections/CSSU_Read.php'); ?>
    <?php require_once('script/user_registration.php');
    ?>
    <?php
    if (isset($_POST['password'])) {
              $_POST['password'] = sha1($_POST['password']);
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO sign_up (first_name, family_name, user_email, password, gender, bday_month, bday_day, bday_year) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['first_name'], "text"),
                           GetSQLValueString($_POST['last_name'], "text"),
                           GetSQLValueString($_POST['email'], "text"),
                           GetSQLValueString($_POST['password'], "text"),
                           GetSQLValueString($_POST['gender'], "text"),
                           GetSQLValueString($_POST['bday_month'], "text"),
                           GetSQLValueString($_POST['bday_day'], "text"),
                           GetSQLValueString($_POST['bday_year'], "text"));
      mysql_select_db($database_CSSU_Write, $CSSU_Write);
      $Result1 = mysql_query($insertSQL, $CSSU_Write) or die(mysql_error());
      $insertGoTo = "login.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    ?>
    <?php
    // *** Validate request to login to this site.
    if (!isset($_SESSION)) {
      session_start();
    $loginFormAction = $_SERVER['PHP_SELF'];
    if (isset($_GET['accesscheck'])) {
      $_SESSION['PrevUrl'] = $_GET['accesscheck'];
    if (isset($_POST['email'])) {
      $loginUsername=$_POST['email'];
      $password=$_POST['password'];
      $MM_fldUserAuthorization = "";
      $MM_redirectLoginSuccess = "logoOutRedirect.php";
      $MM_redirectLoginFailed = "logoOutRedirect.php";
      $MM_redirecttoReferrer = false;
      mysql_select_db($database_CSSU_Write, $CSSU_Write);
      $LoginRS__query=sprintf("SELECT user_email, password FROM sign_up WHERE user_email=%s AND password=%s",
        GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
      $LoginRS = mysql_query($LoginRS__query, $CSSU_Write) or die(mysql_error());
      $loginFoundUser = mysql_num_rows($LoginRS);
      if ($loginFoundUser) {
         $loginStrGroup = "";
              if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
        //declare two session variables and assign them
        $_SESSION['MM_Username'] = $loginUsername;
        $_SESSION['MM_UserGroup'] = $loginStrGroup;               
        if (isset($_SESSION['PrevUrl']) && false) {
          $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
        header("Location: " . $MM_redirectLoginSuccess );
      else {
        header("Location: ". $MM_redirectLoginFailed );
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>CSSU</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div class="container">
      <div class="header">
      <div class="logo">
                <a href="index.php">
                  <h1/>
            .CSSU { UNIVERSITY; }
            </h1>
            <h2>
            <code><<code>!</code>-- Learn/Apply/Master --></code>
            </h2>
        </a>
      </div> 
        <!-- end .header --></div>
        <div class="headerBar">
        <div id="nav">
                  <ul id="links">
                      <a href="#"><li>CSSU</li></a>
                      <a href="#"><li>Classes</li></a>
                      <a href="#"><li>Pricing</li></a>
                      <a href="#"><li>Degree</li></a>
                  </ul>
        </div>
        <form name="form2" method="POST" action="<?php echo $loginFormAction; ?>" class="form2">
        <p>
            <label for="email" id="email" class="loginLabel">Email:</label>
            <input type="email" name="email" class="loginField" />
            <label for="password" id="password" class="loginLabel">Password:</label>
            <input type="password" name="password" class="loginField" />
                  <input type="submit" value="Log In" name="submit" class="submit login" />
        </p>
        </form>
        </div>
      <div class="container2">
      <div class="sidebar1">
        <h1>Sign Up</h1>
        <h2>Earn an Official CSS Masters Certification!</h2>
        <table>
        <form name="form1" method="POST" action="<?php echo $editFormAction; ?>" class="form1">
        <tr >
            <td class="formLabel"><label for="firstName" id="firstNameLabel" >First Name:</label>
                      <span>
                         <?php
                                  if ($_POST && isset($errors['first_name'])) {
                                            echo $errors['first_name'];
                                  ?>
                </span>
            </td>
            <td><input type="text" name="first_name" class="inputField" id="firstName" /></td>
        </tr>
        <tr>
            <td class="formLabel"><label for="lastName" id="lastName" >Last Name:</label></td>
            <td><input type="text" name="last_name" class="inputField" /></td>
        </tr>
        <tr>
            <td class="formLabel"><label for="yourEmail" id="yourEmail" >Your Email:</label></td>
            <td><input type="user_email" name="email" class="inputField" /></td>
        </tr>
        <tr>
            <td class="formLabel"><label for="yourEmail2" id="yourEmail2">Re-enter Email:</label></td>
            <td><input type="email" name="reEnter_email" class="inputField" /></td>
        </tr>
        <tr>
            <td class="formLabel"><label for="password" id="password">New Password:</label></td>
            <td><input type="password" name="password" class="inputField" /></td>
        </tr>   
        <tr>
            <td class="formLabel"><label for="gender" id="gender" class="formLabel">I am:</label></td>
          <td><select name="gender" class="selectMenu selectMenu1 gender">
              <option value="select">Select Sex:</option>
              <option value="male" name="male">Male</option>
              <option value="female" name="female">Female</option>
                        </select>
          </td>
              </tr>
               <tr>
            <td class="formLabel"><label for="bday">Birthday:</label></td>
               <td>
            <select name="bday_month" class="selectMenu selectMenu1 bday">
              <option value="male">Month:</option>
              <option value="January">January</option>
            </select>
    <select name="bday_day" class="selectMenu bday">
              <option value="Day">Day:</option>
              <option value="1">1</option>
                        </select>
    <select name="bday_year" class="selectMenu bday">
              <option value="Year">Year:</option>
            </select>
         </td>
        </tr>
        <tr>
                  <td class="submitTd" colspan="2"><input type="submit" value="Sign Up" name="submit" class="submit signup" /><td>
        </tr>
        <input type="hidden" name="MM_insert" value="form1" />
        </form>
        </table>
        <!-- end .sidebar1 --></div>
      <div class="content">
        <h1>CSSU</h1>
        <!-- end .content --></div>
      <div class="footer">
        <!-- end .footer --></div>
        </div> <!-- end container2 -->
      <!-- end .container --></div>
    </body>
    </html>
    And here is user_registration.php code just for the first_name field...
    <?php
    $errors = array();
    if ($_POST) {
      // run the validation script
      require_once('library.php');
      try {
              // main script goes here
              $val = new Zend_Validate_Regex('/^[a-z]+[-\'a-z ]+$/i');
              if (!$val->isValid($_POST['first_name'])) {
                $errors['first_name'] = 'Required field, no numbers';
      } catch (Exception $e) {
              echo $e->getMessage();
    And from here, here is the library.php code....
    <?php
    $library = '.../html/zend/library';
    set_include_path(get_include_path() . PATH_SEPARATOR . $library);
    require_once('Zend/Loader/Autoloader.php');
    try {
    Zend_Loader_Autoloader::getInstance();
      $write = array('host'     => 'hostname',
                                             'username' => 'cssu',
                                             'password' => 'password',
                                             'dbname'   => 'cssu');
      $read  = array('host'     => 'hostname',
                                             'username' => 'cssu',
                                             'password' => 'password',
                                             'dbname'   => 'cssu');
      // Comment out the next two lines if using mysqli
      // and remove the comments from the last two lines
      $dbWrite = new Zend_Db_Adapter_Pdo_Mysql($write);
      $dbRead = new Zend_Db_Adapter_Pdo_Mysql($read);
      //$dbWrite = new Zend_Db_Adapter_Mysqli($write);
      //$dbRead = new Zend_Db_Adapter_Mysqli($read);
    } catch (Exception $e) {
              echo $e->getMessage();
    I replaced some code here to protect myself, but the library.php file is completely functional and has been tested... I am sure the problem ins't in here.
    Please let me know if you need any further code to help you out. I am brand new to PHP and so far everything has ran smoothly up til now. I have my Zend Framework uploaded to my server and tested that my site is connecting to it properly. Any help on this would be so so awesome! This is for a school project and I can't move on until this is resolved! Thank you so much for trying!
    You can also view the issue at my website... all the files have been uploaded to the server. www.CSSU.com

  • Reusable form validation

    Hi all,
    Whenever I work with form validation, I prefer to use manual
    ColdFusion validation rather than the automated cfform or
    Javascript validation.
    I have included a sample of one of my form validation scripts
    below, and was wondering if there was a way of scripting this whole
    thing, perhaps to loop through the form collection to perform the
    same sort of validation on the fields included in the collection.
    Is there some sort of attribute I can add to the fields that
    require validation to flag them to the loop?
    Thinking about it I would need something to flag minimum and
    maximum length, regular expressions, and replace() of fields on
    some occasions. Am I overcomplicating something for the sake of
    saving some coding time?
    Thanks in advance,
    Paul
    Attached code:

    What you could do is look for things you do frequently and
    write a custom tag/udf/cfc to make the code re-useable. For
    example, many of my forms just have two text boxes looking for
    dates. I have a custom tag that makes sure both values actually are
    dates, that they are in the correct order, that they are not too
    far apart, and that they are within a specified period.

  • Web Form Validation Message Language Setting at Runtime when work in multi lingual environment

    Business Catalyst use the default culture language to display web form validation message.
    When we are in multi lingual environment and not using subdoamin to handle multilingual sites, we found that the validation message did appear in the default culture setting. To make this work, we need to add the below script in our template.
    <script type="text/javascript">
    $(document).ready(function(){               
    var head= document.getElementsByTagName('head')[0];
    var script= document.createElement('script');
    script.src= '/BcJsLang/ValidationFunctions.aspx?lang=FR';
    script.charset = 'utf-8';
    script.type= 'text/javascript';
    head.appendChild(script);
    </script>
    Assuming the template is in french. You can change the lang parameter in the script according to your language.

    After user 1 submits the page, it might not even be committed, so there is no way to have the pending data from user1 seen by user2.
    However, we do have a new feature in ADF 11g TP4 that I plan to blog more about called Auto-Refresh view objects. This feature allows a view object instance in a shared application module to refresh its data when it receives the Oracle 11g database change notification that a row that would affect the results of the query has been changed.
    The minimum requirements in 11g TP4 to experiment with this feature which I just tested are the following:
    1. Must use Database 11g
    2. Database must have its COMPATIBLE parameter set to '11.0.0.0.0' at least
    3. Set the "AutoRefresh" property of the VO to true (on the Tuning panel)
    4. Add an instance of that VO to an application module (e.g. LOVModule)
    5. Configure that LOVModule as an application-level shared AM in the project properties
    6. Define an LOV based on a view accessor that references the shared AM's VO instance
    7. DBA must have performed a 'GRANT CHANGE NOTIFICATION TO YOURUSER'
    8. Build an ADF Form for the VO that defined the LOV above and run the web page
    9. In SQLPlus, go modify a row of the table on which the shared AM VO is based and commit
    When the Database delivers the change notification, the shared AM VO instance will requery itself.
    However that notification does not arrive all the way out to the web page, so you won't see the change until the next time you repaint the list.
    Perhaps there is some way to take it even farther with the active data feature PaKo mentions, but I'm not familiar enough with that myself to say whether it would work for you hear.

  • Applying mx kollection form validation wwithout using mx kollection insert or update or del transaction

    Is there a way to use the validate form without using the mx
    kollection insert or update or delete transaction, and use the
    default dreamweaver insert server behavior.

    short answer : no, MX Kollection´s (also applies to
    ADDT) form validation routines will only work for forms which have
    been generated with MX Kollection/ADDT
    >>
    and use the default dreamweaver insert server behavior.
    >>
    but if you´re going to insert a record anyway, you can
    as well use Kollection´s "Insert Record Form Wizard" to create
    that form for you, which in turn does provide the required
    validations.

  • Changing pop-up for form validating

    I have simple contact forms that are validated which makes sure the fields in the form are filled out and that it is a proper email address.
    I have 2 contact forms on the same page. On the first one the field name's and id's are "name", "email" and "question". If you click the submit button a pop-up come up with:
    The following error(s) occurred:
    - name is required.
    - email is required.
    - question is required.
    The second form has name's and id's are "name-main", "email-main" and "question-main". The pop-up comes up with:
    The following error(s) occurred:
    - name-main is required.
    - email-main is required.
    - question-main is required.
    The first one is OK but is their a way to change the second one to something more user friendly?

    snarble wrote:
    I am just using dreamweaver 5 form validator.
    Yeah, I just picked up your other thread so you can't use a 'class' as that's already assigned to the input tag.
    You could just forget the protocol about duplicating id's and repeat 'name' as the id for the second form. Only one form will be active at any given time.

  • Need help regarding form validation

    Hi all,
    I have particular doubt regarding form validation. I have a form based on a table. ( One data block ) . I have a function in program unit which return boolean value based on some conditions. I will be calling this function in block validate trigger.
    What i need is , if function return false i need to stop any insertion,updation action that's going to be done by forms.( point to control insertion and updation)
    I don't want to use form triggure failure builtin. What should i do ? plz guide
    regards

    what are you going to do stop insert/update upon commit?
    -- use on-insert trigger
    if allowed_to_insert then
    insert_record;
    end if;
    -- use on-update trigger
    if allowed_to_update then
    update_record;
    end if;
    if when entering data, you might want to check set_block_property

Maybe you are looking for

  • Downgrade to Win 7 Pro from Win 8.1 Pro

    I will be downgrading my T440s to Win 7 64 bit. I was reading the instructions that came with the Win 7 CDs from Lenovo and on page 4 it states on item #6 "select GPT partition style or MBR partition style". From what I understand I would use GPT par

  • How does the newest Iphone work with Ford Sync?

    How does the new Iphone work with Ford Sync? I was thinking of purchasing the 4s but may go elsewhere if there is a better phone for the equipment in my vehicle.

  • What is the best MEDIA STORAGE in the net for my iMac?

    I'm using mediafire and it just takes forever to upload. 300mb equivalent to about 200 mp3's takes 2 hours. I'd like to just simply free up my 1TB lacie External HD so i don't keep buying Hard Drives. I also want to dump my HiDef movies to free up my

  • Is it possible to play video double speed?

    Hi All. Is it possible to play video file or video stream double speed? I've never seen the flash player.  Please show me the way. Thanks in advanced. and sorry for my poor english. Kevin.

  • HT3680 Erase Free Space Issues!!

    When I Try To Erase Free Space On My HD, The Process Fails Repeatedly. With Any Option I Choose, Like 7 Pass, It Takes 2 Minutes For The Entire Process. And That's Obviously Wrong. I've Tried Almost Everything. And My Disk Is Reading FULL. It's Limit