# \[Pro\] PHP\_PageProtect: What is 'Session ID'?

**URL:** <https://discourse.softpress.com/t/pro-php-pageprotect-what-is-session-id/15210>\
**Category:** ActionsDev\
**Created:** [September 26, 2012, 5:31pm UTC](https://discourse.softpress.com/t/pro-php-pageprotect-what-is-session-id/15210 "2012-09-26T17:31:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fontfitter](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/f/67e7ee/32.png) [@Fontfitter](https://discourse.softpress.com/u/Fontfitter)\
**Post date:** [September 26, 2012, 5:31pm UTC](https://discourse.softpress.com/t/pro-php-pageprotect-what-is-session-id/15210/1 "2012-09-26T17:31:14Z")

</div>

What is “Session ID” used for in this fwaction? I tried entering just numbers but it does not want that. Puzzled…

Adrian Williams

[http://actionsforge.com/actions/view/255-php-pageprotect](http://actionsforge.com/actions/view/255-php-pageprotect)

* * *

actionsdev mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![waltd](https://discourse.softpress.com/user_avatar/discourse.softpress.com/waltd/32/2720_2.png) [@waltd](https://discourse.softpress.com/u/waltd)\
**Post date:** [September 26, 2012, 5:37pm UTC](https://discourse.softpress.com/t/pro-php-pageprotect-what-is-session-id/15210/2 "2012-09-26T17:37:04Z")

</div>

The name of the session ID variable used by the PHP code and application server. PHP variable names (as in most languages) cannot begin with a numeral, so that’s why it hated what you entered.

Walter

On Sep 26, 2012, at 1:31 PM, Adrian Williams wrote:

> What is “Session ID” used for in this fwaction? I tried entering just numbers but it does not want that. Puzzled…
> 
> Adrian Williams
> 
> [PHP -PageProtect - ActionsForge](http://actionsforge.com/actions/view/255-php-pageprotect)
> 
> * * *
> 
> actionsdev mailing list  
> email@hidden  
> Update your subscriptions at:  
> [http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

* * *

actionsdev mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![Fontfitter](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/f/67e7ee/32.png) [@Fontfitter](https://discourse.softpress.com/u/Fontfitter)\
**Post date:** [September 26, 2012, 5:48pm UTC](https://discourse.softpress.com/t/pro-php-pageprotect-what-is-session-id/15210/3 "2012-09-26T17:48:19Z")

</div>

So does that variable change in the fwaction dialog or is it changed per-session by the PHP code? Don’t know how a ‘session’ is created.

Sounds like I need to have some PHP processing what is entered and checking various things. Where do I start with that - any suggestions?

Adrian Williams

* * *

actionsdev mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![david.ledger](https://discourse.softpress.com/user_avatar/discourse.softpress.com/david.ledger/32/53_2.png) [@david.ledger](https://discourse.softpress.com/u/david.ledger)\
**Post date:** [September 26, 2012, 7:01pm UTC](https://discourse.softpress.com/t/pro-php-pageprotect-what-is-session-id/15210/4 "2012-09-26T19:01:20Z")

</div>

At 13:31 -0400 26/9/12, Adrian Williams wrote:

> What is “Session ID” used for in this fwaction? I tried entering  
> just numbers but it does not want that. Puzzled…

At 13:48 -0400 26/9/12, Adrian Williams wrote:

> So does that variable change in the fwaction dialog or is it changed  
> per-session by the PHP code? Don’t know how a ‘session’ is created.
> 
> Sounds like I need to have some PHP processing what is entered and  
> checking various things. Where do I start with that - any  
> suggestions?

When you use PHP (or, I presume, similar) on your site, and you use  
the server function that starts a new session (session\_start() in  
PHP, which I assume here) with no arguments, a new ‘session’ comes  
into being. It has an ID and a storage area on the server. The  
Session ID (which is just a currently unique big number) will be sent  
to the browser as a cookie and when the PHP script finishes doing its  
thing, whatever is in the variable $\_SESSION gets saved in the server  
storage area as the page gets sent.

When a submission is next made from that or an associated page, the  
cookie is also sent as usual. If the PHP in the called page does a  
session\_start() with an argument that is the Session ID from the  
cookie, the $\_SESSION variable gets filled with whatever was saved in  
the storage area against that Session ID. So it’s a way to store  
stuff between multiple calls to a page or associated pages. In  
practice there are shortcuts to this.

The storage area is only kept by the server for a short time. The  
time will be part of the server configuration. You will have  
experienced ‘session timeout’ no doubt. That is because the server  
has decided to throw away the storage area for that session. That  
should give you an idea as to the time. If you need to store data for  
longer, a database is needed. The data saved can be anything, from a  
single value to a vast tree of information. I haven’t been able to  
get a definitive answer, but I would expect that saving and  
retrieving a tree of session data will use fewer resources than doing  
the same to a database as a database would be doing much the same  
internally (although invisibly) and there is extra overhead. As an  
example, [kirkhouse.co.uk](http://kirkhouse.co.uk) saves many KB in $\_SESSION between request  
submissions including AJAX requests. (I haven’t been asked to  
complete that site as the ownership has changed).

David

–  
David Ledger - Freelance Unix Sysadmin in the UK.  
email@hidden  
[www.ivdcs.co.uk](http://www.ivdcs.co.uk)

* * *

actionsdev mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![Fontfitter](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/f/67e7ee/32.png) [@Fontfitter](https://discourse.softpress.com/u/Fontfitter)\
**Post date:** [September 27, 2012, 6:20am UTC](https://discourse.softpress.com/t/pro-php-pageprotect-what-is-session-id/15210/5 "2012-09-27T06:20:27Z")

</div>

Many, many thanks David for that explanation. It makes sense now. Since only a login is being done it won’t need a database. I’ll research the rest.

Cheers,  
Adfrian

* * *

actionsdev mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)
