Problem with PHP sessions in WordPress with non-default permalinks

torresant

New Member
I'm experiencing a weird problem that occurs when I change the default permalinks in WordPress.When I place this code in my functions.php file in my theme (or even in the root index.php file in WordPress) and navigate between and updating a few pages (for example the /about page), my counter often runs twice.This problem is reproduced on every server I tried and on any theme or WordPress installation. Another thing that makes my brain even more confused is that it does not occur in Safari, Internet Explorer (6, 7 & 8), but only in Firefox. I'm using Firefox 3.6.8 and has tried it in both Mac OS X and Windows XP.\[code\]session_start();$counter = $_SESSION['wp_action_counter'];if( !isset($counter) ){$counter = 0;}$counter++;echo $counter;$_SESSION['wp_action_counter'] = $counter;\[/code\]My .htaccess rules looks like this\[code\]<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule>\[/code\]I'm curious why this happens and is ever thankful to the one who can help me solve the problem.
 
Back
Top