Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>police</title>
- </head>
- <header>
- <div class="container">
- <div id="branding">
- <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>
- </div>
- </div>
- </header>
- <section id="main">
- <div class="container">
- <article id="main-col"></article>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <link rel="stylesheet" href="./css/style.css">
- <style>
- button{
- height:38px;
- background:#e8491d;
- border:0;
- padding-left: 20px;
- padding-right: 20px;
- color:#ffffff;
- margin-right: -190px;
- margin-top: 50px;
- display:inline-block;
- }
- label
- {
- margin-right: 15px;
- margin-top: 5px;
- display:inline-block;
- }
- </style>
- <body style="background-color:#bdc3c7;">
- <div id="main-wrapper">
- <center><h2>REGISTRATION FORM</h2></center>
- <form method="post" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>">
- <div class="inner_container">
- <center><label>Badge number</label>
- <input type="text" placeholder="Enter Badge number" name="badge_no" required> </center>
- <br>
- <center><label>Name</label>
- <input type="text" placeholder="Enter Name" name="name" required></center>
- <br>
- <center><label>Date Of Birth</label>
- <input type="date" placeholder ="Enter Date of Birth" name="dateofbirth" required></center>
- <br>
- <center><label>Jurisdiction</label>
- <input type="text" placeholder ="Enter Jurisdiction" name="jurisdiction" required></center>
- <br>
- <center><label>Username</label>
- <input type="text" placeholder ="Enter Username" name="username" required> </center>
- <br>
- <center><label>Password</label>
- <input type="password" placeholder="Enter Password" name="password" required> </center>
- <br>
- <center><label>Confirm Password</label>
- <input type="password" placeholder="Enter Password" name="cpassword" required> </center>
- <br>
- <center><button name="register" class="sign_up_btn" type="submit">Register</button> </center>
- <br>
- </div>
- </form>
- <?php
- $con=mysqli_connect("localhost","root","90293269","only");
- if(!$con){
- die('Could not connect: '.mysqli_error());
- }
- if(isset($_POST['register']))
- {
- $badge_no= $_POST['badge_no'];
- $officer_name= $_POST['name'];
- $officer_dob= $_POST['dateofbirth'];
- $jurisdiction= $_POST['jurisdiction'];
- $username= $_POST['username'];
- $opassword= $_POST ['password'];
- $ocpassword= $_POST['cpassword'];
- $password = hash('sha256', $opassword);
- $cpassword = hash('sha256', $ocpassword);
- if($password == $cpassword)
- {
- $q = "INSERT INTO officer (badge_no, officer_name, officer_dob, jurisdiction, username, password) VALUES ('$badge_no','$officer_name',$officer_dob,'$jurisdiction','$username','$password')";
- $query_run = mysqli_query($con,$q);
- if($query_run)
- {
- echo "I got here";
- echo "<script type='text/javascript'> alert('User Registered.. Welcome'); </script>";
- }
- else{
- echo "I didn't make it";
- echo "<script type='text/javascript'> alert('User not registered! :( '); </script>";
- }
- }
- else
- {
- echo "<script type='text/javascript'>alert('Password and Confirm Password do not match'); </script>";
- }
- }
- ?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement