Hello
I need to have a way to check if the user as refreshed the current page.
Is there any way in PHP to do this?
Here's the full facts,
I have a JavaScript running that is merely a 30 seconds countdown, so that
the user has only 30 seconds to answer a question.
The problem is that *IF* he refreshs the page the counter goes up again to
30, and that's is not good ;)
i can do whatever i want when the timer reaches 0.
But i was looking for some sort of control to check if the page was loaded
normally, or refreshed.
(i also thought of a MySQL flag, that would be 0 when page is loaded, and
then when reloaded it would check to see if the flag is 0 or 1, and act
accordingly, but somehow i think that there might be a simplier way).
PS: I *dont* want to prevent the refresh I just want to know when/if it
happened.
Please help,
Thanks
RootShell 5 9139
"RootShell" <AN************ ***@Netcabo.ptA NTISPAM> wrote in message
news:41******** **************@ news.telepac.pt ... Hello
I need to have a way to check if the user as refreshed the current page.
Is there any way in PHP to do this?
Here's the full facts,
<snip>
a) Set question; record time page was sent, plus IP address, etc.
b) Receive response (or not, in which case, quit).
c) Check receipt time against set time. If >30 seconds, user loses. If page
re-requested to same IP, user loses. It's your rules, after all.
You can't force this sort of thing client side, you need client-side
processing to do that. Consider Flash or something for the client, and keep
PHP the provision of the data.
Garp
In article <41************ **********@news .telepac.pt>, RootShell wrote: Hello
I need to have a way to check if the user as refreshed the current page.
Is there any way in PHP to do this?
Start a session for each user.
Add every requested page to a stack in that $_SESSION.
--
Tim Van Wassenhove <http://home.mysth.be/~timvw>
"RootShell" wrote: Hello
I need to have a way to check if the user as refreshed the current page.
Is there any way in PHP to do this?
Here’s the full facts,
I have a JavaScript running that is merely a 30 seconds countdown,
so that the user has only 30 seconds to answer a question.
The problem is that *IF* he refreshs the page the counter goes up again to 30, and that’s is not good
i can do whatever i want when the timer reaches 0.
But i was looking for some sort of control to check if the page was loaded normally, or refreshed.
(i also thought of a MySQL flag, that would be 0 when page is
loaded, and then when reloaded it would check to see if the flag is 0 or 1, and act accordingly, but somehow i think that there might be a simplier
way). PS: I *dont* want to prevent the refresh I just want to know
when/if it happened.
Please help,
Thanks RootShell
You can set a cookie, and increment it every time the user refreshes a
page. This works for people who have cookie enabled (90%+), but might
be good enough for your app.
-- http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-detectin...ict133066.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=444435
"RootShell" <AN************ ***@Netcabo.ptA NTISPAM> wrote in message
news:41******** **************@ news.telepac.pt ... Hello
I need to have a way to check if the user as refreshed the current page.
Is there any way in PHP to do this?
Here's the full facts,
I have a JavaScript running that is merely a 30 seconds countdown, so that the user has only 30 seconds to answer a question.
The problem is that *IF* he refreshs the page the counter goes up again to 30, and that's is not good ;)
i can do whatever i want when the timer reaches 0.
But i was looking for some sort of control to check if the page was loaded normally, or refreshed.
(i also thought of a MySQL flag, that would be 0 when page is loaded, and then when reloaded it would check to see if the flag is 0 or 1, and act accordingly, but somehow i think that there might be a simplier way).
PS: I *dont* want to prevent the refresh I just want to know when/if it happened.
Please help,
Thanks RootShell
PHP tip from a fortune cookie: Don't try to solve a client-side problem on
the server side.
The solution is quite simple: Use Javascript to keep a counter in a cookie.
When the page loads initially, the script will notice that the cookie
variable isn't set and will set it to 30. A timer function attached using
setInterval() will decrement the counter by one every second. Now if the
user refreshes the page, the counter won't get reset since cookies are
persistent.
"RootShell" <AN************ ***@Netcabo.ptA NTISPAM> wrote in message
news:41******** **************@ news.telepac.pt ... Hello
I need to have a way to check if the user as refreshed the current page.
issue a "one time ticket" for the page, i.e. call it with
kviz.php?oneTit meTicket=122177 d4880ad8e6b9d0c ae5728fd5bf
the first time page gets loaded, in the db mark the ticket as used (or
remove it from your list of valid tickets, depending on your approach).
rush
-- http://www.templatetamer.com/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gav |
last post by:
Hi,
At the moment i am checking that all the fields have been filled out, at the
moment i am using the following...
if firstname = "" and surname = "" and address1 = "" and town = "" and
county = "" and country = "" and postcode = "" and phone = "" and email11 =
"" and email2 = "" and password1 = "" and password2 = "" then
is there a better more efficient way of doing this??
|
by: Ryan Stewart |
last post by:
I'm working on a project to collect web application usage statistics. What
are the recommended ways of detecting whether a browser is JavaScript
enabled and/or capable? Obviously I can write a script to invoke something
on the server, and if it works, then it works. Is there a better way? I'm
looking for the least intrusive way of doing it, from a web application
point of view. i.e. I'd like to be able to drop this into an existing...
|
by: Dag Sunde |
last post by:
We have this web-app that requires Javascript to
be enabled in the UA (this is okay'ed by our customer).
Now I want to make a "pre" page before the login screen,
informing the user that he/she must have JS turned on.
Problem is that I would prefer to show this page only if
JS isn't on. (and hence, I have a "Chicken/Egg" problem).
If neccessary, we can require IE-only as UA.
|
by: Dag Sunde |
last post by:
Is there a way to detect if the reason an onUnload()
handler was called originated from the user explicitly
refreshed the page(s)?
Ie. pressed "Ctrl-R", "F5" or klicked the refresh button
in the toolbar or the context menu?
I'm aware that I can not stop a refresh, but the reason
I want to know is that I have a hidden frame in an intranet
application. This hidden frame is present at all times after
|
by: Austin Rathe |
last post by:
Dear All,
I need to be able to detect, server side, if the client machine using my
ASP.NET web app supports Javascript. I know there are browser object
properties that tell me if the client browser *in principle* supports
javascript, but as far as I can tell they don't tell you if the user has
disabled scripting manually.
I have seen sites using PHP that can do this, but I can't see how to do
it in .NET. Any ideas?
| |
by: SHarris |
last post by:
Hello,
In our new intranet ASP.NET project, two requirements are that the browser
accept cookies AND JavaScript. We are requiring the use of Internet
Explorer 6+.
1. Using C# in an ASP.NET application, how can we code the project to check
to make sure the browser accepts cookies?
2. Where would we put this code? In Global.asax?
3. Using C# in an ASP.NET application, how can we code the project to
detect and make sure the browser...
|
by: ratnakarp |
last post by:
Hi,
I have a.aspx page, which contains few buttons. On clicking one of the
button, opens b.aspx. I have a button in b.aspx, on clicking, it closes
the b.aspx and refreshes a.aspx. I'm able to close b.aspx and also able
to refresh the a.aspx page. How can i detect the page refresh of
a.aspx in page load for this kind of situation? Any Help or reference
would be appreciated.
Thanks & Regards,
|
by: JohnJohn |
last post by:
Hello. I have developed a VB.NET 2005 web site using .NET Framework 2.0.
Does anyone know if there is a way for me to detect when a particular page
has been refreshed by means of clicking the refresh button only?
In the brief research I've done, I found the following code:
AddHandler System.ComponentModel.TypeDescriptor.Refreshed, AddressOf
OnRefreshed
I added a corresponding OnRefreshed delegate function. This must not be
what I'm...
|
by: Mike |
last post by:
Hi. How can I detect if a user's session has timed-out? I'd like to be able
to redirect the user to a specified page in the event of session timeout.
Thanks!
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |