*

Recent

Author Topic: Recoded Index, titles in header tags  (Read 3976 times)

Danny

  • Newbie
  • *
  • Posts: 41
  • Force: +5/-0
Recoded Index, titles in header tags
« on: July 04, 2009, 12:31:23 PM »
Robbie emailed me with the title in tags problem, decided to recode the index file, and fix the issue.

Replace the index.php file with:
Code: [Select]
<?php
session_start
();
include (
'includes/functions.php');
include (
'includes/core.php');
include(
'includes/rating_functions.php');

$pages = array( 'play'
'mostplayed'
'newest'
'browse'
'login'
'signup'
'myaccount'
'logout'
'search'
'addtofavorites'
'memberlist'
'links'
'showprofile'
'fineprint'
'userlist'
'contact'
'taf'
'testnews'
'showcomments');


$action $_GET['action'] ? $_GET['action'] : 'base_home';

if(!
$action) { define('PAGENAME''Home'); }
if(
$action == 'play') { define('PAGENAME''Playing '.htmlentities($_GET['name'])); }
if(
$action == 'mostplayed') { define('PAGENAME''Most Played Games'); }
if(
$action == 'newest') { define('PAGENAME''Newest Games'); }
if(
$action == 'browse') { define('PAGENAME''Browsing '.htmlentities($_GET['name']).' Games'); }
if(
$action == 'login') { define('PAGENAME''Login'); }
if(
$action == 'signup') { define('PAGENAME''Signup'); }
if(
$action == 'myaccount') { define('PAGENAME''My Account'); }
if(
$action == 'logout') { define('PAGENAME''Logout'); }
if(
$action == 'search') { define('PAGENAME''Search'); }
if(
$action == 'addtofavorites') { define('PAGENAME''Add to favorites'); }
if(
$action == 'memberlist') { define('PAGENAME''Member List'); }
if(
$action == 'links') { define('PAGENAME''Links'); }
if(
$action == 'showprofile') { define('PAGENAME''Viewing Profile'); }
if(
$action == 'fineprint') { define('PAGENAME''Fine Print'); }
if(
$action == 'userlist') { define('PAGENAME''userlist'); }
if(
$action == 'contact') { define('PAGENAME''Contact Us'); }
if(
$action == 'taf') { define('PAGENAME''TAF'); }
if(
$action == 'testnews') { define('PAGENAME''testnews'); }
if(
$action == 'showcomments') { define('PAGENAME''Show Comments'); }

include (
'templates/'.$template.'/header.php');


if(
ereg('[^0-9a-zA-Z_]'$action)){ exit('Invalid format!'); }

if(
$action == 'admin'){
include ('pages/admin/index.php');
}else{
 
if(in_array($action$pages)){
include ('pages/'.$action.'.php');
}else{
include ('pages/base_home.php');
}

}
include (
'templates/'.$template.'/footer.php');

?>


open the template/x/header.php file

Find:
Code: [Select]
<?php
include ("js/rating_update.php");
?>

Replace with:
Code: [Select]
<?php
if(!defined('PAGENAME')){
$title 'Home';
}else{
$title PAGENAME;
}
echo 
'<title>'.$sitename.' - '.$title.'</title>';
include (
'js/rating_update.php');
?>

One last thing, create a new file "logout.php" in the pages directory, add:
Code: [Select]
<?php
unset($_SESSION['userid']);
echo 
'<h2>Logged Out!</h2>
<p>You have now logged out, <a href="'
.$domain.'">Click here</a> to return to the index.</p>';
?>

thanks, Any problems post it here, fix asap.