Public paste
php
By: dyvus | Date: Nov 20 2006 09:50 | Format: PHP | Expires: never | Size: 3.66 KB | Hits: 1524

  1. <?php
  2.     session_start();
  3.  
  4.         include "include/db/inc_db_connect.php";
  5.         include "include/php/inc_functions.php";
  6.         $datum = date('d-m-Y');
  7.  
  8.  
  9. include "include/content/top.php";
  10. echo "- Registreer";
  11. include "include/content/top2.php";
  12.  
  13.  
  14.  
  15.  
  16.         if($_POST["send_form"] == "ja"){
  17.  
  18.  
  19.         $user   = $_POST['username'];
  20.         $pass1  = $_POST['pass1'];
  21.         $pass2  = $_POST['pass2'];
  22.         $email  = $_POST['email'];
  23.  
  24.     $sql = "SELECT username FROM users WHERE username = '" . $user . "'";
  25.     $res = mysql_query($sql);
  26.  
  27.         while ($row = mysql_fetch_array($res))
  28.         {
  29.  
  30.         if (mysql_num_rows($res) >= 1)
  31.         {
  32.  
  33.                 $checkusr = "1";
  34.  
  35.         }
  36.  
  37.         }
  38.  
  39.  
  40.  
  41.                 $checkmail = checkmail($email);
  42.  
  43.                 if($checkusr == 1){
  44.  
  45.                         $check .= "De loginnaam die u heeft gekozen bestaat al.<br>";
  46.  
  47.                 }elseif(empty($_POST['username'])){
  48.  
  49.                         $check .= "U bent vergeten uw loginnaam in te vullen.<br>";
  50.                 }
  51.  
  52.                 if(empty($pass1) || empty($_POST['pass2'])){
  53.  
  54.                         $check .= "U bent vergeten uw wachtwoord in te vullen.<br>";
  55.  
  56.                 }elseif($pass1 != $_POST['pass2']){
  57.  
  58.                         $check .= "U heeft 2 ongelijke wachtwoorden ingevult.<br>";
  59.                 }
  60.  
  61.                 if(empty($email)){
  62.  
  63.                         $check .= "U bent vergeten uw email in te vullen.<br>";
  64.  
  65.                 }elseif(!$checkmail == 1){
  66.  
  67.                         $check .= "U heeft een verkeerd email adres ingevult.<br>";
  68.                 }
  69.  
  70.  
  71.                         if(empty($check)){
  72.  
  73.  
  74.                                         $username       = secure($user);
  75.                                         $password       = secure(md5($pass1));
  76.                                         $email          = secure($email);
  77.  
  78.                                                 $sql = "INSERT INTO users (username, password, email, regdatum)
  79.                                                 VALUES ('$username', '$password', '$email', '$datum')";
  80.  
  81.                                                 mysql_query($sql) or die ("fout in query");  
  82.  
  83.                                                         // De registratie is voltooid.
  84.                                                         echo "De registratie is voltooid.<br>U kunt nu inloggen.";
  85.  
  86.  
  87.                         }else{
  88.  
  89.                                 echo $check;
  90.  
  91.                 ?>
  92.                 <form action="index.php?p=register" method="post">
  93.                 <table>
  94.                  <tr>
  95.                   <td>Loginnaam</td>
  96.                   <td>&nbsp;</td>
  97.                   <td><input size="30" type="text" value="<?php print($_POST["username"]); ?>" name="username"></td>
  98.                  </tr>
  99.                  <tr>
  100.                   <td>Wachtwoord</td>
  101.                   <td>&nbsp;</td>
  102.                   <td><input type="password" value="" name="pass1"></td>
  103.                  </tr>
  104.                  <tr>
  105.                   <td>Wachtwoord (controle)</td>
  106.                   <td>&nbsp;</td>
  107.                   <td><input type="password" value="" name="pass2"></td>
  108.                  </tr>
  109.                  <tr>
  110.                   <td>E-mail</td>
  111.                   <td>&nbsp;</td>
  112.                   <td><input size="30" type="text" value="<?php print($_POST["email"]); ?>" name="email"></td>
  113.                  </tr>
  114.                  <tr>
  115.                   <td>&nbsp;</td>
  116.                   <td>&nbsp;</td>
  117.                   <td>&nbsp;</td>
  118.                  </tr>
  119.                  <tr>
  120.                   <td><input type="hidden" name="send_form" value="ja"><input type="Submit" name="Submit" value="Registreer"></td>
  121.                  </tr>
  122.                 </table>
  123.                 </form>
  124.                 <?php
  125.  
  126.  
  127.                         }
  128.  
  129.  
  130.         }else{
  131.  
  132.  
  133.  
  134.                 ?>
  135.                 <form action="index.php?p=register" method="post">
  136.                 <table>
  137.                  <tr>
  138.                   <td>Loginnaam</td>
  139.                   <td>&nbsp;</td>
  140.                   <td><input size="30" type="text" value="<?php print($_POST["username"]); ?>" name="username"></td>
  141.                  </tr>
  142.                  <tr>
  143.                   <td>Wachtwoord</td>
  144.                   <td>&nbsp;</td>
  145.                   <td><input type="password" value="" name="pass1"></td>
  146.                  </tr>
  147.                  <tr>
  148.                   <td>Wachtwoord (controle)</td>
  149.                   <td>&nbsp;</td>
  150.                   <td><input type="password" value="" name="pass2"></td>
  151.                  </tr>
  152.                  <tr>
  153.                   <td>E-mail</td>
  154.                   <td>&nbsp;</td>
  155.                   <td><input size="30" type="text" value="<?php print($_POST["email"]); ?>" name="email"></td>
  156.                  </tr>
  157.                  <tr>
  158.                   <td>&nbsp;</td>
  159.                   <td>&nbsp;</td>
  160.                   <td>&nbsp;</td>
  161.                  </tr>
  162.                  <tr>
  163.                   <td><input type="hidden" name="send_form" value="ja"><input type="Submit" name="Submit" value="Registreer"></td>
  164.                  </tr>
  165.                 </table>
  166.                 </form>
  167.                 <?php
  168.  
  169.  
  170.  
  171.         }
  172.  
  173.  
  174.  
  175. include "include/content/midden.php";
  176. include "include/content/bottom.php";
  177.  
  178. ?>