|
|
 Jose - 2007-01-31 21:00:36
Hi, I have a problem... how can save the login status?
For example in yahoo example, imagine that one user execute the script 1000 times, the process are login, do some action, and logout, but If I want login only one time and do some action any times with differents users, how can I do it?
Example:
User 1 Login
- Do some action
user 2 - do some action (not login)
user 3 - do some action (not login)
.
.
.
user n - do some action (if login status is not logged login)
user n+a - do some action
I want do this because I think the login procces spent time and resources.
Have any idea?
Thanks
pd. sorry for my english ;)
 Manuel Lemos - 2007-02-01 00:35:10 - In reply to message 1 from Jose
Once you login, usually the server send a cookie that the class send back on each following request. So, as long as you use the same HTTP class object, it will send the logged in cookie back to the server and you do not have to login over again.
 Jose - 2007-02-01 00:58:14 - In reply to message 2 from Manuel Lemos
But is posible use the same object with multiple clients?, I think that PHP create some process for some users with some ips .... is it correct?
 Manuel Lemos - 2007-02-01 01:16:24 - In reply to message 3 from Jose
I am not sure what you mean by multiple clients.
The cookies returned by a site are kept in a class variable. As long as you use the same object your requests will be seen by the HTTP server as logged user.
You may also save the cookies to files, session variables, databases, etc.. and reuse them later even by different executions of the same script.
 Jose - 2007-02-01 03:06:08 - In reply to message 4 from Manuel Lemos
Thanks...
 Jose - 2007-02-01 03:14:18 - In reply to message 4 from Manuel Lemos
other question... Can save a PHPSID in a bdd, file or similar? for keep the login acount open?
 Manuel Lemos - 2007-02-01 05:06:03 - In reply to message 6 from Jose
If you mean saving retrieved cookies in a PHP session variable, yes but keep in mind that PHP sessions do not use persistent cookies, so those are lost once your browser that accesses the script using the class is closed.
 Jose - 2007-02-03 00:10:30 - In reply to message 7 from Manuel Lemos
Hi, I have two questions more, first I post the headers of my client:
--------------------------
S HTTP/1.1 200 OK
S Date: Fri, 02 Feb 2007 23:59:52 GMT
S Server: Apache/2.2
S X-Powered-By: PHP/5.1.4
S Set-Cookie: PHPSESSID=42ec6567489f129474256be0ebd5084b; path=/
S Expires: Thu, 19 Nov 1981 08:52:00 GMT
S Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
S Pragma: no-cache
S Content-Length: 17
S Connection: close
S Content-Type: text/html
S
S Success on Action
Disconnected from www.porta.net
Connecting to www.porta.net
Resolving HTTP server domain "www.porta.net"...
Connecting to HTTP server IP 200.25.197.202...
Connected to www.porta.net
C POST /popups/sms_send/sms_send.php HTTP/1.1
C Host: www.porta.net
C User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
C Referer: http://www.porta.net/68.html
C Content-Type: application/x-www-form-urlencoded
C Content-Length: 89
C Cookie: PHPSESSID=42ec6567489f129474256be0ebd5084b;
----------------------------
1. Is posible that Connection not close, is possible make the connection "keep-alive"?
2. When I login in the web page the cookie: PHPSESSID=42ec6567489f129474256be0ebd5084b; are create, can I save it for that some users uses the same login info? or save the login status?
Thanks!
 Manuel Lemos - 2007-02-04 19:03:51 - In reply to message 8 from Jose
Currently the class does not support keeping connections alive. I may implement that in a future version.
The PHP session ID is saved to a cookie. You just need to save that cookie value, and set it back later when you access the same server. Keep in mind that PHP expires those cookies after a while without activity.
 Jose - 2007-02-04 20:06:55 - In reply to message 9 from Manuel Lemos
Are there some method to know the time in that cookie expires?
|