Jump to content

Echo Cookie value only works on 1 page


farkewie

Recommended Posts

Hi i am creating a site for work, i made a login system where i stores informaton in a cookie that is set pretty much until they clear there cache.

 

problem is i am trying to echo the cookie at the top of each page much like this page does. and it will onl echo on my index page all the pages have the same code . (i just use includes).

 

here is the echo code.

 

top.php

<?php

<div id="header-logo">
          <div id="logo" class="red style3"><span class="style5">WDCS</span> <span class="style4">Townsville <span class="style8">Welcome  </span><span class="style9"><?php echo $_COOKIE['fname'];?></span><br>
          	<br />
          </span> </div>
?>

 

 

and this is what each page looks like

 

 

page.php

 

<?php 

$url = "http://".$_SERVER['HTTP_HOST']."/mobiles/";

if (!isset($_COOKIE['username'])) {

header ("Location: http://".$_SERVER['HTTP_HOST']."/mobiles/login.php");
exit; 

}

##################################
#####		DO NOT MOVE    #######
include ($url."sql.php");
include ($url."top.php");
include ($url."left.php");
##################################
?>	   
   
<!--Start body content-->	  
   


<!--end body content-->
<?
##################################
#####		DO NOT MOVE    #######
include ($url."footer.php");
##################################
?>

Link to comment
Share on other sites

Sorry that was just a sampleof the code. i didnt want to paste a massive chunk.i added the php tage for code highlighting (most people find it easier to read.)

 

herer is the whole thing:

 

top.php


<?php $url = "http://".$_SERVER['HTTP_HOST']."/mobiles/";?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<meta name="Description" content="Information architecture, Web Design, Web Standards." />
<meta name="Keywords" content="your, keywords" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Distribution" content="Global" />
<meta name="Author" content="Erwin Aligam - ealigam@gmail.com" />
<meta name="Robots" content="index,follow" />
<title>Telstra WDCS - Townsville</title>	
<link href="<?php echo $url ?>inc/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style3 {color: #FF0000}
.style4 {color: #CC0001}
.style5 {color: #000000}
.style8 {
color: #000000;
font-size: 14px;
}
.style9 {font-size: 14px}
#form {
position:absolute;
left:612px;
top:63px;
width:292px;
height:42px;
z-index:1;
}
-->
</style>
</head>

<body>
<!-- wrap starts here -->
<div id="form">
<form action="<?php echo $url ?>contacts.php"  method="get" id="search">
	<label>
	<input type="text" name="q" id="q" />
	<input type="submit" name="button" id="button" value="Search" />
	</label>
    </form>
</div>
<div id="wrap">

	<!-- header -->
	<div id="header">			

		<span id="slogan">Always customer first... </span>

		<!-- tabs -->
		<ul>
			<li id="current"><a href="<?php echo $url;?>index.php"><span>Home</span></a></li>
			<li><a href="http://vus842.rr.in.telstra.com.au/conen/" target="_blank"><span>Conan</span></a></li>
			<li><a href="<?php echo $url;?>phones_db.php?page=makes"><span>Phones</span></a></li>
			<li><a href="http://a00000551004620/wdcs/index.php" target="_blank"><span>WDCS</span></a></li>
			<li><a href="http://easenetprod.in.telstra.com.au/mobiles/home/prodserv/msgcomms/s0index.htm" target="_blank"><span>Easenet</span></a></li>
			<li><a href="http://www.in.telstra.com.au/ism/mvcstsv/index.asp" target="_blank"><span>MVCS</span></a></li>
			<li><a href="http://iexfmv01.in.telstra.com.au/agentops/loginSetup.do" target="_blank"><span>Contacts </span></a></li>			
	  </ul>
	</div>
        <div id="header-logo">
          <div id="logo" class="red style3"><span class="style5">WDCS</span> <span class="style4">Townsville <span class="style8">Welcome  </span><span class="style9"><?php echo $_COOKIE['fname'];?></span><br>
          	<br />
          </span> </div>
</div>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.