Jump to content

COOKIE Problem


JellyFishBoy

Recommended Posts

I'm surprised that Dreamweaver gave you problems.  I used it for years without issue.  Guess I'll have to look more closely at the link Pikachu2000 sent regarding UTF encoding.  That being said, I have moved on to NetBeans as my editor of choice because of its ability to expose and navigate through OO code as well as snap into source control tools like CVS, SVN and Git.

Although..... my logout.php is flagging up the same error again. Saved with notepad++ and dont see any outputs before it....

<?php 
if(isset($_COOKIE['firstname'])) //if no cookie present redirect the user (able to use this if else function for all pages which need login verification)
{
setcookie('firstname', '', time()-300, '/', '', 0);
setcookie('lastname', '', time()-300, '/', '', 0);
} else { //if the user isnt logged in (no cookies found) the client be redirected to the home page
echo "<b>You are already logged out.</b><br>";
echo "<p>If you are not redirected in 15 seconds click <A HREF='./index.php'>here</A>.";
print "<meta HTTP-EQUIV='REFRESH' content='5 url=./index.php'></p>";
}
echo "<p>You are now logged out <b>{$_COOKIE['firstname']}</b>.</p>";
echo "<p>If you are not redirected in 15 seconds click <A HREF='./index.php'>here</A>.";
print "<meta HTTP-EQUIV='REFRESH' content='5 url=./index.php'></p>";
?>
<html lang="en">
<head>
<title>JFB Systems - Online Store - Home</title>
<style type="text/css">
<!--
body {margin: 0px; padding: 0px;}
a:link {color: #000000;}
a:visited {color: #000000;}
a:hover {color: #ffffff;}
a:active {color: #000000;}
a:link {text-decoration:none;}
.Body-P
        {
        margin:0.0px 0.0px 0.0px 0.0px; text-align:left; font-weight:400; 
        }
.Body-Text-P
        {
        margin:0.0px 0.0px 0.0px 0.0px; text-align:center; font-weight:400; 
        }
.Body-C
        {
        font-family:"Arial", sans-serif; font-size:21.0px; line-height:1.19em; 
        }
.Body-C0
        {
        font-family:"Times New Roman", serif; font-size:21.0px; 
        line-height:1.14em; 
        }
.Body-Text-C
        {
        font-family:"Arial", sans-serif; font-size:11.0px; line-height:1.27em; 
        }
.Body-Navlist
	{
	font-family:"Arial", sans-serif; font-size:13.0px; color:black; line-height:1.19em; 
	}
#navlist li
	{
	display: inline; list-style-type: none; padding-right: 20px;
	}
-->
</style>
<script type="text/javascript" src="wpscripts/jspngfix.js"></script>
<script type="text/javascript"><!--
var blankSrc = "wpscripts/blank.gif";
--></script>
<div id="menu" style="position:absolute; left:728px; top:44px; width:530px; height:51px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box; overflow:hidden; z-index:1;"><span class="Body-Navlist">
<ul id="navlist">
<li id="active">
<a href="./index.php">Home</a></li>
<?php
if (isset($_COOKIE['firstname']) AND (substr($_SERVER['PHP_SELF'], -10) != './logout.php')) {
echo '<li><a href="./logout.php">Logout</a></li>
<li><a href="./cpass.php">Change Password</a></li>
';
} else {
echo '<li><a href="./register.php">Register</a></li>
<li><a href="./login.php">Login</a></li>
<li><a href="./f_pass.php">Forgot Password</a></li>
';
}
?>
<li><a href="./buy.php">Buy</a></li>
<li><a href="./sell.php">Sell</a></li>
<li><a href='./help.php'>Help</a></li>
</ul>
</span>
</div>
</head>
<body text="#000000" style="background-color:#ffffff; text-align:center; height:800px;">
<div style="background-color:transparent;text-align:left;margin-left:auto;margin-right:auto;position:relative;width:900px;height:800px;">
<div style="position:absolute; left:31px; top:83px; width:841px; height:694px;">
    <img src="wpimages/wp6f2c4b55.png" width="841" height="694" border="0" id="qs_16" name="qs_16" title="" alt="" onload="OnLoadPngFix()"></div>
<div style="position:absolute; left:32px; top:79px; width:840px; height:4px;">
    <img src="wpimages/wp011a815e.png" width="840" height="4" border="0" id="qs_15" name="qs_15" title="" alt="" onload="OnLoadPngFix()"></div>
<div style="position:absolute; left:51px; top:76px; width:359px; height:704px;">
    <img src="wpimages/wp8ad5650a.png" width="359" height="704" border="0" id="qs_10" name="qs_10" title="" alt="" onload="OnLoadPngFix()"></div>
<div id="txt_99" style="position:absolute; left:88px; top:109px; width:284px; height:238px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box; overflow:hidden;">
<p class="Body-P"><span class="Body-C">Logged Out</span></p>
<p class="Body-P"><span class="Body-C0"> </span></p>
<p class="Body-P"><span class="Body-C0"> </span></p>
</div>
<div id="txt_16" style="position:absolute; left:122px; top:777px; width:656px; height:23px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box; overflow:hidden;">
<p class="Body-Text-P"><span class="Body-Text-C">Copyright © All rights reserved. JFB Systems.</span></p>
</div>
<div style="position:absolute; left:35px; top:1px; width:831px; height:95px;">
    <img src="wpimages/wp618f8c40.png" width="831" height="95" border="0" id="txt_98" name="txt_98" title="" alt="Online store " onload="OnLoadPngFix()"></div>
</div>
</body>
</html>

 

Any ideas?

Same as before...

 

Warning: Cannot modify header information - headers already sent by (output started at /home/e-smith/files/ibays/Primary/html/secure/logout.php:1) in /home/e-smith/files/ibays/Primary/html/secure/logout.php on line 3

 

Warning: Cannot modify header information - headers already sent by (output started at /home/e-smith/files/ibays/Primary/html/secure/logout.php:1) in /home/e-smith/files/ibays/Primary/html/secure/logout.php on line 4

 

Line 3: {

Line 4: setcookie('firstname', '', time()-300, '/', '', 0);

Line 5: setcookie('lastname', '', time()-300, '/', '', 0);

 

 

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.