session trouble

Feed 9 posts, 2 voices

Aug 14, 2008 15:15
Avatar
21 posts

I have write some PHP to get a site counter (total + simultaneous-ajaxed) which works with the session

so I wrote a session_qtart in my code. It works pretty with Wamp, but crashes completely on-line (even a warning or a misfunction)

It's external code to frog (not a plugin !!!!) my root sir is

/compteur

/theme

/frog

why it don't works ?

 
Aug 14, 2008 15:34
Avatar
21 posts

the code is here

www.eozine.fr/temp/compteur/compteur.rar

(in french)

 
Aug 15, 2008 09:29
Avatar
21 posts

the trouble comes from fontend/classes/Page.php but only online but not with Wamp at home (line 359)

It's probably due to eval' calls for the content

I'd rather prefer playing with ob_start() than eval() but there is surely a reason to do like that.

what could I do to become my counter available now ? perhaps readong php docs !

 
Aug 16, 2008 11:05
Avatar
21 posts

I'll try to insert some code into Frog's "index.php" iI know it s not a good idea, but I don't know about a cusom "system hook" to inject somee PHP before page rendering

 
Aug 16, 2008 12:09
Avatar
396 posts

@hefeust - ob_start only functions as a buffer / cache. It doesn't interpret PHP code. That's why eval is used.

What is the exact error you're getting in the browser and in the apache error log?

Also, if you're simply counting visitors there isn't any reason to do that before page rendering. A plugin would work fine I think.

 
Aug 16, 2008 18:21
Avatar
21 posts

ok I didn't know for eval !!!!! ooops

messages from log are hidden by the FAI. But PHP warnings not.

they talk about "cache limiters" a,d "headers already sent". But this not happend at home with my own WAMP....

the counter need text files AND session because it's ajaxed for simultaneous visitors (you are 11 at this moment...)

well have you got an idea ?

(for using session inside frog ??)

 
Aug 16, 2008 20:14
Avatar
21 posts

I would say

"hidden by the net provider" (FAI : Fournisseur d Acces Internet)

for use something with the session, I will put session calls in an include file in the config.php

to transform it in a plugin, it's not so difficult because there are only one (next 2) function of 30 mines of code. But I need an event "Frog logged, but not rendered pages" !

Greetings

 
Aug 17, 2008 09:46
Avatar
396 posts

It's not very good that your FAI is hiding the logfiles because a lot of debug information can be retrieved from the apache error logs.

Anyway, the message "headers already sent" explains itself... Frog is trying to send HTTP headers but your application already did so. From what I saw of your application, it shouldn't matter a lot... but the other message "cache limiters" sounds like your internet provider is using caching which might conflict with Frog and your application.

We're already looking at adding more events, but for the meantime:

Is it possible for you to test the combination of Frog and your application on another host? (i.e. not with FAI?) That might give you a better idea of why the combination works locally but not with FAI.

 
Aug 17, 2008 12:32
Avatar
396 posts

@hefeust - But I need an event "Frog logged, but not rendered pages" !

Frog triggers an event named "page_found" just before it actually renders the page... is that what you want? For reference sake, the actual code Frog executes is:

    Observer::notify('page_found', $page);
    $page->_executeLayout();
 
Aug 17, 2008 15:45
Avatar
21 posts

thanks mvdkleijn !

written as the little plugin with Observer, it works, without Ajax, but it works !! :-)

for ajaxian (+prototype.js) part, I need to identify the /plugins/ directory from the user agent (from extern side of the site) I'think also I have to play with dirname(FILE) to store log files in appropriate dir (my plugin's dir itself) but it's not a gigantic problem

the trick will be to use the plugin index.php file for both Ajax request and static use of the plugin (counting each time a page is loaded)

either I have to separate index.php and ajax.php in the plugin's directory ??

I'll put some code in www.eozine.fr/temp sooner

see you !