1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Simple counter

Discussion in 'CSS' started by GFX2, Jan 28, 2014.

  1. #1
    Hi guys, I'd like to create a simple counter in html+css.

    Could you teach me that? Can it be text counter,not the standard image one?

    I would like to have a simple website that goest like this:

    <body>
    Hi, you are our
    XXXXXX th
    visitor!
    </body>
    HTML:
    Please help me if you can :)
    Thanks in advance!
     
    GFX2, Jan 28, 2014 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #2
    What you are asking about has NOTHING to do with CSS. In order to have a working counter you have to store the number on the SERVER using a languages like PHP or ASP... and using a database might help so the value can be locked to avoid collisions.
     
    deathshadow, Jan 28, 2014 IP
  3. Murugesan.quadraincorp

    Murugesan.quadraincorp Greenhorn

    Messages:
    15
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    23
    #3
    Hi,
    Counter functions there are PHP,JavaScript, asp.net, only cound your visiters..

    Ex:
    PHP COUND CODE:
    <?php session_start();

    if(isset($_SESSION['views']))
    {
    $_SESSION['views']++;
    }
    else
    {
    $_SESSION['views']=0;
    }
    echo $_SESSION['views'];
    ?>
     
    Murugesan.quadraincorp, Feb 1, 2014 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #4
    Wow, that code's a laugh -- not sure what good it is telling the user how many times they've viewed the page this session... since sessions are access (visitor) specific.
     
    deathshadow, Feb 1, 2014 IP