alluoshi
Members-
Posts
25 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
alluoshi's Achievements
Member (2/5)
0
Reputation
-
Thanks, apparently I got a reply while I was typing mine. I am interested to store the session end time. we have 3 options: 1- when the user logs out, this is easy, I can store time() in a variable and send it to a database 2- After 20 minutes of inactivity (this in my case). I can also handle this by storing last access time in a session variable and test if time() - $_SESSION['time'] > 1200 then send $_SESSION['time'] to the database 3- Now, what about if the user closes the browser, can I handle this to know the session end date?
-
Thanks for replying. With respect to the 1440 seconds, does that mean the garbage collection will delete the session after 1440 seconds since the last time the user has refreshed a session-enabled page? (I mean not the first time when the session was created) second, where does the browser store a session cookie (location on hard disk?) it is not in the directory where all cookies are stored. this is at least in Internet explorer
-
Hi, when the user visits a session enabled page for the first time, the web server creates a cookie that holds the session ID and sends it to client. 1- Where is this cookie located? I can see it from the browser -> show cookies but when I go to the location where all cookies are stored, I can't find it 2- What is the size of this session cookie? 3- the default session time in php is 1440 seconds. Does that mean every time the user refreshes a session-enabled page, the new expiry date of the cookie will be changed to time() + 1440?
-
[SOLVED] Still get the same session id after I log out
alluoshi replied to alluoshi's topic in PHP Coding Help
Thank you. It worked like this: the log out file code: session_start(); session_regenerate_id(); session_unset(); session_destroy(); -
[SOLVED] Still get the same session id after I log out
alluoshi replied to alluoshi's topic in PHP Coding Help
I changed the code in the log out file to: session_start(); session_unset(); session_destroy(); setcookie("PHPSESSID", "", time()-3600); but it still doesn't work. when I log in again, I still have the same session id. The only way to get a new session id is to go to the browser and delete the cookie explicitly. -
Hi, I have an application with sessions/cookies. When I log out and then log in, I still get the same session id even if I log in with different user. How can I correct this so that any user gets a new session id when they log in. my code for logout page is: session_start(); session_unset(); session_destroy(); Note: The logout works because I tried to access members' pages after I log out and it asked me to log in again.
-
Hello, if I have <Form Action = "x.php?add some stuff here" Method = post> this works when I hit the button, the new URL will be "x.php?add some stuff here". I tried the same with the GET method like: <Form Action = "y.php?add some stuff here" Method = GET> but didn't work. The URL always shows "y.php? submit=value". 1- Is there any way to fix this problem using GET? 2- I used POST instead of GET for y.php (which is a file to retrieve data). It worked; the new URL has changed and it displays the same data as it is in GET. But this will show that I am using the method POST to retrieve data which doesn't make sense. Is there a better approach than this?
-
how to use $_COOKIE['PHPSESSID'] inside the header function?
alluoshi replied to alluoshi's topic in PHP Coding Help
because I need Apache to log the url of the request with the session id. Is there a way to define $id=$_COOKIE['PHPSESSID'] in the page main.php after session_start() and allow this variable "$id" to be accessible in any page. In this case I can solve my problem when I use header("Location:.../y.php?sessionid=".print $id). -
I am using the header function for redirection. I would like to include the session id within the URL using the value of the session id that is stored in the cookie. I have 4 files in the same directory. I have "session_start()" in the file main.php where users access this page first. Now When the users access another page (x.php), I want them to be redirected to (y.php) with the session id embedded in the url (this is because Apache logs each request and I need this info later). I would like to retrieve the session id using $_COOKIE['PHPSESSID'] and not session_id(). In the file y.php, I put: header("Location:.../y.php?sessionid=".print $_COOKIE['PHPSESSID']); but didn't work. I noticed that "print $_COOKIE['PHPSESSID']" doesn't work even without header(). I tried $id=$_COOKIE['PHPSESSID'] then "print $id" and it worked. I tried to put $id=$_COOKIE['PHPSESSID'] before the header() so that I can use header("Location:.../y.php?sessionid=".print $id) but it didn't work even with "ob_start()" in the beginning. Any help please?
-
Hello, I have a script to retrieve data from a mysql table and to display the results using mysql_fetch_array(). Everything works fine. My problem is that I want to display the results in a different page. For example, when I reach to the code (echo $id) I want the results to be displayed in a page called display.php. I can't use the header function to redirect to display.php after the code (echo $id) because the header function can only be used in the first line. And if I use the header function in the first line, it will redirect to display.php but the page will be empty. Any help please.
-
Thank you. what about if I have 50 sessions at the same time (50 users)? How can I handle this information (about users and sessions) until this information is saved permanently in the database
-
Hello, I am working on a session-based multi-user web application (through Apache, php and mysql). When a user logs in, a new session starts. I would like to write a program to save this information: 1- the username who joined (originally created in mysql) 2- session id 3- session start date 4- session end date (when the user logs out, or when the browser is closed) so when the session ends, I want this information to be saved in mysql database (the username will be saved in Table "users" and the session_id, session_start_time and session_end_time will be saved in Table "Sessions" Any idea about how to solve this problem?
-
Hello, Apache logs each request and some information about this request, however I want to log the process ID and the cpu usage of each request. I found it possible to log the process ID by changing the default log format. Is there any way that I can log the cpu usage for each process. I can see the cpu usage in the server-status page but I want this information in the log file.
-
How do I tell users that thge server's busy?
alluoshi replied to kevintynfron's topic in Apache HTTP Server
You can play with ListenBacklog directive queue to modify the length of the pending connections -
How do I tell users that thge server's busy?
alluoshi replied to kevintynfron's topic in Apache HTTP Server
In Apache, you can determine the maximum number of simultaneous clients that are using your website. There is a "server limit" which is the OS limit (256 by default on Linux) and there is Maxclients (150 by default if you are using prefork module). If you are using the worker module, there are also settings to set the maximum number of threads. You can play with these numbers but it highly depends on the Hardware of your server to be able to support the clients. What happens is when the number of simultaneous clients exceed the Maxclients, they will wait in a queue until some busy processes are done and can serve new clients