Jump to content

[SOLVED] Includes


Clinton

Recommended Posts

Here's the complete code:

 

<?
session_start();
if(!isset($_REQUEST['logmeout'])){
echo "<center>Are you sure you want to logout?</center><br />";
echo "<center><a href=logout.php?logmeout=true>Yes</a> |
<a href=javascript:history.back()>No</a>";
} else {
session_destroy();
if(!session_is_registered('first')){
echo "<center><font color=red><strong>You are now logged out!</strong></font></center><br />";
echo "<center><strong>Login:</strong></center><br />";
include './index.php';
}
}
?> 

Link to comment
Share on other sites

Sorry, I believe you already said that. :-|

 

Here's the code. But it keeps taking me back, looping, to the Yes / No part. It doesn't follow through.

 


<?
session_start();
if(!isset($_POST['logmeout'])){
echo "<center>Are you sure you want to logout?</center><br />";
echo "<center><a href=logout.php?logmeout=true>Yes</a> |
<a href=javascript:history.back()>No</a>";
} else {
session_destroy();
if(!session_is_registered('first')){
echo "<center><font color=red><strong>You are now logged out!</strong></font></center><br />";
echo "<center><strong>Login:</strong></center><br />";
header("Location: ./index.php");
}
}
?> 

Link to comment
Share on other sites

Whenevery you send a new header, or move to a new page, you cannot have any echos or anything before the header.  The best way to resolve this is assign session variables those values and echo those on the script you want, in the place you want.  It will not hurt if the variables are empty.

 

<?php
session_start();
if(!isset($_POST['logmeout'])){
echo "<center>Are you sure you want to logout?</center><br />";
echo "<center><a href=logout.php?logmeout=true>Yes</a> |
<a href=javascript:history.back()>No</a>";
} else {
session_destroy();
if(!session_is_registered('first')){

// I changed the echos to session variables
// *Note you will have to echo these values on the index.php script
$_SESSION['varname'] = "<center><font color=red><strong>You are now logged out!</strong></font></center><br />";
$_SESSIOB['varname2'] = "<center><strong>Login:</strong></center><br />";
header("Location: ./index.php");
}
}
?> 

 

 

More info on header errors: http://www.phpfreaks.com/forums/index.php/topic,37442.0.html

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.