clock

M

Maljonic

Guest
I need a clock (visitor counter) now and I can't make much sense out of the FAQ links, some of it doesn't work at all. Can you help me with where to get one and what I have to do with it when I do get it?
 
J

Jonty

Guest
Hi Maljonic

As you rightly say, the BarrysWorld counters are seemingly out of action. Anyway, down to business. What kind of counter do you want? Do you want one that merely 'counts' or one that collects user information such as their browser, operating system, etc? The first ones are fairly easy to create, so if it's something like that you're after, I'll post the necessary code for you.

If you want something like the latter, then check out ScriptSearch.com or HotScripts.com etc. I've used PHPHits in the past, which is very simple, yet surprisingly powerful. Alternatively, PowerPhlogger is apparently quite popular.

Kind Regards
 
U

[UKLans]Khan

Guest
I have used http://www.counted.com/webmaster/ on a couple of my sites, I find the stats really usesful. You don't need to have a particular language (php/cgi/asp), it's really easy to setup and use, you simply copy and paste the code it gives you.

Hope this helps,

Khan
 
M

Maljonic

Guest
I just need a simple clock to tell me how many people have popped in, nice and simple with the least of fuss; don't even care how big their breasts are or what type of shoes they are wearing;)
 
J

Jonty

Guest
Hi Maljonic

This is a very simple counter script I found . . .

  1. Create a new, blank, text document called "counter.txt" and upload to your webspace.
  2. Once uploaded, CHMOD the file to '777' via your FTP client.
  3. On the page you want to count, your index file for example, add the following code at the very top:
    Code:
    <?php setcookie ("Visitor", "visited", time()+86400); ?>
    (This just sets a cookie so the visitor isn't counted for at least another 24hrs. If you want to change this, just change the number which represents the number of seconds before the cookie expires (e.g. 60 [secs] x 60 [mins] x 24 [hrs] = 86400 secs)).
  4. Now where you want the counter to display, add the following code:
    Code:
    <?php
    // Counter By Matti Kolu ([url]www.mk.st[/url])
    if(isset($Visitor))
    {
      if ($Visitor=="visited")
      include "counter.txt";
    }
    else
    {
      $laggtill = fopen("counter.txt","r+");
      $plussa = fread($laggtill, filesize("counter.txt")); 
      fclose($laggtill); 
      $plussa += 1; 
      $laggtill = fopen("counter.txt","w+");  
      fputs($laggtill, $plussa); 
      fclose($laggtill); 
      include "counter.txt";
    }
    ?>
    (This code just checks to see if the cookie is present. If it is, it just displays the counter without incrementing. If the cookie isn't present, it opens the counter file, increases the number by one, and displays the counter).
I'm sure this all sounds a lot more complicated than it is. If you have any problems, please feel free to post again.

Kind Regards
 
J

Jonty

Guest
CHMOD'ing the file allows the PHP script to freely read and write to the counter. If the file was not CHMOD'ed, then the script would not be able to write to the counter, hence everything would grind to a halt. Don't worry, it's quite safe :)

Kind Regards
 
M

Maljonic

Guest
no no, I don't know what you mean by CHMODing; I'm hopless as abreviations, sorry... do you mean like changing the file so anyone can write to it?

edit:never mind I got it now:)
 
J

Jonty

Guest
Sorry Maljonic, my mistake. Hope it all works.

Kind Regards
 
M

Maljonic

Guest
when I change the file to 777 it says syntax error?

edit: sorry my fault, I made a new page instead of a simple text document. Is that what caused it?
 
J

Jonty

Guest
Hmm, that's strange. What FTP client are you using? (e.g. CuteFTP, SmartFTP etc.)

Kind Regards
 
M

Maljonic

Guest
I've done everything now but a clock has not appeared... cute btw
 
J

Jonty

Guest
Hmm, I'm not really sure what's wrong. There are some instructions on you to CHMOD a file in CuteFTP here. Do you have a link to the file where the counter should appear?

Sorry about the delay
 
M

Maljonic

Guest
Originally posted by Jonty
Hmm, I'm not really sure what's wrong. There are some instructions on you to CHMOD a file in CuteFTP here. Do you have a link to the file where the counter should appear?

Sorry about the delay
I've done the CHMOD bit now and pasted the other bits in where you said. The first line at the very top of my index page and the rest nestled in the code that is highlighted when I have the cursor on the design veiw where I want the clock to go; the background is black btw if that makes any difference.
 
J

Jonty

Guest
Does the design view allow you to see the source code of the file you're editting? Also, is the final you're editting end in '.php'?

Kind Regards
 
M

Maljonic

Guest
the file isn't all that big so I'll just show you how it looks and you can tell me what I did wrong:)


<?php setcookie ("Visitor", "visited", time()+60); ?>
<html>
<head>
<title>Maljonics Home Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000" background="Background.jpg">
<table width="1003" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="1" height="1"></td>
<td valign="top" colspan="4" rowspan="2">
<h6 align="left"><font size="+7"><font color="#CC3399">Maljonic's Dreams</font></font></h6>
<?php
// Counter By Matti Kolu (www.mk.st)
if(isset($Visitor))
{
if ($Visitor=="visited")
include "counter.txt";
}
else
{
$laggtill = fopen("counter.txt","r+");
$plussa = fread($laggtill, filesize("counter.txt"));
fclose($laggtill);
$plussa += 1;
$laggtill = fopen("counter.txt","w+");
fputs($laggtill, $plussa);
fclose($laggtill);
include "counter.txt";
}
?> </td>
<td width="13"></td>
<td width="225"></td>
<td width="10"></td>
</tr>
<tr>
<td height="56"></td>
<td></td>
<td rowspan="2" valign="top"><font size="+2" color="#99CCCC"><font color="#3333FF"> </font><font color="#3333FF">Latest
Dream </font></font></td>
<td></td>
</tr>
<tr>
<td height="30"></td>
<td width="1"></td>
<td valign="top" rowspan="2" colspan="2">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="583" height="87" valign="top"> </td>
<td width="273"></td>
</tr>
<tr>
<td height="26"></td>
<td></td>
</tr>
</table>
</td>
<td width="33"></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="83"></td>
<td></td>
<td></td>
<td></td>
<td colspan="2" valign="top"> <font size="+2" color="#99CCCC"><font color="#3333FF">Common
Dreams</font></font></td>
</tr>
<tr>
<td height="37"></td>
<td colspan="2" valign="top"></td>

<td width="567"></td>
<td></td>
<td></td>
<td valign="top" colspan="2" rowspan="2"> <font size="+2" color="#99CCCC"><font color="#3333FF">Lucid
Dreams/OBEies </font></font></td>
</tr>
<tr>
<td height="79"></td>
<td></td>
<td width="153"></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="129"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td valign="top" colspan="2"> <font size="+2" color="#99CCCC"><font color="#3333FF">Meanings</font></font></td>
</tr>
<tr>
<td height="132"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td valign="top" colspan="2"> F<font size="+2" color="#99CCCC"><font color="#3333FF">Forum</font></font></td>
</tr>
<tr>
<td height="126"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td valign="top" colspan="2"></td>
</tr>
<tr>
<td height="3"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>
 
J

Jonty

Guest
Hi Maljonic

That looks perfect :D On the copy of the file which is uploaded (address?) have you tried highlighting the page with your mouse to see if the the counter appears? If this is the case, then it's easy to make the counter number stand out on the black background. Also, try downloading a copy of your counter file and see if it is still blank or if it contains a number.

Sorry this is such a pain
 
M

Maljonic

Guest
when I view the file on the FTP thing there is a grey 1 and 2 like this:

1
2
 
J

Jonty

Guest
Hi Maljonic

To be honest, I'm afraid I'm a little lost :( It would really help if I had the address of where the page is online (PM me if you'd rather not post it in public). It sounds like everything should be working, though :(

Sorry
 
J

Jonty

Guest
Hi Maljonic

Thanks :) I believe I know what the problem is, you have to rename 'index.html' to 'index.php' in order for the script to work. If you connect via FTP you should be able to rename the file from there.

Kind Regards
 
M

Maljonic

Guest
nope that didn't do it; I'm off to play CS now instead and I'll try again tomorrow, nn:)

P.S. are you sure that code it right, can't see how it displays the clock?
 
J

Jonty

Guest
It does now work, well done :) The only problem is the number merges in with the background. To fix this, try the following . . .
Code:
. . . 
<h6 align="left"><font size="+7">[b]<font color="#CC3399">Maljonic's Dreams</font>[/b]</font></h6>
<span style="color:#FFFFFF">
<?php
// Counter By Matti Kolu ([url]www.mk.st[/url])
if(isset($Visitor))
{
if ($Visitor=="visited")
include "counter.txt";
}
else
{
$laggtill = fopen("counter.txt","r+");
$plussa = fread($laggtill, filesize("counter.txt")); 
fclose($laggtill); 
$plussa += 1; 
$laggtill = fopen("counter.txt","w+"); 
fputs($laggtill, $plussa); 
fclose($laggtill); 
include "counter.txt";
}
?> </span></td>
<td width="13"></td>
. . .
All that has been added is a <span></span> tag which colours the text, in this case the counter, white. If you need any more help, just shout.

Sorry it took so long.
 
M

Maljonic

Guest
thanks for that, all working now. Not very glamorous but it serves its purpose:)
 

Users who are viewing this thread

Top Bottom