Guest User

Untitled

a guest
Nov 24th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.06 KB | None | 0 0
  1. //Loginovanje
  2. <table width="444" height="54" border="0" cellpadding="0">
  3.   <tr>
  4.     <td><font color="white">Username : </font></td>
  5.     <td><font color="white">Password : </font></td>
  6.     <td>&nbsp;</td>
  7.   </tr>
  8.   <tr><form method="POST" action="">
  9.     <td><input type="TEXT" name="username" class="textbox"></td>
  10.     <td><input type="password" name="password" class="textbox"></td>
  11.     <td><input type="submit" name="send" class="submit"></td>
  12.   </tr></form>
  13. </table>
  14. <?php
  15. $username=$_POST['username'];
  16. $password=$_POST['password'];
  17. $md5pw=md5($password);
  18. $query="SELECT * FROM gz_korisnici WHERE username='$username' and password='$md5pw'" ;
  19. $sq=mysql_query($query);
  20. if($_POST['send']){
  21. echo "" ;
  22.  
  23. if(mysql_num_rows($sq) == 1){
  24. $_SESSION['username'] = $username ;
  25. $_SESSION['password'] = $password ;
  26. echo "<script>window.location=\"index.php\"</script>" ;
  27. mysql_query("INSERT INTO gz_online (ko,broj) VALUES ('$username','1')");
  28. } else {
  29. echo "<script>alert('Username ili Password nije tacan !')</script>" ;
  30. }
  31. }
  32.  
  33.  
  34. ?>
  35.  
  36.  
  37.  
  38. //reg
  39.  
  40.  
  41.  
  42. <table width="444" height="54" border="0" cellpadding="0">
  43.   <tr><form method="POST" action="">
  44.     <td><font color="white">Username : </font></td>
  45.     <td><input type="TEXT" name="user" class="textbox"></td>
  46.     </tr>
  47.     <tr>
  48.     <td><font color="white">Password :</font></td>
  49.     <td><input type="password" name="pw" class="textbox"></td>
  50.   </tr>
  51.   <tr>
  52.     <td><font color="white">E-Mail : </font></td>
  53.     <td><input type="TEXT" name="email" class="textbox"></td>
  54.     </tr><tr><td></td>
  55.     <td><input type="submit" name="send2" class="submit" value="Posalji"></td>
  56.   </tr></form>
  57. </table>
  58. <?php
  59. $user=$_POST['user'];
  60. $pw=$_POST['pw'];
  61. $email=$_POST['email'];
  62. $pwmd5=md5($pw);
  63. if($_POST['send2']){
  64. echo "" ;
  65. if($user == "" || $pw=="" || $email == ""){
  66. echo "<script>alert('Unesite podatke !')</script>" ;
  67. } else {
  68. $sql1="INSERT INTO gz_korisnici (username,password,email) VALUES ('$user','$pwmd5','$email')" ;
  69. mysql_query($sql1) or die(mysql_error());
  70. echo "<script>alert('Uspjesno si se registrovao !')</script>" ;
  71.  
  72. }
  73. }
  74. ?>
Add Comment
Please, Sign In to add comment