473,405 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Problem getting rid of a frame...

Hi there

I am using a menu frame on the left side but i cant destroy it using the logout link that i created ...

any ideas?



//index.php
// PAGE this will just redirect to the frame2.php (normally login / pass here but //removed unesecery code) just to show example
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.  
  4. require_once ('ini.php');
  5.         session_start();
  6.         $_SESSION['authorized'] = TRUE;
  7.         $_SESSION['alive'] = TRUE;
  8. //        $_SESSION['user']=$Username;
  9. $_SESSION['frames']=yes;
  10. require_once ('settime.php');
  11.         header('Location: frame2.php');
  12. ?>
  13.  
//frame2.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. require_once ('ini.php');
  3. session_start();
  4. $smarty->assign('frames', $_SESSION['frames'] );
  5. $smarty->display('frame2.tpl');
  6. ?>
  7.  
//frame2.tpl
[HTML]
<html>

{if $frames eq "yes"}

<frameset cols="10%,90%">
<frame src="menu.php" name="menu" />
<frame src="add.php" name="showframe">
</frameset>
{/if}

{if $frames neq "yes"}
<frameset cols="100%">

<frame src="add.php" name="showframe">
</frameset> <!--it shouldn't show me frames anymore-->
{/if}

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<meta HTTP-EQUIV="REFRESH" content="0; url=index.php">
<body>

</body>

</html>[/HTML]
//menu.php
[PHP]
<?php

require_once ('ini.php');
require_once ('authorize.php');
session_start();
$smarty->assign('type', $_SESSION['type'] );

$smarty->display('menu.tpl');

?>[/PHP]
//menu.tpl
[HTML]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Menu</title>
</head>
<body>
<h3> Menu </h3>
<hr width="100%" size="4" noshade>
{if $type eq "admin"}
<a href ="manageuser.php" target ="showframe">additional admin option</a>
<hr width="100%">
{/if}

<p> </p>
<a href ="add.php" target ="showframe">Add users </a>
<hr width="100%">
<p> </p>
<a href ="logout.php" target ="showframe">Logout</a>
<hr width="100%">
</body>

</html>[/HTML]

//and finally Logout.php
[PHP]
<?php

require_once ('ini.php');
session_start();
$_SESSION['authorized']=false;
$_SESSION['alive']=false;
$_SESSION['frames']=no;
header('Location: frame2.php');

?>[/PHP]
Aug 7 '08 #1
2 2918
Atli
5,058 Expert 4TB
Why do you have all those extra session variables?
It's generally not a good idea to bloat the session more than is absolutely needed.

Consider this:
Expand|Select|Wrap|Line Numbers
  1. # To login
  2. $_SESSION['User'] = $username;
  3.  
  4. # To logout
  5. unset($_SESSION['User']);
  6.  
  7. # To tell smarty whether or not the user is logged in
  8. $logged = isset($_SESSION['User']) ? "true" : "false";
  9. $smarty->assign('logged', $logged);
  10.  
Which could use a template that looked somewhat like this:
Expand|Select|Wrap|Line Numbers
  1. {if $logged == "true"}
  2.   <h1>Welcome</h1>
  3. {else}
  4.   <a href="login.php">Login please!</a>
  5. {/if}
  6.  
Aug 7 '08 #2
Thanks for the help, indeed that's a better way to do it rather than keeping the session.

The problem was resolved by using the following code between <head> </head>

of the frame. tpl

<SCRIPT TYPE="text/javascript">
<!--
if (top != self)
top.location=self.document.location;
//-->
</SCRIPT>

Best Regards
Aug 7 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: NoCopy na | last post by:
Using the following example: domiframetest.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
0
by: mharris | last post by:
I need help with merging two Word documents into one through C# code. The problem isn't so much getting the documents put into one as it is maintaining the appropriate formatting, or rather...
2
by: Balamurali C | last post by:
Hi All I'm having one problem, since im debuging this last one week I'm not able to do. Problem: In my webage I have two Frames(top & bottom) in the top frame I'm displaying some...
1
by: micky | last post by:
########################################################## i use css like this ##################################################### <!-- FrameTable --> <table border="0" cellpadding="0"...
42
by: Greg | last post by:
Hi, I've designed a bookmark in Ajax / PHP that I will put soon on sourceforge.net. But I've got an very tricky bug. I try it on some computers with Internet Explorer/Windows, Firefox...
5
by: H J van Rooyen | last post by:
Hi, I am struggling to get the pack method to do what I intend. I am trying to display user input in a seperate window, along with a little description of the field, something like this: ...
4
by: abcd | last post by:
I have a python script which creates a wx.App, which creates a wx.Frame (which has a wx.Timer). looks sorta like this: class MyProgram: def __init__(self): self.app = MyApp(0)...
3
by: reachmano | last post by:
Hello everyone: When I view my web-page on different computers, I am having trouble with re-sizing the screen on some of them. Was wondering what should be done differently to take care of the...
3
by: sumuka | last post by:
Hello, I'm doing a project in java using swings ,im able to create a panel and frame but i have a problem in event handling.I have added the MouseMotionListener but it's giving some error .Here i...
10
by: waltapp | last post by:
Hello, I am a new programmer and I am working on a school project. I am being instructed to move up then down the dom. My parent is demo.html then a frameset and then another frameset within the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.