Advertisement
Jakolcz

Registrace uzivatele

Feb 16th, 2012
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <?php
  2. if(isset($_POST["odeslat"])){
  3.   require "./fce.php";
  4.   $username = $_POST["username"];
  5.   $pw = "/\A".$_POST["heslo"]."\z/";
  6.   $pw2 = $_POST["heslo2"];
  7.   $strFile = file_get_contents("login.txt");
  8.   if(check($strFile, $username, ""))
  9.     echo "Uživatel již existuje!<br />\n";
  10.   else{
  11.     if(preg_match($pw, $pw2)==0){
  12.       echo "Hesla nejsou stejná!<br />\n";
  13.     }else{
  14.       file_put_contents("login.txt", $username.":".$pw2."\n", FILE_APPEND);
  15.     }
  16.   }
  17. }
  18. ?>
  19. <form action='reg.php' method='POST'>
  20. <table>
  21. <tr><td>Uživatelské jméno:</td><td><input type='text' name='username' /></td></tr>
  22. <tr><td>Heslo:</td><td><input type='password' name='heslo' /></td></tr>
  23. <tr><td>Heslo znovu:</td><td><input type='password' name='heslo2' /></td></tr>
  24. </table>
  25. <input type='submit' name='odeslat' value='odeslat' />
  26. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement