add counter

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Posts: 37
Joined: Wed Jul 27, 2011 7:16 am

add counter

Post by Noelb » Sun Oct 28, 2012 3:57 am

Is there a way to use a local php counter script?
I've even tried the html page nugget, even the manage styles area for counter code


include /path/to/script

all I'm trying to do is add (with brackets etc removed incase forum strips stuff
mysql_connect stuff
mysql_select_db stuff
mysql_query UPDATE counter SET count = count + 1

VAR_4_hitcount = mysql_fetch_row stuff

and print and echo statements, the count value wont appear, it prints the actual code :)
I know there's a plugin to allow inclusion of php code, but, like its warning, I too think too dangerous to use and still not sure if that'd even work.

I know the code works, I use it on another website of mine.

Any hints at how I can overcome this niggling problem?


User avatar
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Re: add counter

Post by garvinhicking » Mon Oct 29, 2012 12:27 pm


You need to use the PHP include script plugin you referred to. The other option is EVEN MORE dangerous.

Generally, allow to embed PHP code is dangerous and not recommended. The proper way to do it is create your own s9y plugin that executes the code.

# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy:
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby:

Post Reply