When a user logs in, it redirects them to a page that prints their account name, thus showing that they are logged in. But if they leave the page and come back they get logged out, and if they refresh the page they get logged out. I don't know why the session keeps clearing, how do I make it stay? Please help, desperate D:
Dartz654 0 Newbie Poster
Recommended Answers
Jump to PostThere is a bug in your code which is making sessions not initialize. The session_start() function should be placed on the first line of the page before any browser/html output. For example.
<?php session_start(); ?> <html> <head> <title> Blokmates Account Login </title> </head> <body> <link rel="stylesheet" type="text/css" …
Jump to PostI just noticed in your second script you have programmed it in a weird way which may be your problem. Here is the new code.
<?php session_start(); ?> <html> <head> <title> Blokmates Account Login </title> <link rel="stylesheet" type="text/css" href="css/login.css"/> </head> <body> <center> <?php include_once "header.php" // Adds …
All 8 Replies

rajarajan2017
chrishea 182 Nearly a Posting Virtuoso
Dartz654 0 Newbie Poster
cwarn23 387 Occupation: Genius Team Colleague Featured Poster
Dartz654 0 Newbie Poster
Dartz654 0 Newbie Poster
cwarn23 387 Occupation: Genius Team Colleague Featured Poster
Dartz654 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.