I am a php newbie. I would like to count how many times a user visit a
webpage.
I know session tracking should be used, but where i put the code? Is it
inside the html that the user visit?
session_start() ;
if (!IsSet($page_n umber))
$page_number = 1;
print("You have now visited $page_number");
print(" of pages <br />");
$page_number++;
$session_regist er("page_number ");
Also, i want to record the number of time a user visit a page and store
it in MySQL. I know how to do it using "form action and submit" way,
but
have no clue of doing it with session tracking . 1 2755
On 30 May 2005 09:34:29 -0700 (more or less), ma*****@hotmail .com wrote: I am a php newbie. I would like to count how many times a user visit a webpage. I know session tracking should be used, but where i put the code? Is it inside the html that the user visit?
session_start( ); if (!IsSet($page_n umber)) $page_number = 1; print("You have now visited $page_number"); print(" of pages <br />"); $page_number++; $session_regist er("page_number ");
Also, i want to record the number of time a user visit a page and store it in MySQL. I know how to do it using "form action and submit" way, but have no clue of doing it with session tracking .
You can't do what you want with session cookes. You'll need to create a
permanent (or at least long duration) cookie for a visitor.
Something like:
// look for an existing cookie for this site
if (isset($_COOKIE['$thispage'])) { // if found, increment the count in
the database
update_db($user _code,$thispage );
}
// set a cookie (or extend the life of the current one
setcookie($aUni queID,$thispage ,time()+60*60*2 4*30); This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: marslee |
last post by:
I want to prevent non-registered users to view a page in my website,
For example, when a non-registered user clicks the history page, the
website site refuses to go there since he is not registered.
what is the best way to do it? And how to identify a user has already
logged in when he click the history page?
|
by: David Frauzel |
last post by:
I'm writing a rough draft of a suite of small Perl apps that will,
combined, serve as a web site's user sign-up, login, management, and
customized content engine.
I'm having trouble with the concept of one particular part of the
"application" (as it were) - session tracking. Perl itself is handling
user authentication (since I've no idea how Perl could "ask" the server
who just authenticated to htaccess), so the login script will have an...
|
by: Adil Akram |
last post by:
I've developed a shopping cart app in ASP, to secure transaction by SSL, it
've put only the checkout page in SSL but all other pages i.e. product, cart
etc remains on non SSL connection. How can I track user session from non SSL
to SSL checkout page as the SessionID changes when shifting to SSL (to
prevent session stealing/ hijacking). I'm tracking user session by putting
SessionID in cart DB with products. Given below the preview of cart...
|
by: James |
last post by:
Hello,
I'm designing an online shopping cart using ASP.
I want the flexibility of session tracking by using
URL rewriting but I don't know how I would
go about this.
I'd like to know how I would go about storing
and retrieving session data (i.e. product items + their quantities)
using URL rewriting?
|
by: Patrick Olurotimi Ige |
last post by:
I'm tracking usersOnline by adding this code below in my Global.asax
file.But i noticed that when a user logs in it keeps adding a new user
which thats fine..but when a user logs of it still retains the
user(session) for sometime instead of reducing it by one!
I'm thinking of maybe i should change something in IIS relating to
Session?
Any ideas..
| |
by: Sullivan WxPyQtKinter |
last post by:
I do not want to use Cookies in my site since not all web browser
support it well and sometimes people close cookie functioning for
security reasons.
I tried to add hidden field with a sessionID in every python CGI script
generated web pages, so everytime my client POST a request, the server
will retrieve the sessionID and decide if it is in the same session.
However, since python cgi do not have a function for redirecting to a
page, I...
|
by: Nospam |
last post by:
Does anyone know of any session management with mysql scripts that uses cj
tracking?
|
by: Franky |
last post by:
Users can log into my site via a php login script or registration form (for new users). Login checks that the credentials are correct, and the registration creates a new entry in a mysql db.
At this point a new session is started, a session variable ($_SESSION) is set to yes, and they are redirected using header(location).
Can anyone suggect code to place on subsequent pages that will check on arrival if the current user has a session...
|
by: davidkoree |
last post by:
I mean not about cookie.
Does it have something to do with operating system or browser plugin?
I appreciate any help.
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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?
| |