fork download
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>police station log </title>
  5.  
  6. <link rel="stylesheet" type="text/css" href="https://m...content-available-to-author-only...n.com/bootstrap/3.3.5/css/bootstrap.min.css">
  7.  
  8. <link rel="stylesheet" type="text/css" href="https://m...content-available-to-author-only...n.com/font-awesome/4.4.0/css/font-awesome.min.css">
  9.  
  10. <link href="http://f...content-available-to-author-only...s.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">
  11.  
  12. <link href="complainer_page.css" rel="stylesheet" type="text/css" media="all" />
  13. <?php
  14. if(!isset($_SESSION['x']))
  15. header("location:headlogin.php");
  16. if(isset($_POST['s'])){
  17. $con=mysqli_connect('localhost','root','','crime_portal');
  18. if(!$con)
  19. {
  20. die('could not connect: '.mysqli_error());
  21. }
  22. if($_SERVER["REQUEST_METHOD"]=="POST"){
  23. $loc=$_POST['location'];
  24. $i_name=$_POST['incharge_name'];
  25. $i_id=$_POST['incharge_id'];
  26. $u_pass=$_POST['password'];
  27.  
  28. $reg="insert into police_station values('$i_id','$i_name','$loc','$u_pass')";
  29. mysqli_select_db("crime_portal");
  30. $res=mysqli_query($con,$reg);
  31. if(!$res)
  32. {
  33. $message1 = "User Already Exist";
  34. echo "<script type='text/javascript'>alert('$message1');</script>";
  35. }
  36.  
  37. else
  38. {
  39. $message = "Police Station Added Successfully";
  40. echo "<script type='text/javascript'>alert('$message');</script>";
  41. }
  42. }
  43. }
  44. ?>
  45. <script>
  46. function f1()
  47. {
  48. var sta=document.getElementById("station").value;
  49. var sta1=document.getElementById("iname").value;
  50. var sta2=document.getElementById("iid").value;
  51. var sta3=document.getElementById("pas").value;
  52. var x=sta.trim();
  53. var x2=sta2.indexOf(' ');
  54. var x1=sta1.trim();
  55. var x3=sta3.indexOf(' ');
  56. if(sta!="" && x==""){
  57. document.getElementById("station").value="";
  58. document.getElementById("station").focus();
  59. alert("Space Not Allowed");
  60. }
  61.  
  62. else if(sta1!="" && x1==""){
  63. document.getElementById("iname").value="";
  64. document.getElementById("iname").focus();
  65. alert("Space Not Allowed");
  66. }
  67. else if(sta2!="" && x2>=0){
  68. document.getElementById("iid").value="";
  69. document.getElementById("iid").focus();
  70. alert("Space Not Allowed");
  71. }
  72. else if(sta3!="" && x3>=0){
  73. document.getElementById("pas").value="";
  74. document.getElementById("pas").focus();
  75. alert("Space Not Allowed");
  76. }
  77. }
  78. </script>
  79. </head>
  80.  
  81. <body style="background-size: cover;
  82. background-image: url(home_bg1.jpeg);
  83. background-position: center;">
  84. <nav class="navbar navbar-default navbar-fixed-top">
  85. <div class="container">
  86. <div class="navbar-header">
  87. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
  88. <span class="sr-only">Toggle navigation</span>
  89. <span class="icon-bar"></span>
  90. <span class="icon-bar"></span>
  91. <span class="icon-bar"></span>
  92. </button>
  93. <a class="navbar-brand" href="home.php"><b>Home</b></a>
  94. </div>
  95. <div id="navbar" class="collapse navbar-collapse">
  96. <ul class="nav navbar-nav">
  97. <li ><a href="official_login.php">HQ Login</a></li>
  98. <li><a href="headHome.php">HQ Home</a></li>
  99. </ul>
  100.  
  101. <ul class="nav navbar-nav navbar-right">
  102. <li class="active"><a href="police_station_add.php">Log Police Station</a></li>
  103. <li> <a href="h_logout.php">Logout &nbsp <i class="fa fa-sign-out" aria-hidden="true"></i></a></li>
  104. </ul>
  105. </div>
  106. </div>
  107. </nav>
  108. <div class="video" style="margin-top: 5%">
  109. <div class="center-container">
  110. <div class="bg-agile">
  111. <br><br>
  112. <div class="login-form"><p>
  113. <h2>Log Police Station</h2><br>
  114. <form method="post" style="color: gray">Police Station Location
  115. <input type="text" name="location" placeholder="Station Location" required="" id="station" onfocusout="f1()"/>
  116. Incharge Name
  117. <input type="text" name="incharge_name" placeholder="Incharge Name" required="" id="iname" onfocusout="f1()"/>
  118. Incharge Id<input type="text" name="incharge_id" placeholder="Incharge Id" required="" id="iid" onfocusout="f1()"/>
  119. <br>
  120. Password<input type="text" name="password" placeholder="Password" required="" id="pas" onfocusout="f1()"/>
  121. <input type="submit" value="Submit" name="s">
  122. </form>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. <script type="text/javascript" src="https://c...content-available-to-author-only...y.com/jquery-2.1.4.js"></script>
  128. <script type="text/javascript" src="https://m...content-available-to-author-only...n.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  129. </body>
  130. </html>
Success #stdin #stdout #stderr 0.02s 25932KB
stdin
Standard input is empty
stdout
<!DOCTYPE html>
<html>
<head>
	<title>police station log </title>

	<link rel="stylesheet" type="text/css" href="https://m...content-available-to-author-only...n.com/bootstrap/3.3.5/css/bootstrap.min.css">

	<link rel="stylesheet" type="text/css" href="https://m...content-available-to-author-only...n.com/font-awesome/4.4.0/css/font-awesome.min.css">

	<link href="http://f...content-available-to-author-only...s.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">

	<link href="complainer_page.css" rel="stylesheet" type="text/css" media="all" />
	<script>
     function f1()
        {
         var sta=document.getElementById("station").value;
         var sta1=document.getElementById("iname").value;
         var sta2=document.getElementById("iid").value;
         var sta3=document.getElementById("pas").value;
         var x=sta.trim();
         var x2=sta2.indexOf(' ');
         var x1=sta1.trim();
         var x3=sta3.indexOf(' ');
 if(sta!="" && x==""){
    document.getElementById("station").value="";
    document.getElementById("station").focus();
      alert("Space Not Allowed");
        }
        
         else if(sta1!="" && x1==""){
    document.getElementById("iname").value="";
    document.getElementById("iname").focus();
      alert("Space Not Allowed");
        }
        else if(sta2!="" && x2>=0){
    document.getElementById("iid").value="";
    document.getElementById("iid").focus();
      alert("Space Not Allowed");
        }
        else if(sta3!="" && x3>=0){
    document.getElementById("pas").value="";
    document.getElementById("pas").focus();
      alert("Space Not Allowed");
        }
      }
</script>
</head>

<body style="background-size: cover;
    background-image: url(home_bg1.jpeg);
    background-position: center;">
	<nav  class="navbar navbar-default navbar-fixed-top">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="home.php"><b>Home</b></a>
    </div>
    <div id="navbar" class="collapse navbar-collapse">
      <ul class="nav navbar-nav">
        <li ><a href="official_login.php">HQ Login</a></li>
        <li><a href="headHome.php">HQ Home</a></li>
      </ul>
     
      <ul class="nav navbar-nav navbar-right">
        <li class="active"><a href="police_station_add.php">Log Police Station</a></li>
      <li> <a href="h_logout.php">Logout &nbsp <i class="fa fa-sign-out" aria-hidden="true"></i></a></li>
      </ul>
    </div>
  </div>
 </nav>
<div class="video" style="margin-top: 5%"> 
	<div class="center-container">
		 <div class="bg-agile">
			<br><br>
			<div class="login-form"><p>
                <h2>Log Police Station</h2><br>
      <form  method="post" style="color: gray">Police Station Location
          <input type="text"  name="location" placeholder="Station Location" required="" id="station" onfocusout="f1()"/>
      Incharge Name
					<input type="text"  name="incharge_name" placeholder="Incharge Name" required="" id="iname" onfocusout="f1()"/>
					Incharge Id<input type="text"  name="incharge_id" placeholder="Incharge Id" required="" id="iid" onfocusout="f1()"/>
					<br>
					Password<input type="text"  name="password" placeholder="Password" required="" id="pas" onfocusout="f1()"/>
					<input type="submit" value="Submit" name="s">
				</form>	
			</div>	
		</div>
	</div>	
</div>	
 <script type="text/javascript" src="https://c...content-available-to-author-only...y.com/jquery-2.1.4.js"></script>
 <script type="text/javascript" src="https://m...content-available-to-author-only...n.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</body>
</html>
stderr
PHP Warning:  session_start(): Cannot start session when headers already sent in /home/LTgqqg/prog.php on line 14
PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/LTgqqg/prog.php:1) in /home/LTgqqg/prog.php on line 16