Topic: index.php?act=something links dont work?

hey i have been using punbb and love it, but when i recently was working on my site i couldn't get index.php?act=affiliates to work, i know punbb is blocking it but could someone tell me how to fix it so i can

i have this included in my index.php page in my root

<?
define('PUN_ROOT', './forums/');
require PUN_ROOT.'include/common.php';

$punbb_path = $_SERVER['SCRIPT_FILENAME'];
$punbb_split = explode('/',$punbb_path);
$punbb_page = end($punbb_split);
$punbb_count = substr_count($punbb_path,'/')-2;
$punbb_path = str_repeat('../',$punbb_count).'./forum/';

define('PUN_ROOT', "$punbb_path");
define('PUN_TURN_OFF_MAINT', 1); // if forums go down the site will not

thanks

Re: index.php?act=something links dont work?

How are you trying to access the act variable? You have to use $_GET['act']

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: index.php?act=something links dont work?

<?php switch($act){ default: include('pages/news.php');
break; case "1": include('pages/affiliates.php');
} ?>

Re: index.php?act=something links dont work?

Try switch($_GET['act'])

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: index.php?act=something links dont work?

worked Thanks!

Re: index.php?act=something links dont work?

ok now i need more help

i am now using

<?php
if (isset($_GET['page']) && isset($act) &&
file_exists('pages/'.$act.'/'.$_GET[page].'.php')) {
include 'pages/'.$act.'/'.$_GET[page].'.php';
}
elseif(file_exists("pages/".$act."/index.php") && !$_GET['page']) {
include("pages/".$act."/index.php");
}
elseif(!$act && !$_GET['page']) {
include("pages/news/index.php");
}
else {
include("pages/news/index.php");
}
?>

and the dyanamic links do not work, please help, thanks

Joel

Re: index.php?act=something links dont work?

it you could help me out that would be much aprechiated smile

Re: index.php?act=something links dont work?

Errm, why are you using $act again? use $_GET['act']

Re: index.php?act=something links dont work?

could you replace them and then give me the script how it should be? because i have tried doing that

10 (edited by Smartys 2005-11-17 22:44)

Re: index.php?act=something links dont work?

As much as I hate doing work for people when it's something so simple...

<?php
$page = isset($_GET['page']) ? $_GET['page'] : false;
$act = isset($_GET['act']) ? $_GET['act'] : false;

if (file_exists('pages/'.$act.'/'.$page.'.php'))
{
    include 'pages/'.$act.'/'.$page.'.php';
}
else if (file_exists("pages/".$act."/index.php"))
{
    include("pages/".$act."/index.php");
}
else if (!$act && !$page)
{
    include("pages/news/index.php");
}
else
{
    include("pages/news/index.php");
}
?>

I should note that this code is hideously insecure and if you use it and someone realizes, you will be hacked

And if you're wondering about making it more secure, google "Directory traversals"