Search engine not working properly

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
delta
Posts: 2
Joined: Sat 2. Jul 2011, 01:30

Search engine not working properly

Post by delta »

Hi,
I'm experiencing some problem with php code in the article.
On our website there is a page requires login to view. So we build login file to let people sign in view the article. Following code is added in front of that page.

// Check if session is not registered , redirect back to login page.
// Put this code in first line of web page.
[PHP]
session_start();
if(!session_is_registered(username)){
header("location:foldername/login.php");
}
[/PHP]

It appears search engine not working correctly after put these php code in front of article.
The search result always comes up login.php page. If I take these php code off, search engine works fine.
Can anyone help me figure it out what the problem is ?

Thank you very much!
User avatar
Oliver Georgi
Site Admin
Posts: 9889
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: Search engine not working properly

Post by Oliver Georgi »

you should not use this in inline PHP. Remove this.

First enable config setting

Code: Select all

$phpwcms['SESSION_FEinit'] = 1;
Then put that peace of code in the frontend_init.

Code: Select all

<?php
if(empty($_SESSION['username'])) {
  headerRedirect('foldername/login.php');
}
?>
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
Post Reply