-
Notifications
You must be signed in to change notification settings - Fork 4
/
voterchecker.php
50 lines (37 loc) · 895 Bytes
/
voterchecker.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
<?php
session_start();
$host="localhost:3306";
$user="root";
$pass="";
$db="online_voting_system";
$conn=mysqli_connect($host,$user,$pass,$db);
$adharno=$_SESSION['adhar'];
$sql0="select * from votes where adharcard='$adharno' ";
$result0=mysqli_query($conn,$sql0);
if(mysqli_num_rows($result0)==1)
{
header('location:error.php');
}
else{
if(isset($_POST['btn1']))
{
$party="bjp";
}
elseif (isset($_POST['btn2']))
{
$party="congress";
}
elseif (isset($_POST['btn3']))
{
$party="jdu";
}
elseif (isset($_POST['btn4']))
{
$party="aap";
}
$sql="insert into votes values('$party','$adharno')";
$result=mysqli_query($conn,$sql);
header('location:thank-you.php');
}
session_destroy();
?>