Guest User

Untitled

a guest
Jan 18th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <?php
  2. $servername="localhost";
  3. $username="root";
  4. $password="";
  5. $dbname="test";
  6.  
  7. $db=mysqli_connect($servername,$username,$password,$dbname)or die(mysqli_error);
  8.  
  9. if(isset($_POST['autorization'])){
  10. $username=trim($_POST['username']);
  11. $password=trim($_POST['password']);
  12. $username=mysqli_real_escape_string($_POST['username']);
  13. $password=mysqli_real_escape_string($_POST['password']);
  14.  
  15. mysqli_query("SET NAMES'utf8'");
  16. mysqli_query("INSERT INTO `mydb`(`username`,`password`) VALUES('$username','$password')");
  17.  
  18. $reslult=mysqli_query();
  19. if($reslult== true){
  20. echo "message send";
  21. }
  22. }
  23. ?>
  24.  
  25. <form id="form" class="form" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
  26.  
  27. <input type="text" name="username" placeholder="username"required/>
  28. <input type="text" name="password" placeholder="Password" required/>
  29. <button type="submit" name="autorization">Log-In</button>
  30. </form>
  31. <?php echo $result;?>
Add Comment
Please, Sign In to add comment