Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. <?php
  2. $link = mysql_connect ("ip","user","pass") or die ("DB server je nedostupny!");
  3. mysql_query("SET NAMES utf-8");
  4. $db = mysql_select_db("pw2", $link) or die ("Tabulka neexistuje!");
  5. ?>
  6.  
  7. <html>
  8. <head><title>PW2 - Registrace</title></head>
  9.  
  10. <body>
  11.  
  12.  
  13. <form action='./registrace.php' method='post' enctype='text/form-data'>
  14.  
  15.  
  16. <?php
  17.  
  18.  
  19. if (!empty($_POST['username']))
  20. {
  21. $user = $_POST["username"];
  22. $pass = $_POST["sha_pash_hash"];
  23.  
  24. mysql_query("insert into user(username, password) values ('".$_POST["username"]."','".sha1(strtoupper($user).':'.strtoupper($pass))."')");
  25. $vypis_id = mysql_query("select id, username from user where username = '".$_POST["username"]."'");
  26. while($row=mysql_fetch_array($vypis_id)) {
  27. echo ("ID Vaseho uctu je <b>".$row["id"]."</b> a username je <b> ".$row["username"]."</b><br>");
  28. }
  29.  
  30. echo '<a href="index_reg.php">Klikni pro navrat</a>';
  31.  
  32. }
  33. ?>
  34.  
  35.  
  36. <fieldset>
  37.  
  38. <table>
  39. <tr>
  40. <td>Nazev Uctu</td><td><input type='text' name='username' /></td>
  41. </tr>
  42. <tr>
  43. <td>Heslo</td><td><input type='password' name='sha_pash_hash' /></td>
  44. </tr>
  45. <tr>
  46. <td colspan='2'><input type='submit' name='submit' value='odeslat' /></td>
  47. </tr>
  48.  
  49. </table>
  50. </fieldset>
  51. </form>
  52.  
  53. </body>
  54. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement