-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomer.php
90 lines (75 loc) · 2.67 KB
/
customer.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
<?php
session_start();
?>
<?php
if(empty($_SESSION['username'])){
header("Location: welcome.php?errNum=3");
exit();
}
?>
<!DOCTYPE HTML>
<html>
<head>
<link rel=stylesheet type="text/css" href="customer.css">
<meta charset="utf-8">
<title>Vote Center</title>
</head>
<body>
<form action="" method="post">
<table border="0" height="680" width=100% class="image3"
style="border-radius:10px;" cellpadding="0">
<tbody align="center" width="50%">
<tr><td>
<table width=40% border="0" style="border-radius:10px;">
<tr>
<td colspan="2" align="center" class="border"> VOTE CENTER </td>
</tr>
<?php
$co=new mysqli("localhost","root","24133571ccA");
if($co->connect_error){
die("Connection Fail ".$co->connect_error);
}
$SQL="SELECT * FROM ku.options;";
$RES=mysqli_query($co,$SQL);
while($things = mysqli_fetch_assoc($RES)){
?>
<tr colspan="2" class="fonte" >
<td bgcolor="#FBEFFB" colspan="2" style="border-radius:7px;"><input type="radio" name="item" value="<?php echo $things["id"]?>" />
<?php echo $things["option"]?></td>
</tr>
<?php } ?>
<?php
if(isset($_POST["sub"])){
//if($_SESSION["vote"]==session_id()){
?>
<script language="javascript">
// alert("You have already voted.");
//location.href="welcome.php";
</script>
<?php
// }
//else{
$id = $_POST["item"];
$sqll = "UPDATE `ku`.`options` SET `number`=`number`+1 WHERE `id`='$id';";
mysqli_query($co,$sqll);
session_destroy();
?>
<script language="javascript">
location.href="welcome.php";
</script>
<?php
//}
}
?>
<tr>
<td width="42%" align="right"> <input type="submit" name="sub" value="Vote" style="font-size:20px;font-family:serif;text-align: center;"/>
</td>
<td width="58%"><input type="submit" name="view" value="View Results" style="font-size:20px;font-family:serif;text-align: center;"/></td>
</tr>
</table>
</td></tr>
</tbody>
</table>
</form>
</body>
</html>