samedi 27 juin 2015

Session_start function not starting properly

I'm trying to use the session_start() function to write a login system using PHP. However, the document i am initializing my session in has the session_start(); on the top of it. I've made sure that nothing is being sent as headers by the document before the session_start(); is processed. However, the error "Cannot send session cache limit - headers already sent.." is still persisting.

<?php session_start(); ?> // The very beginning of my document



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   "http://ift.tt/kkyg93">

<html xmlns="http://ift.tt/lH0Osb">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>WorldOfConquer - WoC</title>
<link rel="SHORTCUT ICON" href="Style/favicon.ico">

<meta name="description" content=" WorldOfConquer - WoC, The best classic 1.0 server.">
<meta name="keywords" content="WorldOfConquer - WoC, The best classic 1.0   server.">

    <meta http-equiv="ROBOTS" content="INDEX,FOLLOW">
    <meta name="ROBOTS" content="INDEX,FOLLOW"> 
    <meta name="REVISIT-AFTER" content="2 days">
    <meta name="Author" content="Laviniu">
    <meta name="LANGUAGE" content="EN">
    <meta name="AUDIENCE" content="ALL">
    <link href="Style/index.css" type="text/css" rel="stylesheet">

How I initialize my session :

$rows = mysql_num_rows($query);
if ($rows == 1) {
$_SESSION['login_user']=$username;
echo "You have successfuly logged on!";

Aucun commentaire:

Enregistrer un commentaire