Advertisement
Knilayan

Untitled

Oct 21st, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.68 KB | None | 0 0
  1. <?php
  2.  
  3. $error = "";
  4.  
  5. if (isset($_POST['submit'])) {
  6.     $name             = trim($_POST['name']);
  7.     $social        = ($_POST['social']);
  8.     $number            = ($_POST['number']);
  9.    
  10.     $email                 = $_POST['email'];
  11.     $license               = $_POST['license'];
  12.     $address                = $_POST['address'];
  13.     $city               = $_POST['city'];
  14.     $state             = $_POST['state'];
  15.     $zip              = $_POST['zip'];
  16.    
  17.     $years             = $_POST['years'];
  18.     $landlord              = $_POST['landlord'];
  19. $phone1             = $_POST['phone1'];
  20.     $employer            = $_POST['employer'];
  21.     $address2                = $_POST['address2'];
  22.     $city2               = $_POST['city2'];
  23.     $state2             = $_POST['state2'];
  24.     $zip2              = $_POST['zip2'];
  25.     $phone3             = $_POST['phone3'];
  26.     $years2             = $_POST['years2'];
  27.     $gross1             = $_POST['gross1'];
  28.     $per1             = $_POST['per1'];
  29.     $take1             = $_POST['take1'];
  30.     $per2             = $_POST['per2'];
  31.    
  32.  
  33.     # Validate name
  34.        if (!ctype_alpha(str_replace(array("'", "-"), "",$name))) {
  35.              $error .= '<p class="error"> name should be alpha characters only.</p>';
  36.         }
  37.        
  38.     # Validate Social Security No
  39.      if (!ctype_digit($social) OR strlen($social) != 10) {
  40.             $error .= '<p class="error">Enter a valid Social Security No. number.</p>';
  41.         }
  42.        
  43.          # Validate Phone #
  44.        if (!ctype_digit($number) OR strlen($number) != 11) {
  45.             $error .= '<p class="error">Enter a Phone number(day).</p>';
  46.         }
  47.        
  48.        
  49.         # Validate Email #
  50.        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
  51.             $error .= '<p class="error">Enter a valid email address.</p>';
  52.         }
  53.     # Validate license
  54.        if (!ctype_digit($license) OR strlen($license) != 8) {
  55.             $error .= '<p class="error">Enter a valid license number.</p>';
  56.         }
  57.      # Validate address
  58.        if (!ctype_alpha(str_replace(array("'", "-"), "",$address))) {
  59.             $error .= '<p class="error"> Address should be alpha characters only.</p>';
  60.         }
  61.   # Validate city
  62.        if (!ctype_alpha(str_replace(array("'", "-"), "",$city))) {
  63.             $error .= '<p class="error">City should be alpha characters only.</p>';
  64.         }
  65.  # Validate State
  66.        if (!ctype_alpha(str_replace(array("'", "-"), "",$state))) {
  67.             $error .= '<p class="error">State should be alpha characters only.</p>';
  68.         }
  69.          # Validate Zip
  70.        if (!ctype_digit($zip) OR strlen($zip) != 4) {
  71.             $error .= '<p class="error">Enter a Zip Code</p>';
  72.         }
  73.  
  74.     # Validate landlord name
  75.        if (!ctype_alpha(str_replace(array("'", "-"), "",$landlord))) {
  76.             $error .= '<p class="error">Landlords name should be alpha characters only.</p>';
  77.         }
  78.          # Validate Phone #1
  79.        if (!ctype_digit($phone1) OR strlen($phone1) != 11) {
  80.             $error .= '<p class="error">Enter a Phone number(applicant).</p>';
  81.         }
  82.         # Validate current employee
  83.        if (!ctype_alpha(str_replace(array("'", "-"), "",$employer))) {
  84.             $error .= '<p class="error">Current Employee name should be alpha characters only.</p>';
  85.         }
  86.          # Validate current employee address
  87.        if (!ctype_alpha(str_replace(array("'", "-"), "",$address2))) {
  88.             $error .= '<p class="error"> Current employee Address should be alpha characters only.</p>';
  89.         }
  90.   # Validate  current employee city
  91.        if (!ctype_alpha(str_replace(array("'", "-"), "",$city2))) {
  92.             $error .= '<p class="error">Current employee City should be alpha characters only.</p>';
  93.         }
  94.  # Validate current employee State
  95.        if (!ctype_alpha(str_replace(array("'", "-"), "",$state2))) {
  96.             $error .= '<p class="error">Current employee State should be alpha characters only.</p>';
  97.         }
  98.          # Validatecurrent employee  Zip
  99.        if (!ctype_digit($zip2) OR strlen($zip2) != 4) {
  100.             $error .= '<p class="error">Enter a Zip Code</p>';
  101.         }
  102.          # Validate current gross
  103.        if (!ctype_digit($gross1) OR strlen($gross1) != 4) {
  104.             $error .= '<p class="error">Enter an amount</p>';
  105.         }
  106.         # Validate current employee gross per
  107.        if (!ctype_alpha(str_replace(array("'", "-"), "",$per1))) {
  108.             $error .= '<p class="error">pls type a month</p>';
  109.         }
  110.          # Validate current take home pay
  111.        if (!ctype_digit($take1) OR strlen($take1) != 4) {
  112.             $error .= '<p class="error">Enter an amount</p>';
  113.         }
  114.         # Validate current employee take home  per
  115.        if (!ctype_alpha(str_replace(array("'", "-"), "",$per2))) {
  116.             $error .= '<p class="error">pls type a month</p>';
  117.         }
  118.        
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement