---
title: "Funkar nästan!!!"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/15575-funkar-nästan"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "toja"
published: "2001-05-05T10:49:00.000Z"
updated: "2001-05-05T11:05:00.000Z"
replies: 2
views: 177
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/php/15575-funkar-nästan"
---

# Funkar nästan!!!

## #1 — toja, 2001-05-05T10:49Z

Nu har jag fått igång sessionerna, de fungerar i alla fall så att de sparar informationen och skickar den till nästa sida, men jag får ändå nått felmeddelande... det lyder så här: 

```
Warning: Cannot send session cookie - headers already sent by (output started at c:\inetpub\wwwroot\sessiontest\secret.php:7) in c:\inetpub\wwwroot\sessiontest\secret.php on line 8

Warning: Cannot send session cache limiter - headers already sent (output started at c:\inetpub\wwwroot\sessiontest\secret.php:7) in c:\inetpub\wwwroot\sessiontest\secret.php on line 8
```

PHP sidan ser ut så här:

```
<html>
<head>
<title>Sessions test!!!</title>
</head>
<body>

<?
	session_start();
	if(!isset($ActiveAt)) {
		echo "Hmm... du är nog inte inloggad";
		exit;
	}
	if(isset($ActiveAt) && time()-$ActiveAt > 60) {
		echo "Du har inte varit aktiv på 1 minut och är automatiskt utloggad!<br>";
		echo "<a href=\"index.php\">Logga in igen</a>";
		exit;
	}
	$ActiveAt=time(); echo "Uppdaterar sessionen!";
?>

Hejsan!<br>
<br>
Du är nu på sida 1! Gå till <a href="secret2.php">sida 2</a>!

</body>
</html>
```

Hoppas verkligen någon kan hjälpa mig... det fungerar, men det är inget kul med dessa felmess...

Permalänk: https://www.webforum.nu/p/15575

## #2 — Batboy, 2001-05-05T10:56Z

Du får inte skicka någon HTML (eller radbrytningar etc) före din session_start(). Den måste alltså stå först.

```
<?
session_start();
?>
<html>
<head>
<title>Sessions test!!!</title>
</head>
<body>
<?
if(!isset($ActiveAt)) {
echo "Hmm... du är nog inte inloggad";

[ ../.. ]

</body>
</html>
```

/j

Permalänk: https://www.webforum.nu/p/318430

## #3 — toja, 2001-05-05T11:05Z

Äntligen, tackar nu fungerar det...

Permalänk: https://www.webforum.nu/p/318431

---

Tråden på webben: https://www.webforum.nu/amne/php/15575-funkar-nästan
