Page 2 of 2

Posted: Fri Aug 20, 2004 2:04 am
by feyd
btw, the cookie will never get set if you are trying to set it for a different domain that where the cookie is being sent from..

Posted: Fri Aug 20, 2004 2:07 am
by murthy
Hi ,

Parse Error?

In few browsers , i didn't get problem with cookies.....

Please try in your system.... Please click once http://www.searchchips.com

username : catherine
password:catherine

afterthat please close the browser .... It shuoldn't ask the username and password..

Posted: Fri Aug 20, 2004 2:08 am
by murthy
can i set this one,
setcookie ("member_id", "$id", time()+3600000,"/","searchchips.com");

Posted: Fri Aug 20, 2004 2:11 am
by murthy
Hi,
i tried same domain only.. getting problem like this....

Posted: Fri Aug 20, 2004 2:22 am
by murthy
Hi ,

I changed like this :::
setcookie ("member_id", "$id", time()+3600000,"/","lotofcontent.com");

My website is http://www.lotofcontent.com/searchchipsnew/

Still getting problem

Posted: Fri Aug 20, 2004 2:27 am
by feyd
maybe $id is empty?

Posted: Fri Aug 20, 2004 2:35 am
by murthy
Hi,
I observed onething ... i.e $id is fine.....

i echo $id before the setcookie()..... it's printing without errors....
As of my knowledge, it we use echo before setcookie() , it should give error .like Header is added by.....

I am not getting any error......like this

Simply it prints the value.

Posted: Fri Aug 20, 2004 2:36 am
by murthy
http://www.lotsofcontent.com/searchchipsnew/test.php

just you will observe this one..... just see :HTTP_COOKIE value

Posted: Fri Aug 20, 2004 2:52 am
by feyd
searchchips.com:

Code: Select all

HTTP/1.1 200 OK
Date: Fri, 20 Aug 2004 07:48:56 GMT
Server: Apache/1.3.31 (Unix) mod_pointer/0.8 PHP/4.3.2
X-Powered-By: PHP/4.3.2
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html
lotsofcontent.com/searchchipsnew/index.php:

Code: Select all

HTTP/1.1 200 OK
Date: Fri, 20 Aug 2004 07:49:49 GMT
Server: Apache/1.3.31 (Unix) FrontPage/5.0.2.2634
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Set-Cookie: PHPSESSID=3cf0a304db0e3e1e421b7129f0bb075d; path=/
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html
only a session cookie is set on your main page.

you have some form of errors in your setcookie call..

Posted: Fri Aug 20, 2004 2:52 am
by anjanesh
Setting the cookies always worked fine. But if you've used sessions you'll find that when removing the cookie (logging out etc) the session id still remains in the cookie even after session_destroy(). session_destroy() doesn't remove the session id from the cookie. When removing sessions also do setcookie(session_name(),"",0,"/");
http://www.php.net/manual/en/function.s ... estroy.php

Posted: Fri Aug 20, 2004 2:59 am
by murthy
Hi ,

I am using sessions and cookies in my site .... can i use both ?

setcookie ("member_id", "$id", time()+36000000,"/","$HTTP_HOST");

Posted: Fri Aug 20, 2004 3:14 am
by feyd
you're still not setting a cookie.. post all your code please.

Posted: Fri Aug 20, 2004 3:29 am
by murthy
feyd | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


Hi ,
Here i am posting my code....please review once..

Code: Select all

<?
session_start();

//**************************************************************

//					Main page --- This is base-one of all operations

//**************************************************************
//app.php file consists ------  Database connection and all variables.   
	include("lib/app.php");
//include all class files

include("classes/member.class.php");
include("classes/Memberchips.class.php");
include("classes/searchchips_codes.class.php");
include("classes/searchchips_membercodes.class.php");
switch($action){
	case 'login':
		$objmember->loadMultiple("member_name='$member_name' and password='$password'");
		if(count($objmember->searchResults)){
			$id=$objmember->searchResults[0]['member_id'];
			setcookie ("member_id", "$id", time()+36000000,"/","$HTTP_HOST");
			$first_name=$objmember->searchResults[0]['first_name'];
			$last_name=$objmember->searchResults[0]['last_name'];
			$chips=$objmember->loadchips($id);
			$back_id=$id;
			$objmemberchips->loadMultiple("member_id=".$id ." and type_chips='home-page'");
			$_SESSION['home_page']=$objmemberchips->searchResults[0]['chips'];
			$objmemberchips->searchResults[0]['chips']="";
			$objmemberchips->loadMultiple("member_id=".$id." and type_chips='book-page'");
			$_SESSION['book_homepage']=$objmemberchips->searchResults[1]['chips'];
			$packid=1;
			include("member-home.php");
		}
		else{
			$msg="Invalid Username/Password !!";
			include("home.php");
		}
	break;
	default:
		if($_COOKIE["member_id"]){
			$res=$objmember->loadSingle($_COOKIE["member_id"]);
			$first_name=$res['first_name'];
			$last_name=$res['last_name'];
			$chips=$objmember->loadchips($_COOKIE["member_id"]);
			checklinks();
			include("member-home.php");
		}	
		else{ 
				include("home.php");
		}
	break;

}

feyd | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Fri Aug 20, 2004 3:36 am
by murthy
Hi ,

I wrote sample file for cookie testing ....It's working fine.......http://www.lotsofcontent.com/searchchipsnew/sample.php



But In my site it is not working ....http://www.lotsofcontent.com/searchchipsnew/


So problem in my file only...........

Thanks,
Krishna

Posted: Fri Aug 20, 2004 10:39 am
by feyd
your code is set up for register globals being on, each page, however, it doesn't appear register globals is on with that server (which it shouldn't be on)