Advertisement
Biciklee

hmm

Dec 5th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.53 KB | None | 0 0
  1. //dbc.php
  2. <?php
  3. class Connection{
  4.  
  5.     private $servername = "localhost", $username = "root", $password = "", $dbname = "sbhotel";
  6.     protected $conn = "", $row = "", $result = "", $sql = "", $validator=false;
  7.  
  8.     function __construct(){
  9.         $this->conn = new mysqli($this->servername, $this->username, $this->password, $this->dbname);
  10.     }
  11.  
  12.     function __destruct(){
  13.         $this->conn->close();
  14.     }
  15. }
  16.  
  17. $db = new Connection();
  18.  
  19. ?>
  20. //sigUp.php
  21. <?php
  22. include_once($_SERVER['DOCUMENT_ROOT']."\sbhotel\components\php\connection\dbc.php");
  23.  
  24. class SignUp extends Connection{
  25.  
  26.     protected $userName = $_POST['userName'];
  27.     protected $password = $_POST['password'];
  28.     protected $passwordVerification = $_POST['passwordVerification'];
  29.     protected $email= $_POST['email'];
  30.  
  31.     protected function __construct($userName, $password, $passwordVerification, $email) {
  32.         $this->conn->real_escape_string($userName) = $userName;
  33.         $this->conn->real_escape_string($password) = $password;
  34.         $this->conn->real_escape_string($passwordVerification) = $passwordVerification;
  35.         $this->conn->real_escape_string($email) = $email;
  36.  
  37.     }
  38.    
  39.     public function SignUpInputEmpty() {
  40.          if (empty($this->userName) or empty($this->password) or empty($this->passwordVerification) or empty($this->email)) {
  41.             echo "empty";
  42.             //validator=false;
  43.          }
  44.          else {
  45.             echo "set";
  46.             //validator=true;
  47.          }
  48.         }
  49. }
  50. $me = new SignUp();
  51.     echo $me->SignUpInputEmpty();
  52. ?>
  53. //modal elem ahol használnám
  54.  
  55. <div class="modal fade" id="modalSign" tabindex="-1" role="dialog" aria-labelledby="modalLabel" aria-hidden="true">
  56.     <div class="modal-dialog" role="document">
  57.         <div class="modal-content">
  58.             <div class="modal-header">
  59.                 <h5 class="modal-title" id="modalLabel">Regisztráció</h5>
  60.                 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  61.                     <span aria-hidden="true">&times;</span>
  62.                 </button>
  63.             </div>
  64.             <form method="post">
  65.                 <div class="modal-body mx-3">
  66.                     <div class="md-form mb-2">
  67.                         <label for="userName">Felhasználónév:*</label>
  68.                         <input type="text" class="form-control" name="userName" placeholder="Felhasználónév">
  69.                     </div>
  70.                     <div class="md-form mb-2">
  71.                         <label for="password">Jelszó:*</label>
  72.                         <input type="password" class="form-control" name="password" placeholder="Jelszó">
  73.                     </div>
  74.                     <div class="md-form mb-2">
  75.                         <label for="passwordVerification">Jelszó megerősítése:*</label>
  76.                         <input type="password" class="form-control" name="passwordVerification" placeholder="Jelszó megerősítése">
  77.                     </div>
  78.                     <div class="md-form mb-2">
  79.                         <label for="email">Email:*</label>
  80.                         <input type="email" class="form-control" name="email" placeholder="Pelda@pelda.hu">
  81.                     </div>
  82.                 </div>
  83.                 <div class="modal-footer">
  84.                     <input type="hidden" name="action" value="signUp">
  85.                     <input type="submit" name="signUpButton" value="Regisztráció" class="btn btn-primary">
  86.                     <button type="button" class="btn btn-secondary" data-dismiss="modal">Mégse</button>
  87.                 </div>
  88.             </form>
  89.         </div>
  90.     </div>
  91. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement