Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 23.47 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. function getTime(){
  5.     return date("D jS \,  H\u\:i ");
  6. }
  7.  
  8. function getTimeForTag(){
  9.     return date("Y\-m\-d\TH\:i");
  10. }
  11.  
  12. function beginAndGeneratetitle($title){
  13.  
  14.     echo '<!DOCTYPE html>
  15. <html lang="en" dir="ltr">
  16. <head>
  17.  
  18. <title>'.$title.'</title>
  19. <link type="text/css" rel="stylesheet" media="all" href="styles/style.css" />
  20. <link type="text/css" rel="stylesheet" media="all" href="styles/layout.css" />
  21.  
  22. </head>
  23. <body>
  24.  
  25. <div id="container">
  26. <header id="header" class="margin5">
  27.    <div id="info">  <img src="images/logo.jpg" alt="Oppasweb" />  </div>
  28.    <div id="time"><time datetime='.getTimeForTag().'>'.getTime().'</time></div>
  29.    
  30.    
  31.         <div class="clear"></div>
  32.            
  33. ';
  34. }
  35. function showTopMenu(){
  36.     echo '
  37.     <div id = "menu">
  38.     <nav>  
  39.      
  40.  
  41.         <ul class="links primary-links"><li>
  42.                 <a href="about.php">
  43.                     <span class = "title">About</span>
  44.                     <span class = "descr">wie zijn we</span>
  45.                 </a>       
  46.             </li>
  47.                
  48.             <li>
  49.                 <a href="registreer.php">
  50.                         <span class = "title">registreer</span>
  51.                         <span class = "descr">ik doe mee!</span>
  52.                 </a>   
  53.             </li>  
  54.            
  55.            
  56.            
  57.         </ul>
  58.      </nav> <!-- /#navigation -->
  59.     </div>';
  60.    
  61. }
  62.  
  63.  
  64.  
  65. function contentForRegister(){
  66.     return '<h2>Registreren</h2> <p> In dit menu kan u zich inschrijven als
  67.     <a href="registreerGezin.php"> gezin</a> of als
  68.      <a href="registreerBabysit.php">
  69.      babysit </a>.
  70.      <br/> <br/> In het het linkse menu kan u ook de links vinden. </p>  ';
  71. }
  72.    
  73.  
  74.  
  75. function closeHeaderAndMenu(){
  76.      echo'    </header>
  77.    
  78.     <br class="clear">
  79.     <hr>';
  80. }
  81.  
  82.  
  83. function closeBody(){
  84.     echo '  
  85.  
  86.      <footer>  <div id="footer">
  87.       © 2009 Lucas Kauffman</div>
  88.    </footer>  
  89.     </div></body></html>';
  90. }
  91.  
  92.  
  93. function pwHashGenerator($ww){
  94.     return md5("s".sha1($ww)."make%%&-itmore3535omplex#++***?§%§%%§%§");
  95. }
  96.  
  97.  
  98.  
  99. function antiInjectie($inputfromform){
  100.     $temp = str_replace("'", "`",$inputfromform);
  101.     return $temp = str_replace("--", "~~",$temp);
  102. }
  103.  
  104.  
  105.  
  106. function session_check(){
  107.     $user;
  108.     if(checkValue($_SESSION['user'])){
  109.         GLOBAL $user;
  110.         $user= new User($_SESSION['user']);
  111.     }
  112. }
  113.  
  114. function is_mail($mail){
  115.     if(!preg_match('/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i', $mail)){
  116.         echo "false";
  117.     }
  118.     else { echo "true";}
  119. }
  120.  
  121.  
  122. function random_pass($num)
  123. {
  124.     // genereer het random paswoord
  125.     mt_srand((double)microtime()*1000000);
  126.  
  127.     // loop totdat het $pass(woord) dezelfde lengte heeft als $num
  128.     while (strlen($pass) <= $num)
  129.     {
  130.         $i = chr(mt_rand (0,255));
  131.         if (eregi("^[a-z0-9]$", $i))
  132.         $pass = $pass.$i;
  133.     }
  134.  
  135.     // return het random paswoord
  136.     return ($pass);
  137. }
  138.  
  139.  
  140. function logout(){
  141.       session_start();
  142.       session_destroy();
  143.       header('Location : index.php');
  144.    
  145. }
  146.  
  147. function registerSideMenu(){
  148.     return '<li><a href="registreerBabysit.php">Ik ben een babysit</a></li>
  149.             <li><a href="registreerGezin.php">Ik ben een gezin</a></li>
  150.     ';
  151. }
  152.  
  153. function headHome(){
  154. header("Location: home.php");
  155. }
  156.  
  157.  
  158.  
  159.  
  160.  
  161. function showSideMenuAndOpenContent($li){
  162.     echo '
  163.     <div  id = "content">
  164.         <aside id="sidebarLeft" class = "sidebar" >
  165.             <section id = "leftSection">
  166.                 <ul id="contentMenu">
  167.                     '.$li.'
  168.                 </ul>
  169.            
  170.             </section>
  171.             </aside>
  172.            
  173.     ';
  174. }
  175.  
  176. function showMiddleMenuAndCloseContent($content){
  177.     echo'<div  id="middle">
  178.             <section id="ContentMain">'.$content.'</section>
  179.         </div>
  180.     </div>
  181.     ';
  182. }
  183.  
  184. function connectToDB(){
  185.     global $db;
  186.      require_once('MDB2.php');
  187.  // include "../.db_password.php";
  188.   $dsn = array(
  189.     'phptype'  => 'pgsql',
  190.     'username' => '********,
  191.   // 'password' => $password,
  192.    'password' => '********',
  193.   // 'hostspec' => 'localhost',
  194.    'hostspec' => 'localhost',
  195.    'port'     => '6666',
  196.    'database' => '********,
  197. );
  198.   // stap 1 en 2: maak connectie met server en kies databank
  199.   $db = MDB2::connect($dsn);
  200.   // foutboodschap genereren als er geen connectie tot stand gebracht is kunnen worden
  201.   if (PEAR::isError($db)) {die("Geen connectie met databank: ".$db->getMessage()); };
  202.   // foutboodschappen tonen indien er fouten optreden als het object $db aanroepen wordt
  203.   $db->setErrorHandling(PEAR_ERROR_DIE);
  204. }
  205.  
  206. function gezinForm(){
  207.     return '        <form id="GezinForm" class="appnitro"  method="post" action="'.htmlentities($_SERVER['PHP_SELF']).'">
  208.                     <div class="form_description">
  209.             <h2>Gezin</h2>
  210.             <p>Gelieve je hier in te schrijven als gezin</p>
  211.         </div>                     
  212.             <ul >
  213.            
  214.                     <li id="li_1" >
  215.         <label class="description" for="element_1">Naam </label>
  216.         <div>
  217.               <input id="element_1" name="element_1" class="element text medium" type="text" maxlength="255" value="'.
  218.     ((checkValue($_POST['element_1']))? htmlentities($_POST['element_1']):'')
  219.     . '"/>
  220.         </div><p class="guidelines" id="guide_1"><small>Voer uw naam in.</small></p>
  221.         </li>       <li id="li_2" >
  222.         <label class="description" for="element_2">Voornaam </label>
  223.         <div>
  224.             <input id="element_2" name="element_2" class="element text medium" type="text" maxlength="255" value="'.((checkValue($_POST['element_2']))? htmlentities($_POST['element_2']):'').'"/>
  225.         </div><p class="guidelines" id="guide_2"><small>Vul uw voornaam in.</small></p>
  226.         </li>       <li id="li_3" >
  227.         <label class="description" for="element_3">Adres </label>
  228.         <div>
  229.             <input id="element_3" name="element_3" class="element text medium" type="text" maxlength="255" value="'.((checkValue($_POST['element_3']))? htmlentities($_POST['element_3']):'').'"/>
  230.         </div><p class="guidelines" id="guide_3"><small>vul uw straat en huisnummer in.</small></p>
  231.         </li>       <li id="li_4" >
  232.         <label class="description" for="element_4">Woonplaats </label>
  233.         <div>
  234.             <input id="element_4" name="element_4" class="element text medium" type="text" maxlength="255" value="'.((checkValue($_POST['element_4']))? htmlentities($_POST['element_4']):'').'"/>
  235.         </div><p class="guidelines" id="guide_4"><small>vul uw woonplaats in.</small></p>
  236.         </li>       <li id="li_5" >
  237.         <label class="description" for="element_5">Postcode </label>
  238.         <div>
  239.             <input id="element_5" name="element_5" class="element text small" type="text" maxlength="255" value="'.((checkValue($_POST['element_5']))? htmlentities($_POST['element_5']):'').'"/>
  240.         </div><p class="guidelines" id="guide_5"><small>Vul uw Postcode hier in</small></p>
  241.         </li>       <li id="li_6" >
  242.         <label class="description" for="element_6">telefoonnummer </label>
  243.         <div>
  244.             <input id="element_6" name="element_6" class="element text medium" type="text" maxlength="255" value="'.((checkValue($_POST['element_6']))? htmlentities($_POST['element_6']):'').'"/>
  245.         </div><p class="guidelines" id="guide_6"><small>Vul uw telefoonnummer in.</small></p>
  246.         </li>       <li id="li_7" >
  247.         <label class="description" for="element_7">email </label>
  248.         <div>
  249.             <input id="element_7" name="element_7" class="element text medium" type="text" maxlength="255" value="'.((checkValue($_POST['element_7']))? htmlentities($_POST['element_7']):'').'"/>
  250.         </div><p class="guidelines" id="guide_7"><small>vul uw email in.</small></p>
  251.         </li>       <li id="li_8" >
  252.         <label class="description" >Geboortedatum </label>
  253.         <span>
  254.             <input id="element_8_1" name="element_8_1" class="element text" size="2" maxlength="2" value="'.((checkValue($_POST['element_8_1']))? htmlentities($_POST['element_8_1']):'').'" type="text"> /
  255.             <label for="element_8_1">MM</label>
  256.         </span>
  257.         <span>
  258.             <input id="element_8_2" name="element_8_2" class="element text" size="2" maxlength="2" value="'.((checkValue($_POST['element_8_2']))? htmlentities($_POST['element_8_2']):'').'" type="text"> /
  259.             <label for="element_8_2">DD</label>
  260.         </span>
  261.         <span>
  262.             <input id="element_8_3" name="element_8_3" class="element text" size="4" maxlength="4" value="'.((checkValue($_POST['element_8_3']))? htmlentities($_POST['element_8_3']):'').'" type="text">
  263.             <label for="element_8_3">YYYY</label>
  264.         </span>
  265.         </li>
  266.        
  267.         <li id="li_kind1" >
  268.         <label class="description" for="element_kind1">Kind </label>
  269.         <div>
  270.             <input id="element_kind1" name="element_kind1" class="element text medium" type="text" maxlength="255" value="'.((checkValue($_POST['element_kind1']))? htmlentities($_POST['element_kind1']):'').'"/>
  271.             </div><div> <span>
  272.             <input id="element_kind1_m" name="element_kind1_m" class="element text" size="2" maxlength="2" value="'.((checkValue($_POST['element_kind1_m']))? htmlentities($_POST['element_kind1_m']):'').'" type="text"> /
  273.             <label for="element_kind1_m">MM</label>
  274.         </span>
  275.         <span>
  276.             <input id="element_kind1_d" name="element_kind1_d" class="element text" size="2" maxlength="2" value="'.((checkValue($_POST['element_kind1_d']))? htmlentities($_POST['element_kind1_d']):'').'" type="text"> /
  277.             <label for="element_kind1_d">DD</label>
  278.         </span>
  279.         <span>
  280.             <input id="element_kind1_y" name="element_kind1_y" class="element text" size="4" maxlength="4" value="'.((checkValue($_POST['element_kind1_y']))? htmlentities($_POST['element_kind1_y']):'').'" type="text">
  281.             <label for="element_kind1_y">YYYY</label>
  282.         </span>
  283.        
  284.         </div><p class="guidelines" id="guide_kind1"><small>vul uw eerste kind in</small></p>
  285.         </li>  
  286.        
  287.         <li id="li_kind2" >
  288.         <label class="description" for="element_kind2">Kind </label>
  289.         <div>
  290.             <input id="element_kind2" name="element_kind2" class="element text medium" type="text" maxlength="255" value="'.((checkValue($_POST['element_kind2']))? htmlentities($_POST['element_kind2']):'').'"/>
  291.             </div><div>
  292.             <span>
  293.             <input id="element_kind2_m" name="element_kind2_m" class="element text" size="2" maxlength="2" value="'.((checkValue($_POST['element_kind2_m']))? htmlentities($_POST['element_kind2_m']):'').'" type="text"> /
  294.             <label for="element_kind2_m">MM</label>
  295.         </span>
  296.         <span>
  297.             <input id="element_kind2_d" name="element_kind2_d" class="element text" size="2" maxlength="2" value="'.((checkValue($_POST['element_kind2_d']))? htmlentities($_POST['element_kind2_d']):'').'" type="text"> /
  298.             <label for="element_kind2_d">DD</label>
  299.         </span>
  300.         <span>
  301.             <input id="element_kind2_y" name="element_kind2_y" class="element text" size="4" maxlength="4" value="'.((checkValue($_POST['element_kind2_y']))? htmlentities($_POST['element_kind2_y']):'').'" type="text">
  302.             <label for="element_kind2_y">YYYY</label>
  303.         </span>
  304.        
  305.         </div><p class="guidelines" id="guide_kind2"><small>vul uw tweede kind in</small></p>
  306.         </li>  
  307.        
  308.         <li id="li_kind3" >
  309.         <label class="description" for="element_kind3">Kind </label>
  310.         <div>
  311.             <input id="element_kind3" name="element_kind3" class="element text medium" type="text" maxlength="255" value="'.((checkValue($_POST['element_kind3']))? htmlentities($_POST['element_kind3']):'').'"/>
  312.             </div><div>
  313.             <span>
  314.             <input id="element_kind3_m" name="element_kind3_m" class="element text" size="2" maxlength="2" value="'.((checkValue($_POST['element_kind3_m']))? htmlentities($_POST['element_kind3_m']):'').'" type="text"> /
  315.             <label for="element_kind3_m">MM</label>
  316.         </span>
  317.         <span>
  318.             <input id="element_kind3_d" name="element_kind3_d" class="element text" size="2" maxlength="2" value="'.((checkValue($_POST['element_kind3_d']))? htmlentities($_POST['element_kind3_d']):'').'" type="text"> /
  319.             <label for="element_kind3_d">DD</label>
  320.         </span>
  321.         <span>
  322.             <input id="element_kind3_y" name="element_kind3_y" class="element text" size="4" maxlength="4" value="'.((checkValue($_POST['element_kind3_y']))? htmlentities($_POST['element_kind3_y']):'').'" type="text">
  323.             <label for="element_kind3_y">YYYY</label>
  324.         </span>
  325.        
  326.         </div><p class="guidelines" id="guide_kind3"><small>vul uw derde kind in</small></p>
  327.         </li>  
  328.        
  329.         <li id="li_kind4" >
  330.         <label class="description" for="element_kind4">Kind </label>
  331.         <div>
  332.             <input id="element_kind4" name="element_kind4" class="element text medium" type="text" maxlength="255" value="'.((checkValue($_POST['element_kind4']))? htmlentities($_POST['element_kind4']):'').'"/>
  333.             </div><div><span>
  334.             <input id="element_kind4_m" name="element_kind4_m" class="element text" size="2" maxlength="2" value="'.((checkValue($_POST['element_kind4_m']))? htmlentities($_POST['element_kind4_m']):'').'" type="text"> /
  335.             <label for="element_kind4_m">MM</label>
  336.         </span>
  337.         <span>
  338.             <input id="element_kind4_d" name="element_kind4_d" class="element text" size="2" maxlength="2" value="'.((checkValue($_POST['element_kind4_d']))? htmlentities($_POST['element_kind4_d']):'').'" type="text"> /
  339.             <label for="element_kind4_d">DD</label>
  340.         </span>
  341.         <span>
  342.             <input id="element_kind4_y" name="element_kind4_y" class="element text" size="4" maxlength="4" value="'.((checkValue($_POST['element_kind4_y']))? htmlentities($_POST['element_kind4_y']):'').'" type="text">
  343.             <label for="element_kind4_y">YYYY</label>
  344.         </span>
  345.        
  346.         </div><p class="guidelines" id="guide_kind4"><small>vul uw vierde kind in</small></p>
  347.         </li>  
  348.        
  349.        
  350.        
  351.        
  352.        
  353.        
  354.         <li id="li_10" >
  355.         <label class="description" for="element_10">Wachtwoord </label>
  356.         <div>
  357.             <input id="element_10" name="element_10" class="element text medium" type="text" maxlength="255" value="'.((checkValue($_POST['element_10']))? htmlentities($_POST['element_10']):'').'"/>
  358.             <input id="element_10_1" name="element_10_1" class="element text medium" type="text" maxlength="255" value="'.((checkValue($_POST['element_10_1']))? htmlentities($_POST['element_10_1']):'').'"/>
  359.         </div><p class="guidelines" id="guide_10"><small>Vul uw wachtwoord twee maal in. Hierdoor voorkomt men typfouten door validatie.</small></p>
  360.         </li>      
  361.    
  362.        
  363.          
  364.             <li id="li_9" >
  365.         <label class="description" for="element_9">Opmerkingen </label>
  366.         <div>
  367.             <textarea id="element_9" name="element_9" class="element textarea medium" ></textarea>
  368.         </div>
  369.         </li>
  370.            
  371.                     <li class="buttons">
  372.                 <input type="hidden" name="form_id" value="206335" />
  373.                
  374.                 <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
  375.         </li>
  376.             </ul>
  377.         </form> ';
  378.    
  379. }
  380.  
  381.  
  382. function babysitterForm(){
  383.     return  '       <form id="babysitForm" class="appnitro"  method="post" action="'.htmlentities($_SERVER['PHP_SELF']).'">
  384.                     <div class="form_description">
  385.             <h2>Babysitter</h2>
  386.             <p>Gelieve je hier in te schrijven als babysitter</p>
  387.             <div id ="summaryErrors">'.babysitterToevoegenAanDB().'     </div>
  388.         </div>             
  389.             <ul >
  390.            
  391.                     <li id="li_1" >
  392.         <label class="description" for="element_1">Naam </label>
  393.         <div>
  394.               <input id="element_1" name="element_1" class="element text medium" type="text" maxlength="255" value="'.
  395.     ((isset($_POST['element_1']))? htmlentities($_POST['element_1']):'')
  396.     . '"/>
  397.         </div><p class="guidelines" id="guide_1"><small>Voer uw naam in.</small></p>
  398.         </li>       <li id="li_2" >
  399.         <label class="description" for="element_2">Voornaam </label>
  400.         <div>
  401.             <input id="element_2" name="element_2" class="element text medium" type="text" maxlength="255" value="'.((isset($_POST['element_2']))? htmlentities($_POST['element_2']):'').'"/>
  402.         </div><p class="guidelines" id="guide_2"><small>Vul uw voornaam in.</small></p>
  403.         </li>       <li id="li_3" >
  404.         <label class="description" for="element_3">Adres </label>
  405.         <div>
  406.             <input id="element_3" name="element_3" class="element text medium" type="text" maxlength="255" value="'.((isset($_POST['element_3']))? htmlentities($_POST['element_3']):'').'"/>
  407.         </div><p class="guidelines" id="guide_3"><small>vul uw straat en huisnummer in.</small></p>
  408.         </li>       <li id="li_4" >
  409.         <label class="description" for="element_4">Woonplaats </label>
  410.         <div>
  411.             <input id="element_4" name="element_4" class="element text medium" type="text" maxlength="255" value="'.((isset($_POST['element_4']))? htmlentities($_POST['element_4']):'').'"/>
  412.         </div><p class="guidelines" id="guide_4"><small>vul uw woonplaats in.</small></p>
  413.         </li>       <li id="li_5" >
  414.         <label class="description" for="element_5">Postcode </label>
  415.         <div>
  416.             <input id="element_5" name="element_5" class="element text small" type="text" maxlength="255" value="'.((isset($_POST['element_5']))? htmlentities($_POST['element_5']):'').'"/>
  417.         </div><p class="guidelines" id="guide_5"><small>Vul uw Postcode hier in</small></p>
  418.         </li>       <li id="li_6" >
  419.         <label class="description" for="element_6">telefoonnummer </label>
  420.         <div>
  421.             <input id="element_6" name="element_6" class="element text medium" type="text" maxlength="255" value="'.((isset($_POST['element_6']))? htmlentities($_POST['element_6']):'').'"/>
  422.         </div><p class="guidelines" id="guide_6"><small>Vul uw telefoonnummer in.</small></p>
  423.         </li>       <li id="li_7" >
  424.         <label class="description" for="element_7">email </label>
  425.         <div>
  426.             <input id="element_7" name="element_7" class="element text medium" type="text" maxlength="255" value="'.((isset($_POST['element_7']))? htmlentities($_POST['element_7']):'').'"/>
  427.         </div><p class="guidelines" id="guide_7"><small>vul uw email in.</small></p>
  428.         </li>       <li id="li_8" >
  429.         <label class="description" >Geboortedatum </label>
  430.         <span>
  431.             <input id="element_8_1" name="element_8_1" class="element text" size="2" maxlength="2" value="'.((isset($_POST['element_8_1']))? htmlentities($_POST['element_8_1']):'').'" type="text"> /
  432.             <label for="element_8_1">MM</label>
  433.         </span>
  434.         <span>
  435.             <input id="element_8_2" name="element_8_2" class="element text" size="2" maxlength="2" value="'.((isset($_POST['element_8_2']))? htmlentities($_POST['element_8_2']):'').'" type="text"> /
  436.             <label for="element_8_2">DD</label>
  437.         </span>
  438.         <span>
  439.             <input id="element_8_3" name="element_8_3" class="element text" size="4" maxlength="4" value="'.((isset($_POST['element_8_3']))? htmlentities($_POST['element_8_3']):'').'" type="text">
  440.             <label for="element_8_3">YYYY</label>
  441.         </span>
  442.        
  443.         <li id="li_10" >
  444.         <label class="description" for="element_10">Wachtwoord </label>
  445.         <div>
  446.             <input id="element_10" name="element_10" class="element text medium" type="text" maxlength="255" value="'.((isset($_POST['element_10']))? htmlentities($_POST['element_10']):'').'"/>
  447.             <input id="element_10_1" name="element_10_1" class="element text medium" type="text" maxlength="255" value="'.((isset($_POST['element_10_1']))? htmlentities($_POST['element_10_1']):'').'"/>
  448.         </div><p class="guidelines" id="guide_10"><small>Vul uw wachtwoord twee maal in. Hierdoor voorkomt men typfouten door validatie.</small></p>
  449.         </li>      
  450.    
  451.        
  452.          
  453.             <li id="li_9" >
  454.         <label class="description" for="element_9">Opmerkingen </label>
  455.         <div>
  456.             <textarea id="element_9" name="element_9" class="element textarea medium" ></textarea>
  457.         </div>
  458.         </li>
  459.            
  460.                     <li class="buttons">
  461.                 <input type="hidden" name="form_id" value="206335" />
  462.                
  463.                 <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
  464.         </li>
  465.             </ul>
  466.         </form> ';
  467. }
  468.  
  469. function testBabysitterForAllElements(){
  470.      global $db;
  471.      $errorArray = array();
  472.      $naamarray=array();
  473.      
  474.      $naamarray["naam"]=false;
  475.      $naamarray["voornaam"]=false;
  476.      $naamarray["adres"]=false;
  477.      $naamarray["woonplaats"]=false;
  478.      $naamarray["postcode"]=false;
  479.      $naamarray["telefoonnummer"]=false;
  480.      $naamarray["geboortedatum"]=false;
  481.      $naamarray["adres"]=false;
  482.      $naamarray["wachtwoord"]=false;
  483.      $naamarray["email"]=false;
  484.    
  485.      
  486.      if(checkValue($_POST['element_1'])){
  487.         $naamarray["naam"]=true;
  488.        
  489.      }
  490.      
  491.      if(checkValue($_POST['element_2'])){
  492.         $naamarray["voornaam"]=true;       
  493.      }
  494.      
  495.      if(checkValue($_POST['element_3'])){
  496.         $naamarray["adres"]=true;      
  497.      }
  498.      
  499.      if(checkValue($_POST['element_4'])){
  500.         $naamarray["woonplaats"]=true;     
  501.      }
  502.      
  503.      
  504.      if(checkValue($_POST['element_5'])){
  505.         $naamarray["postcode"]=true;       
  506.      }
  507.      
  508.      if(checkValue($_POST['element_6'])){
  509.         $naamarray["telefoonnummer"]=true;     
  510.      }
  511.      
  512.      if(checkValue($_POST['element_7'])){
  513.         $naamarray["email"]=true;      
  514.         connectToDB();
  515.         $sql='SELECT inlognaam FROM  kauffman.login WHERE inlognaam like \''.$_POST['element_7'].'\';';
  516.         $rows=$db->queryRow($sql);
  517.         if($rows){
  518.             array_push($errorArray,"email adres is reeds geregistreerd.");
  519.         }
  520.      }
  521.      
  522.      
  523.      if(checkValue($_POST['element_8_1']) && checkValue($_POST['element_8_2']) && checkValue($_POST['element_8_3'])){
  524.         $naamarray["geboortedatum"]=true;      
  525.      }
  526.    
  527.      if(checkValue($_POST['element_10']) && checkValue($_POST['element_10_1'])){
  528.         $naamarray['wachtwoord']=true;
  529.      }
  530.  
  531.      
  532.      foreach($naamarray as $key => $value){
  533.             if(!$value){
  534.                 array_push($errorArray,$key);
  535.             }
  536.      }
  537.      
  538.      return $errorArray;
  539.      
  540. }
  541.  
  542. function checkValue($val){
  543.     $bool = false;
  544.     if(isset($val)){
  545.     if(!empty($val) ){
  546.         if (strlen($val) > 0 && !strlen(trim($val)) == 0){
  547.         $bool = true;
  548.        
  549.         }  
  550.     }
  551.    
  552.     }  
  553.     return $bool;
  554. }
  555.  
  556.  
  557. function babysitterToevoegenAanDB(){
  558.     $result = array();
  559.     global $db;
  560.    
  561.     if ($_SERVER['REQUEST_METHOD'] == "POST") {
  562.  
  563.  
  564.     $errorArray = testBabysitterForAllElements();
  565.      
  566.    
  567.         if(empty($errorArray)){
  568.             connectToDB();
  569.  
  570.             $sql = "INSERT into kauffman.login(inlognaam,functie,paswoord) VALUES ('".antiInjectie($_POST['element_7'])."','gezin','".pwHashGenerator(antiInjectie($_POST['element_10_1']))."');";
  571.             $sql2 = 'SELECT serialKey from kauffman.login WHERE inlognaam='.antiInjectie($_POST['element_7']).';'  ;
  572.            
  573.             array_push($result,"it worked");
  574.         }else{
  575.             $result= $errorArray;
  576.         }
  577.         echo '<p> volgende velden werden niet correct ingevuld : </p> <ul>';
  578.         foreach($result as $item){
  579.             echo '<li>'.$item.'</li>';
  580.         }
  581.         echo '</ul>';
  582.     }
  583. }
  584.  
  585.  
  586.  
  587. function errorCheckerPrinter($errorArray){
  588.    
  589.     $string='<div id="error"><ul>';
  590.    
  591.     foreach($errorArray as $element){
  592.         $string .= "<li>".$element."</li>";    
  593.     }  
  594.     $string .= '</ul> </div>';
  595. }
  596.  
  597.  
  598.  
  599.  
  600. function testGezinForAllElements(){
  601.     global $db;
  602.     $errorArray = testBabysitterForAllElements();
  603.    
  604.     if(!checkValue($_POST['element_kind1'])){
  605.         array_push($errorArray, "U heeft kind 1 niet ingevuld, gelieve minimaal 1 kind in te vullen te beginnen met kind 1");
  606.        
  607.     }
  608.    
  609.     if(!checkValue($_POST['element_kind1'])){
  610.         if(!checkValue($_POST['element_kind1_d']) || !checkValue($_POST['element_kind1_m']) || !checkValue($_POST['element_kind1_y'])){
  611.             array_push($errorArray,"Gelieve de geboortedatum correct in te vullen van kind 1");
  612.         }
  613.     }
  614.    
  615.     if(!checkValue($_POST['element_kind2'])){
  616.         if(!checkValue($_POST['element_kind2_d']) || !checkValue($_POST['element_kind2_m']) || !checkValue($_POST['element_kind2_y'])){
  617.             array_push($errorArray,"Gelieve de geboortedatum correct in te vullen van kind 2");
  618.         }
  619.     }
  620.    
  621.     if(!checkValue($_POST['element_kind3'])){
  622.         if(!checkValue($_POST['element_kind3_d']) || !checkValue($_POST['element_kind3_m']) || !checkValue($_POST['element_kind3_y'])){
  623.             array_push($errorArray,"Gelieve de geboortedatum correct in te vullen van kind 3");
  624.         }
  625.     }
  626.     if(!checkValue($_POST['element_kind4'])){
  627.         if(!checkValue($_POST['element_kind4_d']) || !checkValue($_POST['element_kind4_m']) || !checkValue($_POST['element_kind4_y'])){
  628.             array_push($errorArray,"Gelieve de geboortedatum correct in te vullen van kind 4");
  629.         }
  630.     }
  631.    
  632.     return $errorArray;
  633.    
  634.    
  635. }
  636.  
  637.  
  638. function requestAllGezin(){
  639.    
  640. }
  641.  
  642.  
  643. function requestAllBabysit(){
  644.    
  645. }
  646.  
  647. function requestAllUsers(){
  648.    
  649. }
  650.  
  651. function searchUser($searchTerm){
  652.    
  653. }
  654.  
  655.  
  656. function showNietToegewezenAanvragen(){
  657.    
  658. }
  659.  
  660. function wijzigGegegevensUser($ObjectId){
  661.    
  662. }
  663.  
  664.  
  665. function showAlleAanvragen(){
  666.    
  667. }
  668.  
  669.  function aanvraagInvoeren(){
  670.    
  671.  }
  672.  
  673.  function showToegewezenAanvragen(){
  674.    
  675.  }
  676.  
  677.  function resetPassword($objectID,$password){
  678.    
  679.  }
  680.  
  681.  function sendMail($ObjectIdArray,$messageArray){
  682.    
  683.  }
  684.  
  685.  
  686.  function resetMyPasswordForm(){
  687.    
  688.  }
  689.  
  690.  function aanvragenVanEenGezinOpvragen($ObjectId){
  691.  
  692.  }
  693.  
  694.  function requestMijnToegewezenAanvragenBabysit($ObjectId){
  695.    
  696.  }
  697.  
  698. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement