-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvotingDone.php
More file actions
29 lines (29 loc) · 776 Bytes
/
votingDone.php
File metadata and controls
29 lines (29 loc) · 776 Bytes
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
<?php
session_start();
if(!$_SESSION['user']){
header('Location:voting_index.php');
die();
};
$servername='uopinstance.cisutjhhzfjh.us-west-2.rds.amazonaws.com';
$username='uopAdmin123';
$password='pandu123';
$database='voterdb';
$conn=new mysqli($servername,$username,$password,$database);
if($conn->connect_error){
session_destroy();
die('connection failed '.$conn->$connect_error);
}
$user = $_SESSION['user'];
$event_id = $_SESSION['event_id'];
$sql = "update event_details_".$event_id." set voted = true where username='".$user."'";
if ($conn->query($sql) === FALSE) {
echo "Error: " . $sql . "<br>" . $conn->error;
die();
}
else{
echo "Event Details updated into database<br/>";
}
session_destroy();
header('Location:voting_index.php');
die();
?>