Advertisement
Guest User

Untitled

a guest
Mar 10th, 2019
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.83 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <body>
  4. <header>
  5.     <div class="container">
  6.         <div id="branding">
  7.         <h1><img src="Kenya_Police_Flag.png" style="width:120px;height:90px;"/><span class="highlight"> CRIME RECORDING SYSTEM <img src="kenyalo.png" style="width:110px;height:90px; float:right; padding-left:180px;"></h1>
  8.         </div>
  9.        
  10.     </div>
  11. </header>  
  12.         <section id="main">
  13.             <div class="container">
  14.                 <article id="main-col"></article>
  15.                    
  16.  
  17. <meta charset="utf-8">
  18. <meta name="viewport" content="width=device-width">
  19. <link rel="stylesheet" href="./css/style.css">
  20.  
  21. <style>
  22. button{
  23. height:38px;
  24.     background:#e8491d;
  25.     border:0;
  26.     padding-left: 20px;
  27.     padding-right: 20px;
  28.     color:#ffffff;
  29.     margin-right: -190px;
  30.     margin-top: 50px;
  31.     display:inline-block;
  32.   }
  33. label
  34. {
  35.  margin-right: 15px;
  36.  margin-top: 5px;
  37.  display:inline-block;
  38. }
  39. </style>
  40.  
  41. <body style="background-color:#bdc3c7;">
  42.     <div id="main-wrapper">
  43.     <center><h2>REGISTRATION FORM</h2></center>
  44.  
  45.         <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="POST">
  46.            
  47.             <div class="inner_container">
  48.                 <center><label>Badge number</label>
  49.                 <input type="text" placeholder="Enter Badge number" name="badge_no" required></br></center>
  50.                 </br>
  51.                
  52.                 <center><label>Name</label>
  53.                 <input type="text" placeholder="Enter Name" name="name" required></br></center>
  54.                 </br>
  55.                
  56.                 <center><label>Date Of Birth</label>
  57.                 <input type="date" placeholder ="Enter Date of Birth" name="dateofbirth" required></br></center>
  58.                 </br>
  59.                
  60.                 <center><label>Jurisdiction</label>
  61.                 <input type="text" placeholder ="Enter Jurisdiction" name="jurisdiction" required></br></center>
  62.                 </br>
  63.                
  64.                 <center><label>Username</label>
  65.                 <input type="text" placeholder ="Enter Username" name="username" required></br></center>
  66.                 </br>
  67.                
  68.                 <center><label>Password</label>
  69.                 <input type="password" placeholder="Enter Password" name="password" required></br></center>
  70.                 </br>
  71.                
  72.                 <center><label>Confirm Password</label>
  73.                 <input type="password" placeholder="Enter Password" name="cpassword" required></br></center>
  74.                 </br>
  75.                
  76.                 <center><button name="register" class="sign_up_btn" type="submit">Register</button></br></center>
  77.                 </br>
  78.                
  79.                 <a href="loginPolice.php"><button type="button" class="back_btn"><< Back to Login</button></a></br>
  80.             </div>
  81.         </form>
  82. <?php
  83.  
  84.  $con=mysqli_connect("localhost","root","90293269","othercrime");
  85.   if(!$con){
  86.     die('Could not connect: '.mysqli_error());
  87.   }
  88.   else{
  89.   if(isset($_POST['register']))
  90.             {
  91.                
  92.                 $badge_no= $_POST['badge_no'];
  93.                 $officer_name= $_POST['name'];
  94.                 $officer_dob= $_POST['dateofbirth'];
  95.                 $jurisdiction= $_POST['jurisdiction'];  
  96.                 $username= $_POST['username'];
  97.                 $opassword= $_POST ['password'];
  98.                 $ocpassword= $_POST['cpassword'];
  99.                
  100.                 $password = hash('sha256', $opassword);
  101.                 $cpassword = hash('sha256', $ocpassword);
  102.                
  103.                 if($password == $cpassword)
  104.                 {          
  105.                            
  106.                             $query = "INSERT INTO officer (badge_no, officer_name, officer_dob, jurisdiction,username,password) VALUES ('$badge_no','$officer_name','$officer_dob','$jurisdiction','$username''$password')";
  107.                             $query_run = mysqli_query($con, $query);
  108.                            
  109.                            
  110.                             if($query_run)
  111.                             {
  112.                                 echo "I got here";
  113.                                 echo "<script type='text/javascript'>  alert('User Registered.. Welcome'); </script>";
  114.                             }
  115.                             else{
  116.                                 echo "I didn't make it";
  117.                                 echo "<script type='text/javascript'> alert('User not registered! :( '); </script>";
  118.                                         }
  119.                          
  120.                 }
  121.                 else
  122.                 {
  123.                     echo "<script type='text/javascript'>alert('Password and Confirm Password do not match'); </script>";
  124.                 }    
  125.                    
  126.             }
  127.         }
  128.         ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement