Jump to content

Recommended Posts

Dear Friends,

 

Can anyone suggest how I can make a Session like variable to be a permanent one? What I mean is, session variables will die after a client ceases to be around; what I want is, this variable should be always around from the time server is turned on till of, please don’t suggest MySQL. I want a memory slot.

 

In ASP we can use “Global.asa”

 

Link to comment
https://forums.phpfreaks.com/topic/51770-permanent-session-variable/
Share on other sites

Run it such as this...

 

<?php
$variable = 'foo';
?>

 

then if you wish for the user to be able to edit the variable it would depend on how you wish for them to edit the variable...

 

<?php
$variable = 'foo';

$switch ($act) {
case act:
$variable = $_REQUEST['textfield'];
break;
}
?>
<form name="form1" method="post" action="?act=edit">
  <label>
  <input type="text" name="textfield">
  </label>
  <label>
  <input type="submit" name="Submit" value="Submit">
  </label>
</form>

 

and that would set the thing to foo, and then when you use the form it would update it to whatever you want...  perhaps this is what you want?

Dear Radar,

 

Thanks for your help. I will tell you my idea.

 

I will gave ONE global variable ((i)session type[varible to reside in server], (ii)assesible to all clients,  (iii)variable value should be changable at run time by all clients)

 

please advice a method that will help me thanks.

I squeezed my brain but not getting anywhere, with ASP yes it is possible; PHP I can't figure out.

I don't know a lot about ASP but with PHP to make a global session to my knowledge is impossible in PHP...  The only other way i could think about doing it would be to use a flat-file since you don't want to use mysql (which i use for everything)....

 

I did a spot of searching and i found this for you...

 

http://koivi.com/manual-php-globals/

 

it doesn't go into a whole lot of detail but might be more along the lines of what you are looking for.

I will keep you in mind as i run across any other information on this subject.  As for sweat, no way -- PHP is my life, i develop websites professionally and use PHP as my foundation -- and so without PHP I would die.

 

Speaking of -- take a look at this right here -- might have some useful information for you.

 

http://www.onlamp.com/pub/a/php/2004/05/13/shared_memory.html

Just set the session cookie to expire later.

 

The first argument to session_set_cookie_params is the number of seconds in the future (based on the server's current time) that the session will expire.  So if you want your sessions to last 100 days:

 

$expireTime = 60*60*24*100; // 100 days

session_set_cookie_params($expireTime);

Dear Experts,

 

I sincerely want help.

OK, I will tell you what is in my mind.

 

I am going to use this particular variable as a gate flag.

 

When gate flag is ok, all cliants get to work on server, if not, no.

 

I am extanding this idea from my own server programe, I made earlier.

 

I can implement using Global.ASA in asp, but I am looking for something similar in PHP.

 

I appreciate your experience thanks.

:'( Yes I agree, I very tried hard too.

 

OK can any one suggest a method on how could I implement.

 

One of the two reason I need this.

 

If I want to turn off server, I should not simply OFF, I should allow "all already in clients" to complete what they are there for, at the same time block new hook ons, if not "all already in clients" will loose unprocessed data.

 

Please I will take any suggestions.

 

 

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.