Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Strange PHP anomaly

Quote Reply
Strange PHP anomaly
I am using a PHP/MySQL counter script, which displays visitors currently online.

The strange thing is that it displays correctly in the Index pages but not on the Detailed pages.

For example the source code on the index pages, category pages shows:
Code:
Visitors Online: 2

but the source code on the Detailed pages shows:
Code:
Visitors Online:<?php
include("/home/mysite/public_html/counter/counter.php");
?>

Everything is built with .php extensions so I don't know why it's not happy with the Detailed pages.

Any clues?
Quote Reply
Re: [MJB] Strange PHP anomaly In reply to
To simplify things I have now created a global with that tag:

Tag:
counter

Global:
<?php
include("/home/mysite/public_html/counter/counter.php");
?>

Call:
<%counter%>

Unfortunately it still has the same outcome. Unsure
Quote Reply
Re: [MJB] Strange PHP anomaly In reply to
OK, I've just tried it with a different script and it is exactly the same so it's not the scripts. It must be something to do with the Detailed pages.
Quote Reply
Re: [MJB] Strange PHP anomaly In reply to
Update: I have just put the following code on my pages and can confirm that it is not displaying on any of the Detailed php pages.

Code:
<?php echo ("php test"); ?>
Quote Reply
Re: [MJB] Strange PHP anomaly In reply to
Have you checked the server?

<?php phpinfo(); ?>

Vishal
-------------------------------------------------------
Quote Reply
Re: [MJB] Strange PHP anomaly In reply to
Are you using static, or dynamic pages?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Strange PHP anomaly In reply to
I'm using static.

I have also tried your check_if_is_script global. This does display the number on the Detailed pages but, as before with this global, it freezes the increment so I can't use it.
Quote Reply
Re: [SWDevil.Com] Strange PHP anomaly In reply to
SWDevil.Com wrote:
Have you checked the server?

<?php phpinfo(); ?>

What am I looking for? Anything in particular in the list?
Quote Reply
Re: [MJB] Strange PHP anomaly In reply to
You got an example we can see? Are you sure the code isn't just being parsed as text? (i.e showing in the source code) ?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Strange PHP anomaly In reply to
Visitors Online in left sidebar.

Displays on Index page, New, Popular (Cool), Top Rated, Categories and Subcategories but none of the Detailed pages Here.
Quote Reply
Re: [MJB] Strange PHP anomaly In reply to
You sure that page is being parsed as PHP? In the source code (on a detailed page), I see:

<?php
include('/home/hifidata/public_html/online/online.php');
?>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Strange PHP anomaly In reply to
I don't know how to check that. I don't really know too much about the server side of things. Blush
Quote Reply
Re: [MJB] Strange PHP anomaly In reply to
Are you using mod_rewrite at all? (in the .htaccess file). If so, please paste the contents here - I've got a feeling you may be using mod_rewrite for that page?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Strange PHP anomaly In reply to
Ah, now there's a point.

In this post I needed a modification to jump.cgi and added the following to the .htaccess file which looks like it makes the Detailed pages act like dynamic not static:

Code:
RewriteRule Detailed/(.*)$ /cgi-bin/database/page.cgi?g=Detailed/$1 [L]

So it looks like I have a problem here and will have to choose one or the other or find some way of working round it.
Quote Reply
Re: [MJB] Strange PHP anomaly In reply to
I might have sorted this by creating a separate sidebar for the detailed pages.

Going to do some testing and see how it responds.
Quote Reply
Re: [MJB] Strange PHP anomaly In reply to
Hi,

Yeah, you can could just use a global for the dynamic pages. Something like:

run_php_script
Code:
sub {
return `php /path/to/script.php`;
}

..and call with <%run_php_script%>

..or if you have more than one function you want to call - then something like:

run_php_script
Code:
sub {
return `php $_[0]`;
}

..and call with:

<%run_php_script("/path/to/script.php")%>

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Strange PHP anomaly In reply to
I created a new page include_leftsidebar_dynamic.html and used part of your check_if_is_script like so:

Code:
<%check_if_is_script%>
<%if is_script%>
<%run_php("/home/hifidata/public_html/online/online.php")%>
<%endif%>

By missing out the <%else%> part it seems to solve the problem of the counter freezing. I've done some testing and it looks to be working correctly now.

Thanks