Showing posts with label PHP problem. Show all posts
Showing posts with label PHP problem. Show all posts

Monday, 30 June 2014

Task for PHP Developers...

Posted by Unknown | 03:13 Categories:
Hello friends ....

Today i am here with a problem for PHP developers....

The problem is when the user clicks on the logout button then PHP should destroy the session and redirect him to the login.PHP page...

But this is not happening...  find out the problem...


Here is the code

User_index.php :

<?PHP

session_start();

if (!(isset($_SESSION['username']) && $_SESSION['username'] != '')) {

header ("Location: checklogin.php");

}

?>

<!DOCTYPE html>
<html>
  <head>

<title>MAP MY WAY</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />

<meta name="description" content="Google Maps API V3: Custom Directions Panel" />
<meta name="keywords" content="final_project" />
<meta name="author" content="Zohaib Tasnim" />

<script type="text/javascript"                     
src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?
v=3.exp&sensor=true&libraries=places"></script>
<link href="style.css" type="text/css" rel="stylesheet" />
<!--to disable the enter key-->
<script type="text/javascript"> 

function stopRKey(evt) { 
  var evt = (evt) ? evt : ((event) ? event : null); 
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); 
  if ((evt.keyCode == 13) && (node.type=="text"))  {return false;} 
} 

document.onkeypress = stopRKey; 

</script>


  </head>
  <body>
<div id="mapCanvas">&#160;</div>
<div id="box">
 <a id="btns"> welcome <?php echo($_SESSION['username']); ?></a>
    <a id="btns" href="profile.html"> My Profile</a>
    <a id="btns" href="logout.php"> logout</a>
    <p class="or">[OR]</p>
    <div class="directionInputs">
        <form action="address_insert.php" name="form2" method="post">
            <p><label>A</label><input type="text" value=""  name="loc_a" 
id="dirSource" /></p>
            <p><label>B</label><input type="text" value="" name="loc_b" 
id="dirDestination" /></p>
            <a href="#getDirections" id="getDirections">Get Directions</a>
            <a href="#reset" id="paneReset">Reset</a>
            <a id="btns"><input name="submit" class="btns" type="submit" value="Save                 
Address" /></a>
        </form> 
    </div>

    <div id="directionSteps">
        <p class="msg">Direction Steps Will Render Here</p>
    </div>
    <!--<a href="#toggleBtn" id="paneToggle" class="out">&lt;</a>-->
</div>
<script type="text/javascript" src="sample.js"></script> 
  </body>
</html>
 

And here is the logout.php    

 

<?php session_start();

  session_destroy(); 

 if (session_destroy()){ header("location:login.php"); } 

 else { echo"there was some problem";  

} 

 ?> 

 

  Find out what is the problem....

 
 

Leave a reply....

 

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube