View previous topic :: View next topic |
Author |
Message |
mtbiking -
Joined: 18 Mar 2004 Posts: 66
|
Posted: Sun Apr 11, 2004 12:51 pm Post subject: counter script |
|
|
does anyone know where i can get a cgi counter script that works like this
1) i can just put a unique id after the script to creater a new counter
e.g. script?unique_id=12343
2) it has got to be free
3) and the counter has to be in text
thanx all
can also be in PHP but not mysql |
|
Back to top |
|
|
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Mon Apr 12, 2004 2:38 am Post subject: |
|
|
count.php
<?
//The counter is a link to Aprelium, please do not change, the counter is free
//add ?cntid=yourid to the end of your url
//Example:count.php?cntid=176999
//Use SSI to print to shtml files
//SSI Example: <!--#include virtual="/count.php?cntid=176999" -->
//PHP Example: copy and paste into php files
//HTML Example: <iframe src=count.php?cntid=176999 width=90 height=55></iframe>
//Recomended for windows.
//Will work with unix if root directory permission set to 777 On first Execution of script.
$color = "pink";//change this line to the color you desire
$root = $_SERVER["DOCUMENT_ROOT"];
$file = "/counters";
$path = "$root$file/";
$countid = $_GET['cntid'];
$self = $_SERVER["PHP_SELF"];
$host = $_SERVER["HTTP_HOST"];
$create = "$path$countid.txt";
if ($countid==''){header("Location: http://$host$self?cntid=noid");}
if(!is_dir($path))
{
mkdir($path);
chmod("$path", 0777);
header("Location: http://$host$self?cntid=$countid");
}
else
{
if(!is_file($create))
{
fopen("$create","w");
header("Location: http://$host$self?cntid=$countid");
}
else
{
$data = fopen("$path/$countid.txt","r");
$count = fgets($data,1000000);
fclose($data);
$count=$count + 1 ;
printf("<table bgcolor='$color'><tr><td>");
printf("<font face=tahoma size=2><b><a href=http://aprelium.com target=_blank>VISITOR #<BR>$count</a></b></font>");
printf('</td></tr></table>');$data = fopen("$path/$countid.txt","w");
fwrite($data,$count);
fclose($data);
}
}
?>
Last edited by eznetlinks on Sat Apr 17, 2004 3:14 pm; edited 5 times in total |
|
Back to top |
|
|
goose -
Joined: 17 Sep 2002 Posts: 608 Location: The Land Of OZ! come here toto!
|
Posted: Mon Apr 12, 2004 5:05 pm Post subject: |
|
|
pretty simple and direct hehe ;p _________________ living in an armish paradise.....no gates here!
mawuahahaha :) |
|
Back to top |
|
|
mtbiking -
Joined: 18 Mar 2004 Posts: 66
|
Posted: Mon Apr 12, 2004 11:51 pm Post subject: |
|
|
how do i incorparate that on to a web page i've tried a java script line but that didn't work |
|
Back to top |
|
|
nquin321 -
Joined: 29 Jan 2004 Posts: 296 Location: Right Behind You
|
|
Back to top |
|
|
mtbiking -
Joined: 18 Mar 2004 Posts: 66
|
Posted: Tue Apr 13, 2004 12:35 am Post subject: |
|
|
yeah i know i put that
<!--#e...
crap after i tried the javascript but i forgot to change to stml / add html to the ssi thingy |
|
Back to top |
|
|
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Sun Apr 18, 2004 3:35 am Post subject: |
|
|
I use one a lot simpler. (You may have seen it on my index page). It is ironically called Simple Counter; available here. _________________ Bienvenidos! |
|
Back to top |
|
|
mtbiking -
Joined: 18 Mar 2004 Posts: 66
|
Posted: Wed Dec 22, 2004 2:25 am Post subject: |
|
|
right after a while i thought about doing somthing with it other than counting hit
i was using the first one shown
<?php
$user = $_GET['id'];
$path = 'counter';
if (is_dir($path)) {
$data = fopen("$path/$user.txt","r");
$count = fgets($data,1000000);
fclose($data);
$count=$count + 1 ;
echo "You Are #$count to hit this site!";
$data = fopen("$path/$user.txt","w");
fwrite($data, $count);
fclose($data);
}
else
{
$self = $_SERVER["PHP_SELF"];
$host = $_SERVER["HTTP_HOST"];
mkdir($path);
header("Location: http://$host$self?id=$user");
}
}
}
?>
but how come on the first visit i get
Warning: fopen(counter/ext.txt): failed to open stream: No such file or directory in C:\Program Files\Abyss Web Server\htdocs\file.php on line ??
Warning: fgets(): supplied argument is not a valid stream resource in C:\Program Files\Abyss Web Server\htdocs\file.php on line ??
Warning: fclose(): supplied argument is not a valid stream resource in C:\Program Files\Abyss Web Server\htdocs\file.php on line ??
is their some way of doing this and
could you also look and help me with this
http://www.aprelium.com/forum/viewtopic.php?p=34052 |
|
Back to top |
|
|
Glitch2082 -
Joined: 02 Dec 2004 Posts: 194
|
Posted: Wed Dec 22, 2004 2:47 am Post subject: |
|
|
Quote: | Warning: fopen(counter/ext.txt): failed to open stream: No such file or directory in C:\Program Files\Abyss Web Server\htdocs\file.php on line ??
|
Make a file called ext.txt maybe, if(you already havn't); :P
Also make one called user.txt.
After that it should work, becuase i don't think it could open $data becuase it couldn't find it, and I know it couldn't open ext.txt. So the arguement error was becuase it couldn't find $data possibly :S.[/quote] _________________ int main() {
cout << "Im Pro Apache";
cin.get();
} |
|
Back to top |
|
|
|