Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="NavBar">
- <nav>
- <ul>
- <li><a href="Home.php">Home</a></li>
- <?php
- if(isset($_SESSION['Username'])):?>
- <li> <a href="#"><?php echo $_SESSION['Username'];?></a></li>
- <?php
- else:?>
- <li><a href="Login2.php">Student Login</a></li>
- <?php
- endif;
- ?>
- <li><a href="Candidate Profile.php">Candidates Profile</a></li>
- <li><a href="Admin.php">Admin</a></li>
- </ul>
- </nav>
- </div>
- define('DB_USER','root');
- define('DB_PASSWORD','password007');
- $con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error());
- $db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL: " . mysql_error());
- /*
- $ID = $_POST['user'];
- $Password = $_POST['pass'];
- */
- function SignIn()
- {
- session_start(); //starting the session for user profile page
- if(!empty($_POST['UserName'])) //checking the 'user' name which is from Sign-In.html, is it empty or have some text
- {
- $query = mysql_query("SELECT Username, Password, voting_status FROM voters where Username = '$_POST[UserName]' AND Password = '$_POST[password]'") or die(mysql_error());
- $row = mysql_fetch_array($query) or die(mysql_error());
- if(!empty($row['Username']) AND !empty($row['Password']) AND $row['voting_status']=='a')
- {
- $_SESSION['Username'] = $row['Password'];
- header("location:Result.php");
- }
- elseif(!empty($row['Username']) AND !empty($row['Password']) AND $row['voting_status']=='b')
- {
- $_SESSION['Username'] = $row['Password'];
- header("location:Voted User.php");
- }
- }
- }
- if(isset($_POST['submit']))
- {
- SignIn();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement