Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8307879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:38:18+00:00 2026-06-08T18:38:18+00:00

Ok ive been having this major problem with my site. Whats going on is

  • 0

Ok ive been having this major problem with my site. Whats going on is as I’m going from page to page its is not maintaining its SESSION. Here are a couple source codes on the same directory. Ok so I have an index with a modal box that contains the iframe for login.php and logout.php. It logs me in but once I go to a different page It doesn’t carry the session and then when I click login its says Im already logged in and has the session. Also how can I add cookies to my website I find those confusing.

Just snippets:

part of header.php goes on every page

<?php session_start(); if($_SESSION["username"]) { ?>

<div style="display: inline-block; font-size: 14px; padding-left: 20px;">Hello <?php  echo $_SESSION['username']; ?>

login.php

<?php session_start(); require_once('connections/Main.php');

        if($_SESSION['username']) {

            echo '<div class="error_message">Attention! You, '.$_SESSION['username'].' are already logged in.</div>';
            echo "<br />";
            echo "Go <a target='top' href='index.php'>back</a> to the page you were viewing before this.</li>";

            exit();
        }
    ... database funcctions go here then add session
    if($rowCheck > 0) { 
        while($row = mysql_fetch_array($result)) { 

          // Start the session and register a variable 

          session_start(); 
          $_SESSION['username'] = $user;
          //session_register('username'); 

          echo '<script> parent.document.location.href = "index.php"; </script>';

          } 

logout.php

 <?php session_start(); ?>
    <?php if($_SESSION['username']) {
    session_unset(); 
    session_destroy(); 
    header("Location: index.php"); } 
    else { header("Location: index.php"); } ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:38:19+00:00Added an answer on June 8, 2026 at 6:38 pm

    Found out what was really wrong for anybody who has this problem. You must make sure every URL the user goes to is http://website.com or http://www.website.com but not mixed. You cannot have different pages with both of these or sessions will disappear. This is because with www it is stored in www/website/ and not just website/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ive been having some problems with understanding the MySql reader from MySql.Data.MySqlClient This is
another one ive been at for hours. Im having a major problem getting my
I've been having this rather frustrating problem, and having failed so many times, I'm
I've been having this problem for a while and it's driving me nuts. I'm
I've been having this problem where anytime I send a 0xA through an RS-232
I've been having a huge problem with this. Xcode just simply turned my landscape
Been having major issues trying to solve this issue, I'll be happy to give
I've been having nothing but trouble with python2.6 and Snow Leopard. One major problem
Ive been struggling with this for a day or two. Not just the coding
Ive been having this issue accross a few projects im working on. im sure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.