[PHP] Sessions in PHP... where to start???

2006-02-27 Thread Kostas Tsirigos
Hi everybody!
I have a problem and I was told to check out the sessions part in PHP.
What I want to deal with is the following :
I have a PHP page with a form, where the user writes some data. These data are 
then written into a file which is then used in a system command as input for an 
external program (NOTE: The data MUST be written into a file, it cannot be done 
elsewhise, because the external program takes a file as input).
The thing is that I must somehow create a file everytime a user enters data 
into the form, so I must learn something on sessions I think.
My question is, since I don't have a login system or something like that, but 
just want to create a different file each time (with the session_id being part 
of it, so that the file is unique), which session commands do I need?


-
 Yahoo! Mail
 Use Photomail to share photos without annoying attachments.

Re: [PHP] Sessions in PHP... where to start???

2006-02-27 Thread Philip Hallstrom
Hi everybody! I have a problem and I was told to check out the sessions 
part in PHP. What I want to deal with is the following : I have a PHP 
page with a form, where the user writes some data. These data are then 
written into a file which is then used in a system command as input for 
an external program (NOTE: The data MUST be written into a file, it 
cannot be done elsewhise, because the external program takes a file as 
input). The thing is that I must somehow create a file everytime a user 
enters data into the form, so I must learn something on sessions I 
think. My question is, since I don't have a login system or something 
like that, but just want to create a different file each time (with the 
session_id being part of it, so that the file is unique), which session 
commands do I need?


If it were me I'd use tempnam() to create a unique file for that 
particular user and then use sessions to store the name of that file in 
the user's cookies...


http://us2.php.net/tempnam
http://us2.php.net/manual/en/ref.session.php

-philip

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



Re: [PHP] Sessions in PHP... where to start???

2006-02-27 Thread Curt Zirzow
Well for the latter part of your question.. 'Where to start??'  the
first thing to start with is to NOT reply to a topic and change
your subject to ask something else, instead click the icon in your
email application that indicates a new message and compose your
question addressed to php-general@lists.php.net

Curt.
-- 
cat .signature: No such file or directory

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



[PHP] Sessions and PHP

2004-03-26 Thread Patrik Fomin
Let me rephrase it,

i got a login page, once logged in you you got the session
$_SESSION['in'] = true;

i want to be able to count the number of people that are logged in atm,
so when they logout with either logout button or close the window, i want to
then decrese the number.

In asp, you just used Session_Destroy() to determine if all sessions were
destroyed and then
APPLICATION['num'] = APPLICATION['num'] - 1

Is there anyway in php to do this?

regards
patrick
- Original Message -
From: Patrik Fomin [EMAIL PROTECTED]
Newsgroups: php.general
To: [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 2:05 AM
Subject: Sessions and PHP


 Hi,,

 is there anyway to get the number of people connected to the site?
 in asp you just use Application and session_terminate to accomplish this
 is there anyway to do this in PHP ?

 regards
 patrick

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



Re: [PHP] Sessions and PHP

2004-03-26 Thread John W. Holmes
Patrik Fomin wrote:
Let me rephrase it,

i got a login page, once logged in you you got the session
$_SESSION['in'] = true;
i want to be able to count the number of people that are logged in atm,
so when they logout with either logout button or close the window, i want to
then decrese the number.
In asp, you just used Session_Destroy() to determine if all sessions were
destroyed and then
APPLICATION['num'] = APPLICATION['num'] - 1
Is there anyway in php to do this?
No, as PHP does not have application variables. Keep a count in a file 
and increment / decrement manually.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


Re: [PHP] Sessions and PHP

2004-03-26 Thread Patrik Fomin
how do i determine if a session has been destroyed/created ?

patrick
John W. Holmes [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
 Patrik Fomin wrote:
  Let me rephrase it,
 
  i got a login page, once logged in you you got the session
  $_SESSION['in'] = true;
 
  i want to be able to count the number of people that are logged in atm,
  so when they logout with either logout button or close the window, i
want to
  then decrese the number.
 
  In asp, you just used Session_Destroy() to determine if all sessions
were
  destroyed and then
  APPLICATION['num'] = APPLICATION['num'] - 1
 
  Is there anyway in php to do this?

 No, as PHP does not have application variables. Keep a count in a file
 and increment / decrement manually.

 --
 ---John Holmes...

 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

 php|architect: The Magazine for PHP Professionals – www.phparch.com

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



[PHP] Sessions and PHP

2004-03-24 Thread Patrik Fomin
Hi,,

is there anyway to get the number of people connected to the site?
in asp you just use Application and session_terminate to accomplish this
is there anyway to do this in PHP ?

regards
patrick

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



Re: [PHP] Sessions and PHP

2004-03-24 Thread Filip de Waard
On Mar 25, 2004, at 2:05 AM, Patrik Fomin wrote:
is there anyway to get the number of people connected to the site?
in asp you just use Application and session_terminate to accomplish 
this
is there anyway to do this in PHP
Hi Patrick,

As far as I know this is not possible with default PHP sessions, but 
when you store your sessions in a database using your own session 
handler (http://nl.php.net/session_set_save_handler) this can be 
achieved easily.

Regards,

Filip de Waard

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


Re: [PHP] Sessions and PHP

2004-03-24 Thread Chris Shiflett
--- Patrik Fomin [EMAIL PROTECTED] wrote:
 is there anyway to get the number of people connected to the site?
 in asp you just use Application and session_terminate to accomplish
 this is there anyway to do this in PHP?

Taken literally, you are asking about the number of active connections,
meaning people who happen to be in the middle of sending or receiving an
HTTP message.

I think you mean something else, which is how many people have visited
your site recently. You just have to determine what you consider to be
recently, and then count the number of active sessions whose last visit is
within that threshhold.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



[PHP] sessions and php

2003-09-18 Thread Patrik Fomin
Hi,

can anyone help my list the ways to create/view a session, i need to find
out if my host supports any of em (kinda strange host), eg:

page1.php

start_session[test]
register_session[test2]
etc

page2.php

retrive session 1, 2 etc and display their contents

regards
patrick

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



Re: [PHP] sessions and php

2003-09-18 Thread Chris Shiflett
--- Patrik Fomin [EMAIL PROTECTED] wrote:
 start_session[test]
 register_session[test2]

Please read this:

http://www.php.net/session

Hope that helps.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

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



Re: [PHP] sessions and php

2003-09-18 Thread Justin French
Assuming PHP = 4.1

page1.php

?
// continue or create a session
session_start();
// set some session vars
$_SESSION['color'] = 'red';
$_SESSION['name'] = 'Justin';
?
page2.php

?
// continue or create a session
session_start();
// echo some session vars
echo Hello {$_SESSION['name']}, your favourite color is 
{$_SESSION['color']};

// clear some session vars
unset($_SESSION['name']);
// modify some session vars
$_SESSION['color'] = 'blue';
?
Similar tests can all be found on http://au.php.net/session

Justin



On Friday, September 19, 2003, at 12:22  PM, Patrik Fomin wrote:

Hi,

can anyone help my list the ways to create/view a session, i need to 
find
out if my host supports any of em (kinda strange host), eg:

page1.php

start_session[test]
register_session[test2]
etc
page2.php

retrive session 1, 2 etc and display their contents

regards
patrick
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
---
[This E-mail scanned for viruses]

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