Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.65 KB | None | 0 0
  1.  <input id="register-button" type="submit" name="register-firm" value="REGISTER">
  2.                 <?php
  3.                 //Testovani naplnenych poli
  4.                 $required = array('firm-name', 'ico', 'firm-email', 'web', 'street', 'house-number', 'city', 'psc');
  5.  
  6.                 $error = false;
  7.                 foreach($required as $field) {
  8.                     if (empty($_POST[$field])) {
  9.                     $error = true;
  10.                     }
  11.                 }
  12.  
  13.                 if ($error) {
  14.                     echo "<h4  id='error-msg'>Vyplňte všechna pole.</h4>";
  15.                 } else {
  16.                 //Zmacknuti register buttonu
  17.                 if (isset($_POST['register-firm'])) {
  18.  
  19.                     //ziskani emailu
  20.                     $email = $_POST['firm-email'];
  21.                     //overeni spravneho tvaru
  22.                     if (filter_var($email,FILTER_VALIDATE_EMAIL) === false){
  23.  
  24.                         echo "Spatne zadana forma emailu.";
  25.  
  26.                         //overeni stejneho hesla
  27.                     } else {
  28.                         //pripojeni k databazi
  29.                         $oracle = new Oracle();
  30.                         $c = $oracle->connect();
  31.  
  32.                         //ziskavani hodnot z formulaře
  33.                         $fname = $_POST['firm-name'];
  34.                         $ico = $_POST['ico'];
  35.                         $email = $_POST['firm-email'];
  36.                         $street = $_POST['street'];
  37.                         $housenumber = $_POST['house-number'];
  38.                         $city = $_POST['city'];
  39.                         $psc = $_POST['psc'];
  40.                         $state = $_POST['state-option'];
  41.  
  42.                         $zapisFirmu = "BEGIN register_firm(:param1, :param2, :param3, :param4, :param5, :param6, :param7,:param8); END;";
  43.                         $stmt_id = oci_parse($c, $zapisFirmu);
  44.                         oci_bind_by_name($stmt_id, ':param1', $fname);
  45.                         oci_bind_by_name($stmt_id, ':param2', $ico);
  46.                         oci_bind_by_name($stmt_id, ':param2', $email);
  47.                         oci_bind_by_name($stmt_id, ':param2', $street);
  48.                         oci_bind_by_name($stmt_id, ':param2', $housenumber);
  49.                         oci_bind_by_name($stmt_id, ':param2', $city);
  50.                         oci_bind_by_name($stmt_id, ':param2', $psc);
  51.                         oci_bind_by_name($stmt_id, ':param2', $state);
  52.  
  53.                         oci_execute($stmt_id);
  54.  
  55.                         oci_close($c);
  56.                         $oracle->close();
  57.                     }
  58.                 }
  59.                 }
  60.  
  61.                 ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement