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