-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
241 lines (226 loc) · 11.9 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<?php
include "includes/databaseConfig.php";
include "includes/functions.php";
if($_SERVER["REQUEST_METHOD"]=="POST"){
$ownerName = cleanData($_POST["ownerName"]);
$fhName = cleanData($_POST["fhName"]);
$stateName = cleanData($_POST["stateName"]);
$districtName = cleanData($_POST["districtName"]);
$villageName = cleanData($_POST["villageName"]);
$lcName = cleanData($_POST["lcName"]);
$tName = cleanData($_POST["tName"]);
$kNumbernew = cleanData($_POST["kNumbernew"]);
$kNumberold = cleanData($_POST["kNumberold"]);
$lClassify = cleanData($_POST["lClassify"]);
$tax = cleanData($_POST["tax"]);
$cyesno = cleanData($_POST["conyesno"]);
$lAddress = cleanData($_POST["lAddress"]);
if(empty($ownerName) or empty($fhName) or empty($villageName) or empty($lcName) or empty($tName) or empty($kNumbernew) or empty($kNumberold) or empty($lClassify) or empty($tax) or empty($lAddress)){
$errorMessage = "Enter all details";
}else{
$target_dir = "mapfileuploads/";
$target_file = $target_dir . basename($_FILES["mapfile"]["name"]);
$uploadOk = 1;
$mapFileType = pathinfo($target_file,PATHINFO_EXTENSION);
$mapFileSize = $_FILES["mapfile"]["size"];
if($mapFileType != "kml"){
$errorMessage = "Map file should be a KML file.";
}else{
if($mapFileSize == 0){
$errorMessage = "Map file should not be empty";
}else{
$sql = "INSERT INTO `registered_lands`(`ownername`, `fhname`,`state`,`district`,`vname`, `lcarea`, `taluka`, `newkhatanum`, `oldkhatanum`, `lclassify`, `tax`, `address`, `pathofmap`,`cyesno`) VALUES ('$ownerName','$fhName','$stateName','$districtName','$villageName','$lcName','$tName',$kNumbernew,$kNumberold,'$lClassify',$tax,'$lAddress','$target_file','$cyesno')";
if($conn->query($sql) === TRUE){
move_uploaded_file($_FILES["mapfile"]["tmp_name"], $target_file);
$successMessage = "Land Registered Successfully";
}else{
$errorMessage = "Error in registering !!";
}
}
}
}
}
?>
<html>
<head>
<title>Land Consolidation</title>
<meta name="description" content="Land Consolidation Software Home Page"/>
<link rel="stylesheet" href="css/main.css"/>
</head>
<body>
<div class="container">
<div class="row">
<div class="title-wrapper">
<h2>Land Registration</h2>
</div>
<hr/>
<?php include "includes/nav.php";?>
<form method="post" action="index.php" name="landRegForm" id="landRegForm" enctype="multipart/form-data">
<table>
<tbody>
<tr><td><p style="color:red;font-size: 11px;margin: 5px;">Enter all details here*</p></td></tr>
<tr><td><p style="color:red;font-size: 11px;margin: 5px;"><?php if(!empty($errorMessage)){echo $errorMessage;}?></p></td></tr>
<tr><td><p style="color:green;font-size: 11px;margin: 5px;"><?php if(!empty($successMessage)){echo $successMessage;}?></p></td></tr>
<tr>
<td>
<label for="ownerName">Land Owner's Name</label>
</td>
<td>
<input type="text" name="ownerName" placeholder="Enter Land Owner Name Here" id="ownerName"/>
</td>
</tr>
<tr>
<td>
<label for="fhName">Father's / Husband's Name</label>
</td>
<td>
<input type="text" name="fhName" placeholder="Enter Fathers or Husbands Name Here" id="fhName"/>
</td>
</tr>
<tr>
<td>
<label for="stateName">State Name</label>
</td>
<td>
<select name="stateName" id="stateName" onchange = "loadDistrict(this,1)">
</select>
</td>
</tr>
<tr>
<td>
<label for="districtName">District Name</label>
</td>
<td>
<select name="districtName" id="districtName">
</select>
</td>
</tr>
<tr>
<td>
<label for="villageName">Village Name</label>
</td>
<td>
<input type="text" name="villageName" placeholder="Enter village name here" id="villageName"/>
</td>
</tr>
<tr>
<td>
<label for="lcName">Land Control Area</label>
</td>
<td>
<input type="text" name="lcName" placeholder="Enter land control area here" id="lcName"/>
</td>
</tr>
<tr>
<td>
<label for="tName">Taluka</label>
</td>
<td>
<input type="text" name="tName" placeholder="Enter Taluka" id="tName"/>
</td>
</tr>
<tr>
<td>
<label for="kNumbernew">New Khata Number</label>
</td>
<td>
<input type="number" name="kNumbernew" placeholder="Enter new Khata Number" id="kNumbernew"/>
</td>
</tr>
<tr>
<td>
<label for="kNumberold">Old Khata Number</label>
</td>
<td>
<input type="number" name="kNumberold" placeholder="Enter old Khata Number" id="kNumberold"/>
</td>
</tr>
<tr>
<td>
<label for="lClassify">Land Classification</label>
</td>
<td>
<select name="lClassify" placeholder="Select land type" id="lClassify">
<option value="fertile">Fertile Land</option>
<option value="barren">Barren Land</option>
<option value="farm">Farm Land</option>
<option value="Sand">Sand Land</option>
</select>
</td>
</tr>
<!--
<tr>
<td>
<label for="lClassify">Land Classification</label>
</td>
<td>
<input type="text" name="lClassify" placeholder="Enter your land category" id="lClasssify"/>
</td>
</tr>
-->
<tr>
<td>
<label for="tax">Tax given by owner</label>
</td>
<td>
<input type="number" name="tax" placeholder="Enter the amount of tax" id="tax"/>
</td>
</tr>
<tr>
<td>
<label for="lAddress">Land owner's Address</label>
</td>
<td>
<textarea name="lAddress" placeholder="Enter address of land owner" id="lAddress"></textarea>
</td>
</tr>
<tr>
<td>
<label for="conyesno">Consolidable ?</label>
</td>
<td>
<span>Yes</span><input type="radio" name="conyesno" value = "yes" style="width: 10px;"/>
<span>No</span><input type="radio" name="conyesno" value = "no" style="width:10px;"/>
</td>
</tr>
<tr>
<td>
<label for="mapfile">Upload map file</label>
</td>
<td>
<input type="file" name="mapfile" id="mapfile" onchange="showMap(this);" required/>
</td>
</tr>
<tr>
<td colspan="2">
<p style="color:red;font-size: 11px;margin: 5px;">Map will be displayed here</p>
<div class="canvasContainer">
<canvas id="mapCanvas"></canvas>
</div>
</td>
</tr>
<tr>
<tr style="display: none;">
<td colspan="2">
<p style="color:red;font-size: 11px;margin: 5px;">Google Map will be displayed here</p>
<div class="mapContainer">
<img src='' id='gmap'/>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<button id="landRegSubmitFormButton">Submit Land Details</button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/@mapbox/togeojson/togeojson.js"></script>
<script src="js/xml2json.js"></script>
<script src="js/app.js"></script>
</body>
</html>