473,721 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem getting rid of a frame...

23 New Member
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.ph p" target ="showframe">ad ditional admin option</a>
<hr width="100%">
{/if}

<p> </p>
<a href ="add.php" target ="showframe">Ad d users </a>
<hr width="100%">
<p> </p>
<a href ="logout.php " target ="showframe">Lo gout</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('Locatio n: frame2.php');

?>[/PHP]
Aug 7 '08 #1
2 2934
Atli
5,058 Recognized Expert Expert
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
panos100m
23 New Member
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=se lf.document.loc ation;
//-->
</SCRIPT>

Best Regards
Aug 7 '08 #3

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

Similar topics

6
9559
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 xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>DOM Iframe Test</title>
0
6298
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 reformating, after the merge. This is a full description of my needs. I have a C# class library that creates two Crystal Reports, and then exports them to the harddrive as Word documents. One's orientation is landscape, the other is portrait. I then...
2
2068
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 images(logo...etc) and bottom frame I'm displaying some document(excel,word,ppt,pdf etc...)which are working fine. when I take print, using IE-File-menu (IE->File->print) when excel document
1
1307
by: micky | last post by:
########################################################## i use css like this ##################################################### <!-- FrameTable --> <table border="0" cellpadding="0" cellspacing="0" class="board-frame"> <tr> <td class="topx--"></td> <td class="top-x-"></td>
42
34224
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 1.07/Linux, Firefox 1.5/Linux, Firefox 1.5/Windows and Firefox 1.5/Mac, Safari/Mac. It works perfectly on a lot of configurations but, on some PC with Firefox 1.5/Windows (not all), the Javascript code with XmlHttpRequest
5
3540
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: Current entry Company : entered co. name First entry : entered stuff The second entry: more entered stuff
4
2882
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) self.app.MainLoop()
3
1391
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 resizing problem with the screen? My banner images are not getting resized to the page. Here is the sample of my code:
3
3941
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 want to draw a rectangle when the user clicks and drags the mouse button and releases a rectangle has to be drawn.can somebody help me to debug the error ASAP. My code goes like this: import javax.swing.*; import javax.swing.JPanel; import...
10
3441
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 frameset. I have figured out how to get up to the parent and then down to the first frameset and change the rows attribute. However I am stuck on getting to the next level, I am required to change the height of the second frameset textarea to 300 pixels....
0
9367
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9064
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8007
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6669
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5981
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4484
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4753
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.