Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #16595
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Automatically doing something if logged in |
| Date | 2016-02-22 22:25 +0100 |
| Organization | PointedEars Software (PES) |
| Message-ID | <10712164.vGqmpjOXJh@PointedEars.de> (permalink) |
| References | <1b712b26-1665-45f9-9017-1dcf9e8bfbcb@googlegroups.com> <dj15eeF12e3U1@mid.individual.net> |
J.O. Aho <user@example.net> wrote: JFYI: Abuse of the example.net domain (and sibling second-level domains, and the “example” TLD) is disregarding the “Sender Address” section of the Acceptable Use Policy of news.individual.net and “may cause termination of access privileges without further notice. Amounts paid will not be refunded, neither partly nor in full.” <http://news.individual.net/rules.php> (Individuals abusing the “.invalid” TLD instead, which is mistakenly recommended by that Usenet provider for everyday use with Usenet postings instead of only private testing, end up in my killfile automatically.) <http://www.interhack.net/pubs/munging-harmful/> > On 02/22/2016 07:02 PM, bit-naughty@hotmail.com wrote: >> So say there's a forum site, and if there' been a reply to a post I've >> made, it sends me a link to that thread. If I click on it, and I've >> remained logged in when I was there last, then it *automatically takes me >> to that thread*. If I wasn't, then it shows me a Login box - when I log >> in it *automatically takes me to that thread*, but if I just went to the >> homepage NOT clicking on any email link, and I THEN log in, then it shows >> me something else (like "My homepage" or something), NOT that thread. >> It's quite late, am I making sense? :) How is this pulled off? > > If you want things to happen "automagically", then you need to think > more than just PHP, add some javascript (there are loads of good > frameworks) ISTM that you have misunderstood the OP to mean that the viewport is automatically scrolled to the thread if they are logged in, have the forum displayed, and there are updates in that thread. (Because I misunderstood it in the same way at first.) But that is actually not what was being asked. Instead, the OP wondered how following the same link in the same e-mail can have different outcomes depending on the login state, and how submitting a login form can have a different outcome if it was triggered by a link in an e-mail. What probably happens here is that the URI of the link contains the thread/follow-up ID, and a cookie in the browser tells the forum/bulletin board application (phpBB?) about the login state of the user. If the user was not logged in before, then a login form is displayed that contains hidden fields (“<input type="hidden" name="…" value="…">”) that are populated with the thread/follow-up ID. The server-side script receiving the submitted form data then does the same as if the link URI had been used (presumably by server-side redirection) if the login is successful. The login form is not populated with the thread/follow-up ID if the link is not used to navigate to the form, so “something else” is shown instead if the login is successful. However, FWIW, following my comment on the use-case that you probably misunderstood from the OP: There is no “javascript” [0], and there are lots of *bad* frameworks for client-side ECMAScript-based scripting. Fortunately, a framework/library would be overkill here. > and use websockets. This is not a use-case where real-time updates are important and WebSocket would therefore be one of the preferred choices. It suffices, for example, if the thread(s) is/are checked for relevant updates every 5 seconds. Therefore, one should take into consideration that client-side support for WebSocket is still experimental [1] (and had been disabled in Firefox by default from version 4 to 23 inclusive [2]), and it might not be feasible to use a framework for PHP like Ratchet [3] on that server or with that forum application. So it is better to use XMLHttpRequest [4] for the time being (XML does not have to be used in the HTTP messages, JSON is more lightweight), and pull the server-side application for updates (GET) e.g. every 5 seconds. ___________ [0] <http://PointedEars.de/es-matrix> [1] <https://developer.mozilla.org/en-US/docs/Web/API/WebSocket> [2] <http://www.0xdeadbeef.com/weblog/2010/12/disabling-websockets-for-firefox-4/> [3] <http://socketo.me/> [4] <https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest> -- PointedEars Zend Certified PHP Engineer <http://www.zend.com/en/yellow-pages/ZEND024953> | Twitter: @PointedEars2 Please do not cc me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Automatically doing something if logged in bit-naughty@hotmail.com - 2016-02-22 10:02 -0800
Re: Automatically doing something if logged in Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-22 14:04 -0500
Re: Automatically doing something if logged in "J.O. Aho" <user@example.net> - 2016-02-22 20:21 +0100
Re: Automatically doing something if logged in Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-22 14:52 -0500
Re: Automatically doing something if logged in "J.O. Aho" <user@example.net> - 2016-02-23 06:58 +0100
Re: Automatically doing something if logged in Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-02-22 22:25 +0100
Re: Automatically doing something if logged in "J.O. Aho" <user@example.net> - 2016-02-23 07:04 +0100
Re: Automatically doing something if logged in Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-02-23 08:31 +0100
Re: Automatically doing something if logged in Arno Welzel <usenet@arnowelzel.de> - 2016-02-23 08:24 +0100
Re: Automatically doing something if logged in Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-02-23 08:46 +0100
Re: Automatically doing something if logged in Arno Welzel <usenet@arnowelzel.de> - 2016-02-23 11:36 +0100
Re: Automatically doing something if logged in Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-02-23 21:02 +0100
Re: Automatically doing something if logged in Arno Welzel <usenet@arnowelzel.de> - 2016-02-23 08:10 +0100
csiph-web