Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php session_start()?>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=Cp1253">
- </head>
- <body>
- <?php
- //include_once 'sidebar.php';
- $link=mysqli_connect("localhost","root","");
- $database=mysqli_select_db($link,"webdevelop");
- if(!isset($_SESSION["customerId"])){
- if(isset($_POST["fsd"]))
- header("Location: /new/insertData.php");
- if(isset($_POST['username'])){
- $email=$_POST['username'];
- $password=$_POST['password'];
- echo $email,' ',$password;
- $authenticateQuery="select * from user where username='$email' and password='$password'";
- $authenticateResult=mysqli_query($link,$authenticateQuery);
- if(!$authenticateResult){
- echo "no login";
- }
- else{
- $customer=mysqli_fetch_array($authenticateResult);
- $_SESSION["customerId"]=$customer["id"];
- $_SESSION["customerName"]=$customer["name"];
- $_SESSION["lname"]=$customer["lastname"];
- }
- $currentPage=$_SERVER['HTTP_REFERER'];
- header("Location:$currentPage ");
- exit(0);
- }
- }
- else{
- echo "<div align='left'><form style='width:200px;margin-top:7px;' method='post'>",
- "<h3>welcome ", $_SESSION["customerName"] ," ",$_SESSION["lname"],
- "</h3><br/><input style='margin-left:120px;width:80px;height:40px;' type='submit' value='Logout' name='logoutButton'/>
- </form></div>";
- if(isset($_POST["logoutButton"])){
- session_unset();
- $currentPage=$_SERVER['HTTP_REFERER'];
- header("Location:/new/accessLayout.php ");
- exit(0);
- }
- }
- mysqli_close($link);
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement