Advertisement
Guest User

Untitled

a guest
Aug 26th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <form method="POST" action="">
  2. <input type="hidden" name="form_type" value="register" />
  3. <input type="text" name="nick value="" placeholder="nick..." /> <br/>
  4. <input type="password" name="password" value="" placeholder="haslo..." /> <br/>
  5. <input type="text" name="user_email" value="" placeholder="e-mail..." /> <br/>
  6. <input type="submit" value="Rejstruj" />
  7. <br/>
  8. <br/>
  9. <a href = "http://blackspot.c0.pl/login.php">Login<a/>
  10. </form>
  11.  
  12. <?php
  13.  
  14. $servername = 'mysql.cba.pl';
  15. $username = 'blackspot';
  16. $password = 'BlackSpot123';
  17. $dbname = 'blackspot_db';
  18.  
  19.  
  20.  
  21. if ($_SERVER['REQUEST_METHOD'] === 'POST') {
  22.  
  23. $nick = trim(strip_tags($_POST['nick']));
  24. $password1 = trim(strip_tags($_POST['password']));
  25. $email = trim(strip_tags($_POST['email']));
  26.  
  27.  
  28. $conn = new msqli($servername, $username, $password,$dbname);
  29.  
  30. // Check connection
  31. if ($conn->connect_error) {
  32. die("Connection failed: " . $conn->connect_error);
  33. }
  34.  
  35. $sql = "INSERT INTO blackspot_db (login, pass, email) VALUES ('".$nick."', '".$email."', '".$password."')";
  36. if ($conn->query($sql) === TRUE) {
  37. $result = array('status' => 1, 'msg' => "Success");
  38. } else {
  39. $result = array('status' => 0, 'msg' => $conn->error);
  40.  
  41. }
  42.  
  43. echo json_encode($result);
  44. $conn->close();
  45. die;
  46. }
  47.  
  48.  
  49.  
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement