[PHP] using sessions instead of cookie

2006-01-21 Thread Ross
 I have never used sessions before.  How do I change the follow from COOKIES 
to SESSIONS in php (I do not know how to set a session)...

At present the script uses an iframe with cookies but I believe if I use 
sessions I can leave out the iframe.

http://www.ecurry.net/menu.phps

http://www.ecurry.net/order2.phps

The scipt adds a name and count to the cookie array, then works out the 
total using the order2 script.

if (isset($add)){

${$food} = intval($_COOKIE['cookie'][$food]);

ob_clean();
$new= $$food+1;
  include('names.php');
setcookie(cookie[$food], $new $name);

}
;


if (isset($minus)){

${$food} = intval($_COOKIE['cookie'][$food]);
if (${$food} == 0) {

}
else {;
ob_clean();
$new= $$food-1;
include('names.php');

setcookie(cookie[$food], $new $name);
}
}


and the order2 script...


if (isset($_COOKIE['cookie'])) {
   foreach ($_COOKIE['cookie'] as $name = $quantity) {

 if ($name == pakora) {$sub_total = $sub_total + ($priceA * 
$quantity);  $pricecode= $priceA; check_zero($quantity, $pricecode);}
  if ($name == haggis_fritter) {$sub_total = $sub_total + ($priceB * 
$quantity); $pricecode= $priceB;check_zero($quantity, $pricecode);}

}}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] using sessions instead of cookie

2006-01-21 Thread tedd

 I have never used sessions before.  How do I change the follow from COOKIES
to SESSIONS in php (I do not know how to set a session)...


?php session_start(); ?

tedd
--

http://sperling.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Using sessions with register globals off

2004-02-04 Thread Randall Perry
I've looked through the docs and past posts but I'm still a bit confused.
How do I translate the following into code that can be used with
register_globals set off.

Assuming there's a preceding page that has created the session 'name' and
registered the var 'order' with the 'name' session.


session_name('name');
session_register('order');


-- 
Randall Perry
sysTame

Xserve Web Hosting/Co-location
Website Development/Promotion
Mac Consulting/Sales

http://www.systame.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Using sessions with register globals off

2004-02-04 Thread Matt Matijevich
snip
Assuming there's a preceding page that has created the session 'name'
and
registered the var 'order' with the 'name' session.


session_name('name');
session_register('order');
/snip

Try $_SESSION['order']

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] using SESSIONS to store page 2 page variables

2003-07-28 Thread Ow Mun Heng
Hi,

Is it advisable to use SESSIONS to store variable from one page to
another page instead of using something like a hidden field?

eg: 
$_SESSION['sql_sort_cat']
$_SESSIOn['sql_sort_dir']

instead of

input type=hidden value=?php $sql_sort_cat? 


Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] using SESSIONS to store page 2 page variables

2003-07-28 Thread Marek Kilimajer
No problem, but remember the user might want to bookmark the page.

Ow Mun Heng wrote:
Hi,

Is it advisable to use SESSIONS to store variable from one page to
another page instead of using something like a hidden field?
eg: 
$_SESSION['sql_sort_cat']
$_SESSIOn['sql_sort_dir']

instead of

input type=hidden value=?php $sql_sort_cat? 

Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] using SESSIONS to store page 2 page variables

2003-07-28 Thread Ow Mun Heng
I think it's OK since users needs to be authenticated.

Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168


-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
Sent: Monday, July 28, 2003 4:46 PM
To: Ow Mun Heng
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] using SESSIONS to store page 2 page variables


No problem, but remember the user might want to bookmark the page.

Ow Mun Heng wrote:
 Hi,
 
   Is it advisable to use SESSIONS to store variable from one page to
 another page instead of using something like a hidden field?
 
 eg: 
 $_SESSION['sql_sort_cat']
 $_SESSIOn['sql_sort_dir']
 
 instead of
 
 input type=hidden value=?php $sql_sort_cat? 
 
 
 Cheers,
 Mun Heng, Ow
 H/M Engineering
 Western Digital M'sia 
 DID : 03-7870 5168
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Using Sessions under Win98/Apache

2002-05-16 Thread Neil Freeman

FYI...

I'm using sessions successfully using PHP v4.1.0 on Windows NT.

Neil

Edward Marczak wrote:
 
 
*
 This Message Was Virus Checked With : SAVI 3.57 May 2002 Last Updated 13th May 2002
 
*
 
 On 5/15/02 4:30 PM, SHEETS,JASON (Non-HP-Boise,ex1)
 [EMAIL PROTECTED] pressed the keys forming the message:
 
  Sessions under windows were broken for 4.1.x
 
  They were fixed in 4.2.x so you should upgrade.
 
 Great - a definitive answer.  Thank you.  I'll just have to make note of the
 differences between 4.2.x and older versions.
 
 Thanks everyone who sent over tips and suggestions.
 --
 Ed Marczak
 [EMAIL PROTECTED]
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
| Neil Freeman   Design Engineer  |
| Phone: +44 (0)1420 526600  Fax  : +44 (0)1420 23741 |
| Email: [EMAIL PROTECTED]   |
|[EMAIL PROTECTED]|
| Web  : www.curvedvision.com |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Using Sessions under Win98/Apache

2002-05-16 Thread Edward Marczak

On 5/16/02 5:17 AM, Neil Freeman [EMAIL PROTECTED] wrote:

 FYI...
 
 I'm using sessions successfully using PHP v4.1.0 on Windows NT.

Hurmph.  Well, the upgrade to 4.2.x did it for me under 98.  I just need to
check the rest of my code, though.  For now, seems pretty harmless.  Thanks,
though.
-- 
Ed Marczak
[EMAIL PROTECTED]

P.S.  Are you also using Apache?  Or IIS?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Using Sessions under Win98/Apache

2002-05-15 Thread Edward Marczak

I've been developing a PHP driven site that will ultimately run under
Solaris and Linux - no problems there.

But I set up a small development/test environment on my laptop running
Win98.  Downloaded the PHP binary (v 4.1.2) along with Apache (v 1.3.24) and
MySQL.  Everything works greatalmost.

Sessions aren't working for some reason.  Yes, they're enabled in my php.ini
file (and running a php_info() confirms that session support is enabled).
The odd thing is, is that it will create the 'sess_038d7' file.  Just no
data goes into it.

Yes, I'm running the exact same code against it that I'm running against the
Solaris and Linux PHP.

Is there something different about the Windows version that I don't know
that is causing my sessions to not work?

Thanks!
-- 
Ed Marczak
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Using Sessions under Win98/Apache

2002-05-15 Thread 1LT John W. Holmes

You probably want to get 4.2, or 4.2.1 if it's out.

How are you registering variables for the session? Is register_globals on or
off in your php.ini.

If it's off, you register a variables just by using
$_SESSION[var] = value;
instead of using
session_register(var);
$var = value;

If register globals is on, then use the second method with
session_register().

This is all after you call session_start, of course.

---John Holmes...

- Original Message -
From: Edward Marczak [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 15, 2002 12:04 PM
Subject: [PHP] Using Sessions under Win98/Apache


 I've been developing a PHP driven site that will ultimately run under
 Solaris and Linux - no problems there.

 But I set up a small development/test environment on my laptop running
 Win98.  Downloaded the PHP binary (v 4.1.2) along with Apache (v 1.3.24)
and
 MySQL.  Everything works greatalmost.

 Sessions aren't working for some reason.  Yes, they're enabled in my
php.ini
 file (and running a php_info() confirms that session support is enabled).
 The odd thing is, is that it will create the 'sess_038d7' file.  Just
no
 data goes into it.

 Yes, I'm running the exact same code against it that I'm running against
the
 Solaris and Linux PHP.

 Is there something different about the Windows version that I don't know
 that is causing my sessions to not work?

 Thanks!
 --
 Ed Marczak
 [EMAIL PROTECTED]


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Using Sessions under Win98/Apache

2002-05-15 Thread Edward Marczak

On 5/15/02 2:21 PM, 1LT John W. Holmes [EMAIL PROTECTED] pressed
the keys forming the message:

 You probably want to get 4.2, or 4.2.1 if it's out.

Didn't think those were considered production quality just yet.

 How are you registering variables for the session? Is register_globals on or
 off in your php.ini.

Off

 If it's off, you register a variables just by using
 $_SESSION[var] = value;
 instead of using
 session_register(var);
 $var = value;

Yeah, I'm using $_SESSION[blah]

 If register globals is on, then use the second method with
 session_register().
 
 This is all after you call session_start, of course.

Of course.

Again, this is all code that works perfectly against a setup I have on
Solaris and Linux.  And again, I'm using a file handler for sessions, and
the 'sess_037df7670' file gets created.  Just that nothing ends up in it
- which is a problem when PHP goes to retrieve a session.

Thanks for the response.
-- 
Ed Marczak
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Using Sessions under Win98/Apache

2002-05-15 Thread Edward Marczak

On 5/15/02 3:47 PM, 1LT John W. Holmes [EMAIL PROTECTED] pressed
the keys forming the message:

 I'm not sure what it could be then. If you try a simple test script, doing
 nothing but starting a session and setting a value, does it work?

No.

 If that still doesn't work, then definitely upgrade to 4.2.1.

The reality is, why should I?  I want to match my production environment as
closely as possible.  Is this working for other people or not (under
Win98/WinApache)?  Are you saying that sessions never worked under this
configuration until v 4.2.1?

 Load this script up:
 ?
 session_start();
 if(isset($_SESSION[var]))
 { echo variable is already set; }
 else
 { $_SESSION[var] = one; }
 echo pClick a href= . $_SERVER[SCRIPT_NAME] . here/a;
 ?

It remembers the variable for the duration of the script.  Once the page is
reloaded, since the session is never written, I get nothing.

I appreciate your help on this.  However, my frustration is that it's not my
code, it's something with the system setup - which seems right!
-- 
Ed Marczak
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Using Sessions under Win98/Apache

2002-05-15 Thread Edward Marczak

On 5/15/02 4:30 PM, SHEETS,JASON (Non-HP-Boise,ex1)
[EMAIL PROTECTED] pressed the keys forming the message:

 Sessions under windows were broken for 4.1.x
 
 They were fixed in 4.2.x so you should upgrade.

Great - a definitive answer.  Thank you.  I'll just have to make note of the
differences between 4.2.x and older versions.

Thanks everyone who sent over tips and suggestions.
-- 
Ed Marczak
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Using sessions

2002-02-25 Thread Joel Alexandre


i'm having some trouble using sessions.

first of all i have to use php 4.0.6.

When i use $HTTP_SESSION_VARS, the session variable isn't
being saved.

for example:
if(!isset($HTTP_SESSION_VARS['id'])){
$HTTP_SESSION_VARS['id'] = 0;   
}
else{
$HTTP_SESSION_VARS['id']++;
}
echo $HTTP_SESSION_VARS['id'];
 
every time i refresh the browser it returns 0.
i have version 4.1.6(i tink. it's the last one)at home and it works fine.

but if i use the session_register it all works ok.


i've tried to use global $HTTP_SESSION_VARS but nothing changed.

could someone help

thanks

Joel Alexandre
Lisboa
Portugal


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Using sessions

2002-02-25 Thread Kevin Stone

Just a guess but would using session_register(myvar); instead of
registering directly to the global list make any difference?


-Original Message-
From: Joel Alexandre [mailto:[EMAIL PROTECTED]] 
Sent: Monday, February 25, 2002 9:39 AM
To: Lista de PHP
Subject: [PHP] Using sessions


i'm having some trouble using sessions.

first of all i have to use php 4.0.6.

When i use $HTTP_SESSION_VARS, the session variable isn't
being saved.

for example:
if(!isset($HTTP_SESSION_VARS['id'])){
$HTTP_SESSION_VARS['id'] = 0;   
}
else{
$HTTP_SESSION_VARS['id']++;
}
echo $HTTP_SESSION_VARS['id'];
 
every time i refresh the browser it returns 0.
i have version 4.1.6(i tink. it's the last one)at home and it works
fine.

but if i use the session_register it all works ok.


i've tried to use global $HTTP_SESSION_VARS but nothing changed.

could someone help

thanks

Joel Alexandre
Lisboa
Portugal


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] using sessions and include

2001-11-13 Thread jtjohnston

Martin, are ya out there? Does anyone know anything about sessions? (An
post  reply would be handy :)

I am using session_register. I have:

http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/index.html
http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/index.html.phps

Which submits to:

http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/postcard.php

http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/postcard.phps

postcard.php  is supposed to pass data to display_image.php

http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/display_image.php

http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/display_image.phps

The problem is that display_image.php loses my data coming from
index.html

}else{
include display_image.php;
}

But when I try to debug and remove the \\ on lines 3  4

//include(display_image.php);
//exit;

display_image.php will display my data correctly from index.html

Can anyone help? What am I doing wrong?

John




Re: [PHP] Using sessions

2001-03-14 Thread Yasuo Ohgaki
"Rosen" [EMAIL PROTECTED] wrote in message
98n8ut$m26$[EMAIL PROTECTED]">news:98n8ut$m26$[EMAIL PROTECTED]...
 Hi,
 When I use sessions, on the URL row of the browser shows
 "PHPSESSID=CXXX".
 Can I hide id ?

 Thanks,
 Rosen Marinov

Use cookie for session. It seems there are some browsers that will not take
cookie on initial request, and  fallback to URL mode. See notes session section
in Online PHP Manual for details.

Regards,
--
Yasuo Ohgaki



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


Re: [PHP] Using sessions

2001-03-14 Thread Rosen

Thanks,
but cookies are disabled !

Rosen Marinov



""Yasuo Ohgaki"" [EMAIL PROTECTED] wrote in message
98nai7$2gb$[EMAIL PROTECTED]">news:98nai7$2gb$[EMAIL PROTECTED]...
 "Rosen" [EMAIL PROTECTED] wrote in message
 98n8ut$m26$[EMAIL PROTECTED]">news:98n8ut$m26$[EMAIL PROTECTED]...
  Hi,
  When I use sessions, on the URL row of the browser shows
  "PHPSESSID=CXXX".
  Can I hide id ?
 
  Thanks,
  Rosen Marinov

 Use cookie for session. It seems there are some browsers that will not
take
 cookie on initial request, and  fallback to URL mode. See notes session
section
 in Online PHP Manual for details.

 Regards,
 --
 Yasuo Ohgaki



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Using sessions

2001-03-14 Thread Stewart Taylor

An idea is to put the session id in your web page addresses.
e.g. http://level1/level2/12123234234234234234/test.php

Then setup your web server to filter all addresses to remove the session id
from the address before it is displayed in the browser window (you can set
apache to do this) so the user won't see it.

You can then write a little code to get the session id from the address (the
full address including session should be passed to your app).  And then
recreate the session etc..

I've got some code at home demonstrating this technique.  I can send it to
you later of you want it.



-Stewart


-Original Message-
From: Rosen [mailto:[EMAIL PROTECTED]]
Sent: 14 March 2001 08:52
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Using sessions


Thanks,
but cookies are disabled !

Rosen Marinov



""Yasuo Ohgaki"" [EMAIL PROTECTED] wrote in message
98nai7$2gb$[EMAIL PROTECTED]">news:98nai7$2gb$[EMAIL PROTECTED]...
 "Rosen" [EMAIL PROTECTED] wrote in message
 98n8ut$m26$[EMAIL PROTECTED]">news:98n8ut$m26$[EMAIL PROTECTED]...
  Hi,
  When I use sessions, on the URL row of the browser shows
  "PHPSESSID=CXXX".
  Can I hide id ?
 
  Thanks,
  Rosen Marinov

 Use cookie for session. It seems there are some browsers that will not
take
 cookie on initial request, and  fallback to URL mode. See notes session
section
 in Online PHP Manual for details.

 Regards,
 --
 Yasuo Ohgaki



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Using sessions

2001-03-13 Thread Rosen

Hi,
When I use sessions, on the URL row of the browser shows
"PHPSESSID=CXXX".
Can I hide id ?

Thanks,
Rosen Marinov




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]