$city = $_POST['city'];
    $state = $_POST['state'];
    $zip = $_POST['zip'];
    $country = $_POST['country'];
    // Validate POST data
    $b_is_first_name_valid = validate_string($first_name);
    $b_is_last_name_valid = validate_string($last_name);
    $b_is_address_valid = validate_address($address1, $address2);
    $b_is_city_valid = validate_city($city);
    $b_is_state_valid = validate_string($state);
    $b_is_zip_valid = validate_zip($zip);
    $b_is_country_valid = validate_string($country);
    // Check POST data
    if ($b_is_first_name_valid == true && $b_is_last_name_valid == true && $b_is_address_valid == true && $b_is_city_valid == true && $b_is_state_valid == true && $b_is_zip_valid == true && $b_is_country_valid == true) {
        // The inputted data is valid, submit it to server.
        submit_data($first_name, $last_name, $address1, $address2, $city, $state, $zip, $country);
    } else {
        // The inputted data is not valid, show the form again with
        // indicated errors.
        // Create key/pair array containing the POST data and validity
        // and pass it to display_registration_form().
        $post_data = array(array($first_name, $b_is_first_name_valid), array($last_name, $b_is_last_name_valid), array($address1, $b_is_address_valid), array($address2, $b_is_address_valid), array($city, $b_is_city_valid), array($state, $b_is_state_valid), array($zip, $b_is_zip_valid), array($country, $b_is_country_valid));
        display_registration_form($post_data);
    }
}
// submit_data() sends the user inputted data to the server for
// server-side validation and entry into the database.
//
// Arguments: POST data strings
// Returns: nothing
function submit_data($first_name, $last_name, $address1, $address2, $city, $state, $zip, $country)
示例#2
0
                                                return;
                                            }
                                            // create a detailed acction log db so that we can recover actions, authors, dates and previous states
                                            $sQuery = "DELETE FROM sessions WHERE id='{$id}' AND subject='{$subject}' AND user='******';";
                                            $rResult = mysqli_query($db_connection, $sQuery) or die(mysqli_error($db_connection));
                                            $rResult = mysqli_query($db_connection, $sQuery);
                                            if (!$rResult) {
                                                $output["msg"] = mysqli_error($db_connection) . " -- " . $sQuery;
                                            } else {
                                                $output["msg"] = "Success. Session {$id} of {$subject} deleted. --";
                                            }
                                            submit_data($output);
                                            //print_r($output);
                                        } else {
                                            $output['msg'] = "unsupported action";
                                            submit_data($output);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
session_write_close();
// OPTIONAL: makes sure session is stored, may be add it as soon as vars are written..., should happen at the end of the script
?>
$_SESSION['values']['slt_enfantStatus'] = $_POST['slt_status_enfant'];
$_SESSION['values']['slt_enfantStatus_Periode'] = $_POST['slt_status_periode'];
$_SESSION['values']['slt_enfantEcole'] = $_POST['slt_ecole_enfant'];
$_SESSION['values']['slt_enfantClasse'] = $_POST['slt_classe_enfant'];
$_SESSION['values']['slt_enfantSexe'] = $_POST['slt_sexe_enfant'];
$_SESSION['values']['hid_enfantid'] = $_POST['id_enfant'];
//$_SESSION['values']['chk_enfantDest'] = $_POST['chk_dest_enfant'];
//if($_SESSION['values']['chk_enfantDest']=="on"){$_SESSION['values']['chk_enfantDest']=" checked";}else{$_SESSION['values']['chk_enfantDest']="";}
if (isset($_GET['validationType'])) {
    $validationType = $_GET['validationType'];
}
if ($validationType == "php") {
    if ($validator->ValidatePHP()) {
        //ok
        //print $_POST['txt_nom_enfant'];
        submit_data();
    } else {
        //not ok
        $clientid = $_POST["id_client_enfant"];
        header("Location:clients.php?edit={$clientid}&success=0");
    }
} else {
    $response = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . '<response>' . '<result>' . $validator->ValidateAJAX($_POST['inputValue'], $_POST['fieldID']) . '</result>' . '<fieldid>' . $_POST['fieldID'] . '</fieldid>' . '</response>';
    //if(ob_get_length()) ob_clean();
    //header('Content-Type: text/xml');
    echo $response;
}
function submit_data()
{
    $clientid = $_POST["id_client_enfant"];
    $enfantid = $_POST["id_enfant"];