Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- ?>
- <html>
- <head>
- <link href="logdes.css" rel="stylesheet">
- </head>
- <body>
- <div id="box">
- <p id="p">Welcome to E-Voting</p>
- <form>
- <table width=40% align="center" id="tw">
- <tr><td>Username:</td><td><input type="text" name="t1"></td></tr>
- <tr><td>Password:</td><td><input type="password" name="t2"></td></tr>
- <tr><td colspan="2" id="td"><input type="submit" value="Login" name="b1"> </td></tr>
- </table>
- </form>
- </div>
- </body>
- </html>
- <?php
- if(isset($_REQUEST['b1']))
- {
- $k=$_REQUEST["t1"];
- $q=$_REQUEST["t2"];
- mysql_connect('localhost','root','');
- mysql_select_db('project');
- $a="select * from login where Username='$k' and password='$q'";
- $rs=mysql_query($a);
- if(mysql_num_rows($rs)>0)
- {
- $_SESSION['username1']=$k;
- $_SESSION['password1']=$q;
- while($row=mysql_fetch_array($rs))
- {
- if($row['val']==1)
- header("location: adminportal.php");
- else
- header("location: userportal.php");
- }
- }
- else
- {
- echo"No record found!";
- }
- }
- ?>
- <?php
- session_start();
- if(!isset($_SESSION['username1']))
- {
- header("location: voterlogin.php");
- }
- else
- {
- $n=$_SESSION['username1'];
- $q=$_SESSION['password1'];
- echo"Welcome $n";
- }
- ?>
- <html>
- <head>
- <link href="logdes.css" rel="stylesheet">
- </head>
- <body>
- <div id="box">
- <p id="z">Voter's Portal</p>
- <form>
- <table width=50% align="center" id="tw">
- <tr><td><a href="caninfo.php" class="f">List of Election Candidates</a></td> </tr>
- <tr><td><a href="votenow.php" class="f" id="f1">Vote Now</a></td></tr>
- <tr><td><a href="viewresults.php" class="f" id="f2">View Results</a></td></tr>
- </table>
- </form>
- </div>
- </body>
- </html>
- <?php
- session_start();
- if(isset($_SESSION['username']))
- {
- $u=$_SESSION['username'];
- $p=$_SESSION['password'];
- destroy_session_and_data();
- echo" You have been logged out.<br>Click <a href='index.php'>here</a> to return to the home page.";
- }
- else if(isset($_SESSION['username1']))
- {
- $k=$_SESSION['username1'];
- $q=$_SESSION['password1'];
- destroy_session_and_data();
- echo" You have been logged out.<br>Click <a href='index.php'>here</a> to return to the home page.";
- }
- function destroy_session_and_data()
- {
- $_SESSION = array();
- setcookie(session_name(), '' , time()-2592000, '/');
- session_destroy();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement