Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting hits 1

Status
Not open for further replies.

arlequin

Programmer
Sep 21, 1999
232
UY
HI!!<br><br>Wanna store in my database how many hits my homepage is having!<br><br>Is there any ASP method to capture when an user hits the page?<br><br>THANX
 
Try incrementing some field on the databse everytime the page gets a hit. You could also put the time-stamp so you know at what time the page gets hit the most. <p> <br><a href=mailto: > </a><br><a href= > </a><br>
 
Thanx DannyB !!<br><br>But what's the best way to perform it in ASP?
 
I'm using this Sub in my global.asa file:<br><br>&lt;SCRIPT LANGUAGE=VBScript RUNAT=Server&gt;<br>Sub Session_OnStart<br>host = Request(&quot;REMOTE_HOST&quot;)<br>browser = Request(&quot;HTTP_USER_AGENT&quot;)<br>referer = Request(&quot;HTTP_REFERER&quot;)<br>url = Request(&quot;URL&quot;)<br>lang = Request(&quot;HTTP_ACCEPT_LANGUAGE&quot;)<br>servername = Request(&quot;SERVER_NAME&quot;)<br><br><br>SQL = &quot;INSERT INTO Stats (REMOTE_HOST, HTTP_USER_AGENT, &quot;<br>SQL = SQL & &quot; HTTP_REFERER, URL, HTTP_ACCEPT_LANGUAGE, &quot;<br>SQL = SQL & &quot; SERVER_NAME) &quot;<br>SQL = SQL & &quot; VALUES ('&quot; & host & &quot;', '&quot; & browser & &quot;', &quot;<br>SQL = SQL & &quot; '&quot; & referer & &quot;', '&quot; & url & &quot;', &quot;<br>SQL = SQL & &quot; '&quot; & lang & &quot;', '&quot; & servername & &quot;')&quot;<br>&nbsp;&nbsp;&nbsp;set conn = server.createobject(&quot;ADODB.Connection&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;conn.open &quot;yourcon&quot;<br> conn.Execute SQL<br>&nbsp;&nbsp;&nbsp;conn.Close<br>&nbsp;&nbsp;&nbsp;Set conn = Nothing<br>&nbsp;&nbsp;&nbsp;<br><br>End Sub<br>&lt;/SCRIPT&gt;<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top