Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang"en">
- <body>
- <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 action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
- <div class="inner_container">
- <center><label>Badge number</label>
- <input type="text" placeholder="Enter Badge number" name="badge_no" required></br></center>
- </br>
- <center><label>Name</label>
- <input type="text" placeholder="Enter Name" name="name" required></br></center>
- </br>
- <center><label>Date Of Birth</label>
- <input type="date" placeholder ="Enter Date of Birth" name="dateofbirth" required></br></center>
- </br>
- <center><label>Jurisdiction</label>
- <input type="text" placeholder ="Enter Jurisdiction" name="jurisdiction" required></br></center>
- </br>
- <center><label>Username</label>
- <input type="text" placeholder ="Enter Username" name="username" required></br></center>
- </br>
- <center><label>Password</label>
- <input type="password" placeholder="Enter Password" name="password" required></br></center>
- </br>
- <center><label>Confirm Password</label>
- <input type="password" placeholder="Enter Password" name="cpassword" required></br></center>
- </br>
- <center><button name="register" class="sign_up_btn" type="submit">Register</button></br></center>
- </br>
- <a href="loginPolice.php"><button type="button" class="back_btn"><< Back to Login</button></a></br>
- </div>
- </form>
- <?php
- $con=mysqli_connect("localhost","root","90293269","crime_recording_system");
- 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', $_POST ['password']);
- $cpassword = hash('sha256', $_POST ['cpassword']);
- if($password==$cpassword)
- {
- $query = "SELECT * from `login` WHERE `username`='$username'";
- $query_run = mysqli_query($con,$query);
- if(mysqli_num_rows($query_run)>0)
- {
- echo '<script type="text/javascript">alert("This Username Already exists.. Please try another username!")</script>';
- }
- else
- {
- $query = "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,$query);
- if($query_run)
- {
- echo '<script type="text/javascript">alert("User Registered.. Welcome")</script>';
- }
- else
- {
- echo '<script type="text/javascript"> alert("Error..")</script>';
- }
- }
- }
- else
- {
- echo '<script type="text/javascript">alert("Password and Confirm Password do not match")</script>';
- }
- }
- else
- {
- }
- ?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement