Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'includes/backbone.php';
- $mainObj = new mainFinger;
- $mainObj->dbcon();
- include 'includes/header.php';
- ?>
- <div class="container">
- <div class="form">
- <h2>Sign In Here</h2>
- <form method="post" action="">
- <input type="username" name="username" placeholder="Username" required>
- <input type="password" name="password" placeholder="Password" required>
- <input type="submit" name="loginbtn" value="Log Me In">
- </form>
- </div>
- <?php include 'includes/footer.php'; ?>
- <?php
- require 'includes/backbone.php';
- $mainObj = new mainFinger;
- $mainObj->dbcon();
- include 'includes/header.php';
- ?>
- <div class="form up">
- <h2>Register Now</h2>
- <form method="post" action="">
- <input type="text" name="fullname" placeholder="Full Name" required>
- <input type="text" name="username" placeholder="User Name" required>
- <input type="email" name="email" placeholder="Email" required>
- <input type="password" name="password" placeholder="Password" required>
- <input type="password" name="confirmpass" placeholder="Confirm Password" required>
- <input type="submit" name="registerbtn" value="Register Me">
- <?php $mainObj->registerUser(); ?>
- </form>
- </div>
- </div>
- <?php include 'includes/footer.php'; ?>
- <?php
- class mainFinger{
- public $dbHost, $dbUsername, $dbPass, $dbName, $conString, $query;
- public $fullname, $username, $email, $password, $confirmpass, $datenow;
- function dbcon(){
- $this->dbHost = "localhost";
- $this->dbUsername = "root";
- $this->dbPass = "";
- $this->dbName = "welcome";
- $this->conString = mysqli_connect($this->dbHost, $this->dbUsername, $this->dbPass, $this->dbName);
- if(!$this->conString){
- echo '<h1> connection to database not successful. </h1>';
- }
- }
- function registerUser(){
- if (isset($_POST['registerbtn'])){
- $this->fullname = $_POST['fullname'];
- $this->username = $_POST['username'];
- $this->email = $_POST['email'];
- $this->password = $_POST['password'];
- $this->confirmpass = $_POST['confirmpass'];
- $this->datenow = date("Y m d h:i:s");
- if (empty($this->fullname && $this->username && $this->email && $this->password)){
- echo '<div class ="error"> All Fields are required. </div> ';
- }elseif ($this->password != $this->confirmpass) {
- echo '<div class ="error"> Password Mismatch</div>';
- }else{
- $this->query = "INSERT INTO `welcome` (`fullname`,`username`,`email`,`password`,`reg_date`)
- values ('$this->fullname','$this->username','$this->email','$this->password','$this->datenow')";
- if ($this->result = mysqli_query($this->conString, $this->query)){
- echo "User Creation is successfull";
- }
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement