Dear User!
Our programmers have recently considered your web site and weren't able to discover any problem with the multiple includes on your main web page. They also have considered your code and found out some minor bugs there and fixed them. Here is your code with some improvements.
The central area:
<?PHP
$include_id = "101"; //Inserisci un ID UNICO a tua scelta e diverso dagli altri INCLUDE
if (isset($_SERVER['CUTE_INCLUDEID']) && $_SERVER['CUTE_INCLUDEID']) $srvicludeid = $_SERVER['CUTE_INCLUDEID']; else $srvicludeid = false;
if ($srvicludeid != $include_id )
{
unset($start_from);
unset($subaction);
$_SERVER['CUTE_INCLUDEID'] = $include_id;
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here we decide what page to include
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if($_POST['do'] == "Cerca" or $_GET['dosearch'] == "yes"){ $subaction = "search"; $dosearch = "yes"; include("./a/search.php"); }
elseif($_GET['do'] == "archives"){ include("./a/show_archives.php"); }
elseif($_GET['do'] == "chisono"){ include("./chisono.php"); }
elseif($_GET['do'] == "plugin"){ include("./plugin.php"); }
elseif($_GET['do'] == "help"){ include("./help.php"); }
elseif($_GET['do'] == "comerss"){ include("./comerss.php"); }
elseif($_GET['do'] == "search"){ include("./a/search.php"); }
elseif($_GET['do'] == "stats"){ echo"You can download the stats addon and include it here to show how many news, comments ... you have"; /* include("$path/stats.php"); */ }
else{ $category = "1,2,3,4"; $number = "5";
include("./a/show_news.php"); }
?>
The right part
<?PHP
$include_id = "102"; //Inserisci un ID UNICO a tua scelta e diverso dagli altri INCLUDE
if (isset($_SERVER['CUTE_INCLUDEID']) && $_SERVER['CUTE_INCLUDEID']) $srvicludeid = $_SERVER['CUTE_INCLUDEID']; else $srvicludeid = false;
if ($srvicludeid != $include_id )
{
unset($start_from);
unset($subaction);
$_SERVER['CUTE_INCLUDEID'] = $include_id;
}
$PHP_SELF = "indexmb.php";
$category=9;
$number=2;
$template="Microblog";
$static=TRUE;
include("/home/pasqu0/public_html/a/show_news.php");
?>
We've found out a bug in the following line: $_SERVER["QUERY_STRING"] = "include_id=".$include_id;
The Main page code:
<?PHP
header('Content-Type: text/html; charset=ISO-8859-1', true);
$ucat = (isset($_GET['ucat']))? $ucat : $category;
error_reporting (E_ALL ^ E_NOTICE);
$cutepath = __FILE__;
$cutepath = preg_replace( "'show_news.php'", "", $cutepath);
$cutepath = preg_replace( "'/show_news.php'", "", $cutepath);
require_once("$cutepath/inc/functions.inc.php");
require_once("$cutepath/data/config.php");
// If we are showing RSS, include some need variables.
if($template == 'rss'){
include("$cutepath/data/rss_config.php");
}
//----------------------------------
// Check if we are included by PATH
//----------------------------------
if($_SERVER["HTTP_ACCEPT"] or $_SERVER["HTTP_ACCEPT_CHARSET"] or $_SERVER["HTTP_ACCEPT_ENCODING"] or $_SERVER["HTTP_CONNECTION"]){ /* do nothing */ }
elseif(strpos($PHP_SELF, 'show_news.php') !== false){
die("<h4>CuteNews has detected that you are including show_news.php using the URL to this file.
This is incorrect and you must include it using the PATH to show_news.php</h4>
Example:
this is <font color=red>WRONG</font> :Â Â <?PHP include("http://yoursite.com/cutenews/show_news.php"); ?>
this is <font color=green>CORRECT</font>:Â Â <?PHP include("cutenews/show_news.php"); ?>
// <font size=2>if you think this message shouldn't be shown, open show_news.php and delete it from there</font>");
}
//----------------------------------
// End of the check
//----------------------------------
if(!isset($subaction) or $subaction == ""){ $subaction = $POST["subaction"]; }
if(!isset($template) or $template == "" or strtolower($template) == "default"){ require_once("$cutepath/data/Default.tpl"); }
else{
if(file_exists("$cutepath/data/${template}.tpl")){ require("$cutepath/data/${template}.tpl"); }
else{ die("Error!
the template [b]".htmlspecialchars($template)."[/b] does not exists, note that templates are case sensetive and you must write the name exactly as it is"); }
}
// Prepare requested categories
if(preg_match('/[a-z]/i', $category)){
die("[b]Error[/b]!
CuteNews has detected that you use $category = "".htmlspecialchars($category).""; but you can call the categories only with their [b]ID[/b] numbers and not with names
example:
<blockquote><?PHP
$category = "1";
include("path/to/show_news.php");
?></blockquote>");
}
$category = preg_replace("/ /", "", $category);
$tmp_cats_arr = explode(",", $category);
foreach($tmp_cats_arr as $key=>$value){
if (!empty($value)){ $requested_cats[$value] = TRUE; }
}
if($archive == ""){
$news_file = "$cutepath/data/news.txt";
$comm_file = "$cutepath/data/comments.txt";
}else{
$news_file = "$cutepath/data/archives/$archive.news.arch";
$comm_file = "$cutepath/data/archives/$archive.comments.arch";
}
$allow_add_comment = FALSE;
$allow_full_story = FALSE;
$allow_active_news = FALSE;
$allow_comments = FALSE;
$is_in_category = FALSE;
if (strstr($ucat,',')) { // if the article is in multiple categories.
$article_cat_arr = explode(',', $ucat);
foreach($article_cat_arr as $one_cat) {
if ($requested_cats and $requested_cats[$one_cat] == TRUE){$is_in_category = TRUE;}
}
}
else {
if ($requested_cats and $requested_cats[$ucat] == TRUE){$is_in_category = TRUE;}
}
//<<<------------ Detarime what user want to do
if( $CN_HALT != TRUE and $static != TRUE and ($subaction == "showcomments" or $subaction == "showfull" or $subaction == "addcomment") and ((!isset($category) or $category == "") or ($is_in_category == TRUE ) ) ){
if($subaction == "addcomment"){ $allow_add_comment = TRUE; $allow_comments = TRUE; }
if($subaction == "showcomments"){ $allow_comments = TRUE; }
if(($subaction == "showcomments" or $allow_comments == TRUE) and $config_show_full_with_comments == "yes"){$allow_full_story = TRUE; }
if($subaction == "showfull") $allow_full_story = TRUE;
if($subaction == "showfull" and $config_show_comments_with_full == "yes") $allow_comments = TRUE;
}
else{
if($config_reverse_active == "yes"){ $reverse = TRUE; }
$allow_active_news = TRUE;
}
//----------->>> Detarime what user want to do
require("$cutepath/inc/shows.inc.php");
if($_GET['archive'] and $_GET['archive'] != ''){ $archive = $_GET['archive']; } // stupid fix ?
unset($static, $template, $requested_cats, $category, $catid, $cat,$reverse, $in_use, $archives_arr, $number, $no_prev, $no_next, $i, $showed, $prev, $used_archives, $user);
// Save prev. results for next use
if (isset($_SERVER['CUTE_INCLUDEID']) && $_SERVER['CUTE_INCLUDEID']) $srvicludeid = $_SERVER['CUTE_INCLUDEID']; else $srvicludeid = false;
if ($srvicludeid != $include_id )
{
if ( isset($_GET['start_from']) ) $start_from = $_GET['start_from'];
elseif( isset($_POST['start_from']) ) $start_from = $_POST['start_from'];
if( isset($_GET['subaction']) ) $subaction = $_GET['subaction'];
elseif( isset($_POST['subaction']) ) $subaction = $_POST['subaction'];
}?><!-- News Powered by CuteNews: [url="https://cutephp.com/"]https://cutephp.com/[/url] -->
Please do not hesitate to contact us again in case you need our further assistance or any other help.
Best regards,
CuteNews Support Team