Jump to content
php.lv forumi
Sign in to follow this  
Frozen Life

session_start

Recommended Posts

Lūūdzu palīdzat ar session_start(_); nekādīgi nesaprotu, kas pa problēmu tur ir :/

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\xampp\htdocs\index.php:1) in D:\xampp\htdocs\index.php on line 5

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\xampp\htdocs\index.php:1) in D:\xampp\htdocs\index.php on line 7

reku php scripts

<?php
include("config.php");
session_start();

if(isset($_GET['darbiiba']) and $_GET['darbiiba'] == 'iziet' and isset($_SESSION['ieligojies']))
{
       session_destroy();
       header("location: index.php");
}

if(isset($_POST['username']) and isset($_POST['password']))
{
       $username = quote_smart($_POST['username']);
       $password = quote_smart(md5($_POST['password']));

       $result = mysql_query("SELECT COUNT(*) FROM lietotaji WHERE user = $username AND pass = $password");
       if(mysql_result($result,0,'COUNT(*)') > 0)
       {
               #ieliek sesijā datus
               $_SESSION['ieligojies'] = 1;

               $id = mysql_result(mysql_query("SELECT id FROM lietotaji WHERE user = $username AND pass = $password"),0,'id');
               $_SESSION['mans_id'] = $id;
       }
}

?>

Edited by Frozen Life

Share this post


Link to post
Share on other sites

Pirms attiecīgās funkcijas nedrīkst būt nekas cits kā PHP kods. Visdrīzāk Tev tur ir HTML kods. =]

Share this post


Link to post
Share on other sites

Man kaut kā pazuda viens errors un sesija sāka strādāt, bet otrs erors palika :(

Un tas ir

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\xampp\htdocs\index.php:1) in D:\xampp\htdocs\index.php on line 2

Share this post


Link to post
Share on other sites

Ja Man būtu Notepad++ uz Debian... *doh*

Share this post


Link to post
Share on other sites

Atkal problēma :D

Tā, tad man ir tā es ieeju savā profilā pārmet viss notiek un nemet lauka, ja, bet kad es izeju man viņš iziet, bet kad uzspiežu SĀKUMS atkal viņš ir profilā, bet kad uzspiežu piemēram komentēt jaunumus, tad viņš vairs nav profilā :/

Var kāds ar šito palīdzēt ? O_O

Share this post


Link to post
Share on other sites

Fn session_start() ir jābūt katrā lapā, kura izmanto sesijas. =]

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...