Jump to content

Member sessoin problem? Please Help!!


decneo

Recommended Posts

i can sigup to my local site but when i've tried to login it appears sth like this

 

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\AppServ\www\koko\userlogin\chkmember.php:1) in D:\AppServ\www\koko\userlogin\chkmember.php on line 19

Warning: Cannot modify header information - headers already sent by (output started at D:\AppServ\www\koko\userlogin\chkmember.php:1) in D:\AppServ\www\koko\userlogin\chkmember.php on line 22

 

 

 

here is my php code :

 

<?
$user_login=$_POST[user_login];
$pass_login=$_POST[pass_login];

if ($user_login=="" or $pass_login=="") {
echo "<h3>ERROR : ກະລຸນາກຼອກຂໍ້ມູນໃຫ້ຄົບຖ້ວນ <h3>"; exit();
}
include "connect.php";
$connect=mysql_connect("$hostname_connect","$username_connect","$password_connect")or die("cannot connect");
mysql_select_db("$database_connect",$connect)or die("cannot select DB");
$sql="select * from tb_member where username='$user_login' and password='$pass_login'";
$result=mysql_query($sql);
$num=mysql_num_rows($result);
mysql_close();

if($num<=0) {
echo "<h3>ERROR : Username ຫຼື Password ບໍ່ຖືກຕ້ອງ</h3>";
} else {
         session_start();
$_SESSION[sess_userid]=session_id();
$_SESSION[sess_username]=$user_login;
header("Location: main.php");
}
?>

 

best regards,

koko

Link to comment
Share on other sites

Both session_start() and header() need to be executed before any content is output (such as echo and anything outside <?)  Just assign a $error variable what you want output and output it after you execute session_start or header()  (although no one can read what your page prints, if the browser is changing locations.  Also after your header(redirect) put an

exit;

 

Link to comment
Share on other sites

Both session_start() and header() need to be executed before any content is output (such as echo and anything outside <?)  Just assign a $error variable what you want output and output it after you execute session_start or header()  (although no one can read what your page prints, if the browser is changing locations.  Also after your header(redirect) put an

exit;

 

it still have the same result  :'(

Link to comment
Share on other sites

Why not start the session at the beginning? You clearly are outputting something (Maybe even something as simple as a newline or space before <?) that will prevent it from sending.

 

And please use real php tags, <?php

Link to comment
Share on other sites

Why not start the session at the beginning? You clearly are outputting something (Maybe even something as simple as a newline or space before <?) that will prevent it from sending.

 

And please use real php tags, <?php

 

ok,i've changed but i got this

 

session_start();
Warning: Cannot modify header information - headers already sent by (output started at D:\AppServ\www\koko\userlogin\chkmember.php:2) in D:\AppServ\www\koko\userlogin\chkmember.php on line 22

 

here is my new code :

 

session_start();
<?php
$user_login=$_POST[user_login];
$pass_login=$_POST[pass_login];

if ($user_login=="" or $pass_login=="") {
echo "<h3>ERROR : ກະລຸນາກຼອກຂໍ້ມູນໃຫ້ຄົບຖ້ວນ <h3>"; exit();
}
include "connect.php";
$connect=mysql_connect("$hostname_connect","$username_connect","$password_connect")or die("cannot connect");
mysql_select_db("$database_connect",$connect)or die("cannot select DB");
$sql="select * from tb_member where username='$user_login' and password='$pass_login'";
$result=mysql_query($sql);
$num=mysql_num_rows($result);
mysql_close();

if($num<=0) {
echo "<h3>ERROR : Username ຫຼື Password ບໍ່ຖືກຕ້ອງ</h3>";
} else {
$_SESSION[sess_userid]=session_id();
$_SESSION[sess_username]=$user_login;
header("Location: main.php");
exit;
}
?>

 

regards,

Decneo

 

 

Link to comment
Share on other sites

<?php

session_start();

 

ok,but still have this :

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\AppServ\www\koko\userlogin\chkmember.php:1) in D:\AppServ\www\koko\userlogin\chkmember.php on line 2

Warning: Cannot modify header information - headers already sent by (output started at D:\AppServ\www\koko\userlogin\chkmember.php:1) in D:\AppServ\www\koko\userlogin\chkmember.php on line 22

 

please help me to figure my problem out

 

best regards,

Decneo

Link to comment
Share on other sites

Try deleting EVERYTHING above the session_start line by putting your cursor on the s and pressing backspace until you are sure there is nothing before the s and then try typing in <?php

and press enter.

 

Also, try opening the file in a different editor, it might be something wrong with the editor.

Link to comment
Share on other sites

Try deleting EVERYTHING above the session_start line by putting your cursor on the s and pressing backspace until you are sure there is nothing before the s and then try typing in <?php

and press enter.

 

Also, try opening the file in a different editor, it might be something wrong with the editor.

 

i did like you told me bro but got the same problem i use dreaweaver for my editor and also try notepad.

 

best regards,

Decneo

Link to comment
Share on other sites

output started at D:\AppServ\www\koko\userlogin\chkmember.php:1 (line 1)

 

You either have some character(s) in the file before the <?php tag or your file has been saved as a UTF-8 encoded file and the BOM (Byte Order Mark) characters that your editor placed at the start of the file is the output that is occurring on line 1.

 

The solution is simple. Check if there are any character(s) before the <?php tag and delete them or save your file as a UTF-8 encode file without the BOM or save it as an ANSI encoded file.

 

Link to comment
Share on other sites

found this on a post:

 

100% working solution

 

Step one :- Search & Open PHI.INI

 

Step Two:- Search session.cache_limiter

 

Step three:- put " public " in front of session.cache_limiter

 

Like

 

session.cache_limiter =public

 

Thats it .

 

http://www.phpbuilder.com/board/showthread.php?t=10310794

 

i've changed it but still have the same problem, i'll rewrote the file maybe it will work  :) thankyou bro .

 

Best regards,

Decneo

Link to comment
Share on other sites

output started at D:\AppServ\www\koko\userlogin\chkmember.php:1 (line 1)

 

You either have some character(s) in the file before the <?php tag or your file has been saved as a UTF-8 encoded file and the BOM (Byte Order Mark) characters that your editor placed at the start of the file is the output that is occurring on line 1.

 

The solution is simple. Check if there are any character(s) before the <?php tag and delete them or save your file as a UTF-8 encode file without the BOM or save it as an ANSI encoded file.

 

ok,it works  :D save as ANSI file thank you very much Big brother. 100/100  :P

 

best regards,

Decneo

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.