Advertisement
kklevi

Untitled

Oct 25th, 2022
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. <?php
  2. session_start();
  3. $link=mysqli_connect('localhost','t224','t224','t224');
  4.  
  5. if(!isset($_SEESION['enter']) || (isset($_GET['exit'])&& $_GET['exit'] == 'on')){
  6. $_SESSION['enter']=false;
  7. }
  8.  
  9. if(isset($_GET['add']) && $_GET['add'] == 'on'){
  10. echo '<FORM NAME="form1" action="8.het.php" method="POST">
  11. <INPUT TYPE="text" name="user">
  12. <INPUT TYPE="text" name="pass">
  13. <INPUT TYPE="submit" name="add" value="Létrehoz">
  14. </FORM>';
  15. }
  16. if(isset($_POST['add'])){
  17. $sql='INSERT INTO `user` (`nev`, `jelszo`, `jog`) VALUES ("'.$_POST['user'].'", "'.$_POST['pass'].'", "0")';
  18. }
  19.  
  20.  
  21.  
  22.  
  23.  
  24. if(isset($_POST['submit'])){
  25.  
  26. $sql='SELECT nev as `user`, jelszo as `pass` FROM `user` WHERE nev="'.$_POST['user'].'= and jelszo="'.$_POST['pass'].'" ';
  27. $result(mysqli_query($link,$sql));
  28.  
  29. if(mysqli_num_rows($result)==1){
  30. $_SESSION['enter']=true;
  31. }
  32.  
  33.  
  34. }
  35. //hozzunk létre egy 2 dimenziós tömböt az adatbázisból
  36.  
  37. if(isset($_SESSION['enter'])&&$_SESSION['enter']){
  38. echo 'SIKERES BELÉPÉS<BR>';
  39. echo '<A href="?exit=on">KILÉPÉS</A><BR>';
  40. echo '<A HREF="?add=on">Létrehoz</A><BR>';
  41.  
  42. $sql='SELECT nev as `user`, jelszo as `pass` FROM `user`';
  43. $result=mysqli_query($link,$sql);
  44. while($row=mysqli_fetch_assoc($result)){
  45. echo $row['user'].' | '.$row['pass'].'<a href="?mod=on&user='.$row['user'].'"Módosítás</a><BR>';
  46. }
  47.  
  48. } else {
  49. echo '<FORM NAME="form1" action="8.het.php" method="POST">
  50. <INPUT TYPE="text" name="user">
  51. <INPUT TYPE="password" name="pass">
  52. <INPUT TYPE="submit" name="submit" value="BELEP">
  53. </FORM>';
  54. }
  55.  
  56. mysqli_close($link);
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement