Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

database hidden web hit counter

Options
  • 17-07-2006 9:35am
    #1
    Registered Users Posts: 23


    Hi i am tryin to set up a hit counter on a web server and am trying to implement the one below.

    http://www.asp101.com/samples/counter_db.asp

    It is a .asp file that you call into you html code of each page you want a counter set up

    <!--#include file="counter.asp"-->

    i have placed the above code into the body of my html and the database is stored on the server, i was wondering if any1 could get this working of know of a easy way to do so?


Comments

  • Moderators, Politics Moderators Posts: 39,812 Mod ✭✭✭✭Seth Brundle


    Whats (not?) happening? Is that line appearing in your HTML in the browser code?
    You will need ASP or similar to call and process this file - not HTML.

    Something like this may also slow down the processing of your page - just go with AWStats or statcounter.


  • Registered Users Posts: 23 conorot


    The db is not updating so the counter.asp file must not be called correctly. Yeah i have the

    <!--#include file="counter.asp"-->

    in the html code of the site that i want the counter set up on so it does not appear on the browser as it is hidden.
    (You will need ASP or similar to call and process this file)????

    cant use AWStats or statcounter.
    thanks for your reply.


  • Registered Users Posts: 7,411 ✭✭✭jmcc


    conorot wrote:
    The db is not updating so the counter.asp file must not be called correctly. Yeah i have the

    <!--#include file="counter.asp"-->

    in the html code of the site that i want the counter set up on so it does not appear on the browser as it is hidden.
    (You will need ASP or similar to call and process this file)????

    cant use AWStats or statcounter.
    thanks for your reply.
    Are server side includes activated on the webserver? Otherwise the page will be parsed as html and the call to the counter.asp file will be just ignored as a comment in html.

    Regards...jmcc


  • Registered Users Posts: 23 conorot


    Sorry yeah i see what you mean, but how do i know if server side includes activated on the webserver? or how can i change to do so..... probably a stupid question


  • Registered Users Posts: 23 conorot


    Yeah i am fairly sure it is readin in the

    <!--#include file="counter.asp"-->

    as just a comment, how would i go about fixing this?


  • Advertisement
  • Registered Users Posts: 23 conorot


    ok been lookin up and from a web server u are ment to run it like below

    www.address.com/nameOfFile.asp

    but what do i do if i want to run the .asp file from within the html with out pastin it all in, i thought

    <!--#include file="counter.asp"-->

    would have done if and called the code but it sees
    <!--#include file="counter.asp"--> as a comment.

    any ideas anyone?
    any help mush appreciated.


  • Registered Users Posts: 6,508 ✭✭✭daymobrew


    conorot wrote:
    but what do i do if i want to run the .asp file from within the html with out pastin it all in, i thought

    <!--#include file="counter.asp"-->

    would have done if and called the code but it sees
    <!--#include file="counter.asp"--> as a comment.
    I think you can use SSI to get this to work.
    Your html file would probably have to be renamed to have a 'shtml' extension.
    The #include code you have should work in such a case - SSI directives are inside comments.

    I found some info about enabling SSI in IIS7 and notes and examples.
    A basic test could be to create a file ssi_test.shtml:
    [HTML]<html>
    <body>
    <p>Server Name = <!--#ECHO VAR = "SERVER_NAME"--></p>
    <p>Date = <!--#ECHO VAR = "DATE_LOCAL" --></p>
    <p>Page URL = <!--#ECHO VAR = "URL" --></p>
    </body>
    </html>[/HTML]
    and access the file from your browser. It should print the server name, date and url. If it doesn't it would imply that SSI is not enabled on the server.


  • Registered Users Posts: 23 conorot


    when i change it from .htm to .shtml the page still showes correctly but it has a error on the page somewhere, i took out the

    <!--#include file="counter.asp"-->

    within the html code but still has error on page, when i change back to .htm it has no error.
    But when i changed it to .shtml it still had
    <!--#include file="counter.asp"-->
    as if were a comment.

    But when i embed the .asp code within the html it does work correctly its just i can not call the code into it with out puttin it all in. so would that mean that SSI is on the server?


  • Registered Users Posts: 6,508 ✭✭✭daymobrew


    conorot wrote:
    when i change it from .htm to .shtml the page still showes correctly but it has a error on the page somewhere
    What is the error message?
    Did you try the sample code I listed (with #ECHO) ?
    Is counter.asp in the same directory as the html/shtml file?
    What do you get when you access counter.asp through your browser?
    Who owns/manages the web server? They might know if SSI is enabled.


  • Registered Users Posts: 23 conorot


    Ok sorry, the asp code works perfectly, i got it to run on the server so the server is not the problem. but when i got it to run i typed the url and had /counter.asp at the end with the code inside html code.

    But the problem is i can not get the code to work within the html code, at the start the file was called .htm and i inserted all the code into the index.htm file, (i want the .asp code to run when the start page loads up.) and it does not do anything. i remaned the index.htm to index.shtml but still the same thing. But the file will work grand if i change it to index.asp but that is no good to me as i want it as index.html as thats the page that loads up first as the server runs. I am the owner or the server.
    Any ideas? or am i going about this the wrong way?


  • Advertisement
  • Registered Users Posts: 23 conorot


    line the .asp code will run ok when i run it off the server in the browser as follows www.something.com/counter.asp
    but wont if i have the code in the index.htm file
    www.something.com
    is there anyway some one knowes of or how would i go about it?


  • Registered Users Posts: 6,508 ✭✭✭daymobrew


    daymobrew wrote:
    1) What is the error message?
    2) Did you try the sample code I listed (with #ECHO) ?
    3) Is counter.asp in the same directory as the html/shtml file?
    4) What do you get when you access counter.asp through your browser?
    5) Who owns/manages the web server? They might know if SSI is enabled.
    You've answered questions 3 and 4 - so we know that the problem is not the counter.asp file. You've partially answered question 5 (owner == you) but not whether SSI is enabled.
    I am really interested in answers to 1 and 2.
    conorot wrote:
    But the file will work grand if i change it to index.asp but that is no good to me as i want it as index.html as thats the page that loads up first as the server runs.
    If it works then find a way to use it. index.asp can be made to be the first page that loads "as the server runs". This is a configuration setting. It's called DirectoryIndex in Apache and might be something similar in IIS.


  • Registered Users Posts: 23 conorot


    Hi, just to let you know i that the problem is now solved. i have .asp as the extenstion instead of the .htm file and the .asp file loads up automatically now. Thanks a mill, been a great help.


Advertisement