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 7655827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:36:47+00:00 2026-05-31T12:36:47+00:00

Im having problems with my php SESSION varialbles my authentication system worked fine on

  • 0

Im having problems with my php SESSION varialbles
my authentication system worked fine on my xampp server, and now im having problems since i moved over to bluehost

normally, if i open a page like index.php it checks to see if you are logged in, and if your not sends you to the login page, but that isn’t working
and just for testing i tried echoing the $_SESSION['username'] and it turns up blank

now i did what ALEX said and i got this error:
Cannot modify header information – headers already sent by (output started at /home7/…/public_html/blog.php:4) in /home7/blogboua/public_html/blog.php on line 22

here is the code:

<?php session_start(); ?>
<html>
<head>
<?php
ini_set('display_errors', 'on');
error_reporting(E_ALL);
/*-----Connect to Database-----*/
 include ('connect_database_2.php');

//check if logged in
function isLoggedIn()
{
    if(isset($_SESSION['valid']) && $_SESSION['valid'])
        return true;
    return false;
}


//if the user has not logged in
if(!isLoggedIn())
{
    header('Location: login_form.html');
    die();
}

/* get username */
$username = $_SESSION['username'];


/*-----Include Navigation------*/
include ('frame.html');

?>
  • 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-05-31T12:36:48+00:00Added an answer on May 31, 2026 at 12:36 pm

    You are trying to send a Location header after you’ve already sent <html><head> on lines 2-3. You can’t do that. Headers must be sent before any output is sent.

    I honestly don’t know how your code worked on your local server.

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

Sidebar

Related Questions

I am using PHP 5.2 on SUN OS server. Having problems with the following
I am having problems posting this multi checkbox data with ajax. <?php foreach($_SESSION['contacts'] as
Hi im having problems with my PHP code for sending an email via a
I'm having problems using fopen in php. If I open the desired URL by
I've been having a few problems running PHP-based utilities within the command line ever
I am having problems with this code: <?php $new_value = 'testing'; $con = mysql_connect(localhost,user,pass);
Hello I'm having problems sending arrays, structs and arrays of structs from PHP to
I'm having problems to iterate twice on the same array: <? $indice=0 ?> <?php
I've got a new site setup using CMSMadeSimple (PHP based) but I'm having problems
Spent some time troubleshooting a problem whereby a PHP/MySQL web application was having problems

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.