Jump to content

[SOLVED] Session Issue?


x-raven

Recommended Posts

Hey so I'm new here and kind of a newbie at php, i've been tinkering with it for a year now but never really got in depth with it until very recently.

 

I am working on an admin/backend area for a project of mine for some friends and  im having some issues. So my my session was working just fine earlier and now I am implementing a design and it is now giving me an error..

 

ERROR:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\exotic\main.php:8) in C:\xampp\htdocs\exotic\main.php on line 36

 

<!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-9" />
<title>Exotic Island Real Estate Management Panel</title>
<link href="style.css" rel="stylesheet" type="text/css" />

<script src="js/jquery-1.js" type="text/javascript"></script>
  	<script type="text/javascript" charset="utf-8">
//tabbed forms box
	$(function () {
		var tabContainers = $('div#forms > div.innerContent'); // change div#forms to your new div id (example:div#pages) if you want to use tabs on another page or div.
		tabContainers.hide().filter(':first').show();

		$('ul.switcherTabs a').click(function () {
			tabContainers.hide();
			tabContainers.filter(this.hash).show();
			$('ul.switcherTabs li').removeClass('selected');
			$(this).parent().addClass('selected');
			return false;
		}).filter(':first').click();
	});
</script>
</head>

<?php

/**
* Exotic Island Real Estate SIM/Parcel Management
*
* @author Original by Randy Cram (Raven Beamish) <http://logicdepths.net/>
* @version 1.0a
* @file main.php
*/

session_start();

if(!$_SESSION['username'])
{
?>

ERROR

<?php
}
else
{

?>

LOGGED IN

<?php

}
?>

 

Its not like the login isn't working, cause i get the message saying "LOGGED IN" which i only have to get this part working first and i get more content but i dont know why this error is there. please help.

Link to comment
https://forums.phpfreaks.com/topic/156199-solved-session-issue/
Share on other sites

the session_start() function in php use cookie and need to use the header() function.

 

Always put it at start before anything else (even space or enter) like this :

 

<?php
session_start();
?>
<!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-9" />
<title>Exotic Island Real Estate Management Panel</title>
...

 

Link to comment
https://forums.phpfreaks.com/topic/156199-solved-session-issue/#findComment-822317
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.