├── logout.php ├── adminLogout.php ├── index.php ├── update.php ├── loginSubmit.php ├── voteCaste.php ├── registerCandidateScript.php ├── registerVoterScript.php ├── about.php ├── master.css ├── voterLogin.php ├── registerCandidate.php ├── vote.php ├── adminLogin.php ├── registerVoter.php ├── README.md ├── result.php ├── dashboard.php └── studentvote.sql /logout.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /adminLogout.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Student Voting Campaign Management 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Student Election System

12 |
13 |
14 |

Voter Registration

15 |

Voter Login

16 |
17 |

Candidate Registration

18 |
19 |

Admin Login


20 |

About

21 |
22 |
23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /update.php: -------------------------------------------------------------------------------- 1 |

Student Election System

'; 5 | echo '

Your details has successfully been Updated.

'; 6 | 7 | $name2 = $_POST["name2"]; 8 | $email3 = $_POST["email3"]; 9 | $pass2 = $_POST["pass2"]; 10 | echo "Name : $name2
"; 11 | //echo "Student ID : $
"; 12 | echo "Student ID : $email3
"; 13 | echo "Password : ****** (Not shown for security reasons)

"; 14 | $update_query = "UPDATE users SET name='$name2', pass_word='$pass2' WHERE studentId='$email3'"; 15 | $update_submit = mysqli_query($con, $update_query) or die(mysqli_error($con)); 16 | //echo '
Email: '.$email3; 17 | //} 18 | ?> 19 | 20 | -------------------------------------------------------------------------------- /loginSubmit.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | -------------------------------------------------------------------------------- /voteCaste.php: -------------------------------------------------------------------------------- 1 |

Student Election System

'; 7 | echo "
"; 8 | ECHO "Your vote was successfully recorded.
"; 9 | $cand_id=$_POST['chosen_candidate']; 10 | echo "voted to candidate with id= ".$cand_id; 11 | 12 | echo "
"; 13 | $sql1 = "update users set voted='1' where id='$vid'"; 14 | $query1_result = mysqli_query( $conn, $sql1) or die(mysqli_error($conn)); 15 | //echo "Done.
"; 16 | 17 | $sql2 = "update candidate set voteCount = voteCount+1 where id='$cand_id' "; 18 | $query2_result = mysqli_query( $conn, $sql2) or die(mysqli_error($conn)); 19 | //echo "
All Set.
"; 20 | ?> 21 |

Goto Dashboard

22 |

LOGOUT

23 | 24 | 25 | -------------------------------------------------------------------------------- /registerCandidateScript.php: -------------------------------------------------------------------------------- 1 | 4 | 5 |

Student Election System

'; 9 | echo '

Your details has successfully been recorded

'; 10 | // if(isset($_POST['submitIns'])){ 11 | echo "

"."Your details are:
"; 12 | $name = $_POST["name"]; 13 | $email = $_POST["email"]; 14 | 15 | $phone = $_POST["contact"]; 16 | echo "Name : $name
"; 17 | echo "Email : $email
"; 18 | echo "Contact : $phone
"; 19 | echo "
"; 20 | 21 | $insert_query = "insert into candidate(name, email, contact) VALUES('$name','$email','$phone')"; 22 | $insert_submit= mysqli_query($con, $insert_query) or die(mysqli_error($con)); 23 | //} elseif (isset($_POST['submit'])) { 24 | //} 25 | ?> 26 | 32 |
33 | Home 34 |
35 | 36 | -------------------------------------------------------------------------------- /registerVoterScript.php: -------------------------------------------------------------------------------- 1 |

Student Election System

'; 5 | echo '

Your details has successfully been recorded

'; 6 | // if(isset($_POST['submitIns'])){ 7 | echo "

"."Your details are:
"; 8 | $name = $_POST["name"]; 9 | $email = $_POST["sid"]; 10 | $pass = $_POST["pass"]; 11 | $phone = $_POST["contact"]; 12 | echo "Name : $name
"; 13 | echo "Email : $email
"; 14 | echo "Contact : $phone
"; 15 | echo "Password : ******

"; 16 | 17 | $insert_query = "insert into users( name, studentId, pass_word, mobileNumber) VALUES('$name','$email','$pass','$phone')"; 18 | $insert_submit= mysqli_query($con, $insert_query) or die(mysqli_error($con)); 19 | //} elseif (isset($_POST['submit'])) { 20 | //} 21 | ?> 22 | 28 |
29 | Home 30 |
31 | 32 | 33 | -------------------------------------------------------------------------------- /about.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | About |SES 5 | 6 | 7 | 18 | 19 | 20 |

Student Election System

21 |
22 | Student Election System is a online election system, which can be used for normal class election processes. For example, election of a 23 | class Representative, Student secretary, and other posts. 24 |

When it comes to Voting by students, this platform will serve the better way. First you have to have a admin account.There can only be one admin account, and it has superuser access to database. Next, all the voters have to first register in the forum and then he/she can cast vote. One can cast only one vote, identified by user's unique ID/ student ID.

25 |

So use it for your real life purposes, and have fun.

26 |

Site wide look and feel can be changed in master.css

27 |

Admin username and password is 'admin'.

28 |
29 |
30 |

Back

31 | 32 | 33 | -------------------------------------------------------------------------------- /master.css: -------------------------------------------------------------------------------- 1 | 2 | * { 3 | background: #1c1c1c; 4 | font-family: "Secular One", serif; 5 | color: #fff; 6 | } 7 | .parent{ 8 | text-align: center; 9 | } 10 | .container{ 11 | border:5px solid #343434; 12 | display: inline-block; 13 | 14 | padding-left: 6%; 15 | padding-right: 6%; 16 | margin: 0 auto; 17 | 18 | } 19 | h1 { 20 | text-align: center; 21 | font-size: 36px; 22 | font-family: "Secular One", serif; 23 | color: aqua; 24 | } 25 | 26 | a.gradient { 27 | color: #65b8a6; 28 | color: #fff; 29 | text-decoration: none; 30 | } 31 | 32 | a.gradient:focus, 33 | a.gradient:hover { 34 | background: -webkit-gradient( 35 | linear, 36 | left top, 37 | right top, 38 | from(#62a07b), 39 | to(#4f8b89) 40 | ); 41 | background: linear-gradient(to right, #62a07b, #4f8b89); 42 | -webkit-background-clip: text; 43 | -webkit-text-fill-color: transparent; 44 | -webkit-box-decoration-break: clone; 45 | box-decoration-break: clone; 46 | text-shadow: none; 47 | } 48 | a.underline { 49 | color: #fff; 50 | } 51 | a.underline { 52 | position: relative; 53 | transition: background-color 0.5s ease; 54 | -webkit-transition: background-color 0.5s ease; 55 | color: #fff; 56 | z-index: 1; 57 | white-space: nowrap; 58 | } 59 | a.underline:hover { 60 | background: #613860; 61 | } 62 | a.underline:after { 63 | content: ""; 64 | width: 100%; 65 | height: 4px; 66 | background: #613860; 67 | position: absolute; 68 | bottom: -4px; 69 | left: 0; 70 | z-index: -1; -------------------------------------------------------------------------------- /voterLogin.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 31 | 37 |
38 |

Student Election System

39 | 40 |

A Student Election Campaign Management Portal. Voting Made Easy.

41 |
42 |

43 |

44 | 45 | 46 | 47 |

Voter Login Form

48 | 49 |
50 | 51 |
52 |
53 | 54 | 55 | 56 | 57 | 58 | 59 |

60 | 61 | New User? Register 62 |
63 |
64 | 65 | 66 |
-------------------------------------------------------------------------------- /registerCandidate.php: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 27 | 28 | 29 | 30 | 31 |
32 |

Student Election System

33 |

Candidate Registration Portal

34 |

Goto HOME

35 |
36 |

New Candidate's Details

37 |
38 | 39 | 40 |
41 | 42 |
43 | 44 |
45 | 46 |
47 |
48 | 49 |
50 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /vote.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | Student Election System "; 14 | echo"

Please vote your candidate.

"; 15 | echo "

Registed Candidates are:

"; 16 | // Create connection 17 | $conn = new mysqli($servername, $username, $password, $dbname); 18 | // Check connection 19 | if ($conn->connect_error) { 20 | die("Connection failed: " . $conn->connect_error); 21 | } 22 | 23 | $sql = "SELECT id, name, email FROM candidate"; 24 | $result = $conn->query($sql); 25 | 26 | ?> 27 |
28 | 29 | num_rows > 0) { 31 | // output data of each row 32 | while($row = $result->fetch_assoc()) { 33 | echo ""; 37 | } 38 | } else { 39 | echo "0 results"; 40 | } 41 | 42 | $conn->close(); 43 | ?> 44 |
45 | 46 |
47 | 64 | 65 | -------------------------------------------------------------------------------- /adminLogin.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | Admin Login 12 | 41 | 42 | 43 | 44 | 45 |

Student Election System

46 |
47 |

Login to Admin Panel

48 |
49 | 50 |
51 | 52 |
53 | 54 |
55 | 56 |
57 |

Go to Home

58 | 59 | 60 | 61 | alert('login Successful')"; 66 | $_SESSION['adminLoggedin']="ok"; 67 | header("location: result.php"); 68 | }else{ 69 | echo ""; 70 | } 71 | } 72 | ?> -------------------------------------------------------------------------------- /registerVoter.php: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | Home | Student Voting System 11 | 12 | 28 | 29 | 30 | 31 |
32 |

Student Election System

33 |

New User Registration

34 |

Goto HOME

35 |
36 |

New Record Insertion

37 |
38 | 39 | 40 |
41 | 42 |
43 | 44 |
45 | 46 |
47 | 48 |
49 |
50 | 51 |
52 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Student-Election-System 2 | 7 |

You can see its live demo deployed here

8 | 9 | ## Roles: 10 | 15 | 16 | ## Functioning 17 | 23 | 24 | 25 | ## Tools required 26 | 29 | 30 | ## Steps 31 | 38 | 39 | P.S.: If you fork, please don't forget to star the repo. Thank you. 40 | 41 | -------------------------------------------------------------------------------- /result.php: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 |

Student Election System

15 | Voting Result"; 23 | echo "
Total Number of candidates: ".$totalRows."
"; 24 | 25 | //finding total casted vote 26 | $sum2=0; 27 | while ($row2 = mysqli_fetch_assoc($result)){ 28 | $sum2 += $row2['voteCount']; 29 | } 30 | 31 | echo "
Total Number of casted vote till Now: $sum2


"; 32 | 33 | // set the pointer back to the beginning 34 | mysqli_data_seek($result, 0); 35 | ?> 36 | 37 | 38 | 39 | 40 | 0){ 42 | while($row = mysqli_fetch_array($result)){ 43 | ?> 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 65 | 66 |
ID Name Email Total Votes (casted) Vote Percentage
67 | 68 | LOGOUT 69 | 93 | -------------------------------------------------------------------------------- /dashboard.php: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 16 | 17 | 18 | 28 | 29 | 30 | 31 | 32 | 48 | 49 | 50 |
51 |

Student Election System

52 |

Voter's Dashboard

53 | 54 |
55 |

Hello,

56 | 57 | 58 |

Student ID:

59 |
60 | You have already voted."; 64 | }else{ 65 | echo "You have not voted. Please Vote"; 66 | echo "

VOTE HERE

"; 67 | } 68 | ?> 69 | 70 |
71 | 72 | 73 |

74 | 75 | 76 |

77 |
78 |
79 |

Update Your Details

80 |
81 | 82 |
83 | 84 | 85 |
86 | 87 |
88 | 89 |
90 |
91 |

LOGOUT

92 |

Goto HOME

93 |
94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /studentvote.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 4.8.5 3 | -- https://www.phpmyadmin.net/ 4 | -- 5 | -- Host: 127.0.0.1 6 | -- Generation Time: May 14, 2019 at 09:28 PM 7 | -- Server version: 10.1.38-MariaDB 8 | -- PHP Version: 7.1.27 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | SET AUTOCOMMIT = 0; 12 | START TRANSACTION; 13 | SET time_zone = "+00:00"; 14 | 15 | 16 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 17 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 18 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 19 | /*!40101 SET NAMES utf8mb4 */; 20 | 21 | -- 22 | -- Database: `studentvote` 23 | -- 24 | 25 | -- -------------------------------------------------------- 26 | 27 | -- 28 | -- Table structure for table `candidate` 29 | -- 30 | 31 | CREATE TABLE `candidate` ( 32 | `id` int(11) NOT NULL, 33 | `name` varchar(50) NOT NULL, 34 | `email` varchar(50) NOT NULL, 35 | `contact` varchar(50) NOT NULL, 36 | `voteCount` int(11) DEFAULT '0' 37 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 38 | 39 | -- 40 | -- Dumping data for table `candidate` 41 | -- 42 | 43 | INSERT INTO `candidate` (`id`, `name`, `email`, `contact`, `voteCount`) VALUES 44 | (1, 'kishore', 'kishore@gmail.com', '1234567890', 7), 45 | (2, 'kumar', 'kumar@gmail.com', '98654312', 3), 46 | (3, 'harik', 'harik@dgmail.com', '987654', 1), 47 | (4, 'Neelesh Plaparthy', 'neelu@gmail.com', '987654320', 15), 48 | (5, 'len', 'len@gmail.com', '123457783', 1), 49 | (6, 'len', 'len@gmail.com', '123457783', 1); 50 | 51 | -- -------------------------------------------------------- 52 | 53 | -- 54 | -- Table structure for table `users` 55 | -- 56 | 57 | CREATE TABLE `users` ( 58 | `id` int(11) NOT NULL, 59 | `name` varchar(50) NOT NULL, 60 | `studentId` varchar(50) NOT NULL, 61 | `pass_word` varchar(50) NOT NULL, 62 | `mobileNumber` varchar(15) NOT NULL, 63 | `voted` int(5) DEFAULT '0' 64 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 65 | 66 | -- 67 | -- Dumping data for table `users` 68 | -- 69 | 70 | INSERT INTO `users` (`id`, `name`, `studentId`, `pass_word`, `mobileNumber`, `voted`) VALUES 71 | (2, 'Hari', '16EI111', '12345', '9876543210', 1), 72 | (3, 'kishore', '123', '1234', '1234567890', NULL), 73 | (4, 'asdf', '321', 'asd', '987465', 1), 74 | (5, 'asdf', '9874', '789987', '987465', 0), 75 | (6, 'kumar', '3210', '12345', '987987', 1), 76 | (7, 'new', 'new', '123', '987654', 1), 77 | (8, 'harikishore', '45', '987', '98765465', 1), 78 | (9, 'hari kishore', '16EI111', '1234', '8300496930', 1), 79 | (10, 'gau', '16IT114', '120', '987456332', 1), 80 | (11, '', '', '', '', 0), 81 | (12, 'SJKASHKA', '16EC159', '123456', '48923409', 1), 82 | (13, 'purushottam banerjee', '16CS138', '123', '12345', 1), 83 | (14, 'subbu kona', '16CS123', '123', '9866441201', 1), 84 | (15, '', '', '', '', 0), 85 | (16, 'hello', '1234', '1234', '1234556776', 0), 86 | (17, 'hello', '1234', '1234', '1234556776', 0), 87 | (18, 'hello', '1234', '1234', '1234556776', 0), 88 | (19, 'hello', '1234', '1234', '1234556776', 0), 89 | (20, 'hello', '1234', '1234', '1234556776', 0), 90 | (21, 'hello', '1234', '1234', '1234556776', 0), 91 | (22, 'hello', '1234', '1234', '1234556776', 0), 92 | (23, 'Raushan', '16EE139', '12345', '987654321', 1); 93 | 94 | -- 95 | -- Indexes for dumped tables 96 | -- 97 | 98 | -- 99 | -- Indexes for table `candidate` 100 | -- 101 | ALTER TABLE `candidate` 102 | ADD PRIMARY KEY (`id`); 103 | 104 | -- 105 | -- Indexes for table `users` 106 | -- 107 | ALTER TABLE `users` 108 | ADD PRIMARY KEY (`id`); 109 | 110 | -- 111 | -- AUTO_INCREMENT for dumped tables 112 | -- 113 | 114 | -- 115 | -- AUTO_INCREMENT for table `candidate` 116 | -- 117 | ALTER TABLE `candidate` 118 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; 119 | 120 | -- 121 | -- AUTO_INCREMENT for table `users` 122 | -- 123 | ALTER TABLE `users` 124 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24; 125 | COMMIT; 126 | 127 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 128 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 129 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 130 | --------------------------------------------------------------------------------