Topic: This hack doesn't work. Help me
Why this hack https://cutephp.com/forum/index.php?showtop...amp;hl=multiple doesn't work?
How can I fix it? Thanx
Dear CuteNews Users! Please feel free to contact us via our new Feedback Form and please send information about bugs to our bug tracker.
You are not logged in. Please login or register.
CutePHP Forums → Problem Solving / Help & Support → This hack doesn't work. Help me
Why this hack https://cutephp.com/forum/index.php?showtop...amp;hl=multiple doesn't work?
How can I fix it? Thanx
nobody knows why? Please help me
Um... How doesn't it work? Does it give out an error? Or nothing happens? What cutenews version you have?
my version is 1.4.6. There's no error message. Full story doesn't appear.
my version is 1.4.6. There's no error message. Full story doesn't appear.
Dear User!
Please try using the line
$category = isset($_GET['category'])? $_GET['category'] : false;
before
$ucat = (!isset($_GET['ucat']))? $category : $ucat;
I tried this. And it works. But there are problems with multiple include of my news. Once I used the hack for multiple category and the Supprot Team's suggestion adding $category = isset($_GET['category'])? $_GET['category'] : false; in show_news.php file, on my include page, my posts are shown wrongly... what can I do?
I tried this. And it works. But there are problems with multiple include of my news. Once I used the hack for multiple category and the Supprot Team's suggestion adding $category = isset($_GET['category'])? $_GET['category'] : false; in show_news.php file, on my include page, my posts are shown wrongly... what can I do?
Dear User!
Unfortunately, our programmers weren't able to reproduce your problem. Please would you provide us some more details about that? Maybe, any screenshots would be very helpful to clarify your issues.
this is the screenshot of my home page before I add the hack:
After, once I add the hack and I used
$category = isset($_GET['category'])? $_GET['category'] : false;
before
$ucat = (!isset($_GET['ucat']))? $category : $ucat;
this is how my home page shows my posts (wrongly)
Please take note that using
$category = isset($_GET['category'])? $_GET['category'] : false;
full story works fine, but it doesn't allow me to show right my multiple includes post in home page.
Help me
anybody could help me, please?
anybody could help me, please?
Dear User!
Please would you consider this link http://www.pasqualemarinelli.com/index.php...n=showheadlines and confirm whether the page looks in accordance to your request, or not?
Do you see here all the topics and links in order you wanted?
I tried but nothing change. Whether the page doesn't look in accordance to my request. It's the same of the second screenshot... ufff. What else can I do?
no solution????
the way i use multiple includes is the create external pages with the news in and then include them (for example main.php could have your main category included and sidebar.php could have additional news, then you use php includes for the individual pages in the specific parts of your page)
no solution????
Dear User!
Please would you send us the code of your main page, or a part of code your try modifying by using this hack? This would clarify the problem for us.
Of course.. this is the first source code of include commande I use in index.php at the center part of my home page:
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
<?PHP
$include_id = "101"; //Inserisci un ID UNICO a tua scelta e diverso dagli altri INCLUDE
if( (isset($_GET['include_id']) && $_GET['include_id'] != $include_id) || ( isset($_POST['include_id']) && $_POST['include_id'] != $include_id ) )
{
unset($start_from);
unset($subaction);
}
$_SERVER["QUERY_STRING"] = "include_id=".$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"); }
?>
</div>
for the right side part of my index.php page, this is the second source code of include commande:
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'><?PHP
$include_id = "102"; //Inserisci un ID UNICO a tua scelta e diverso dagli altri INCLUDE
if( (isset($_GET['include_id']) && $_GET['include_id'] != $include_id) || ( isset($_POST['include_id']) && $_POST['include_id'] != $include_id ) )
{
unset($start_from);
unset($subaction);
}
$_SERVER["QUERY_STRING"] = "include_id=".$include_id;
$PHP_SELF = "indexmb.php";
$category=9;
$number=2;
$template="Microblog";
$static=TRUE;
include("/home/pasqu0/public_html/a/show_news.php");
?></div>
while, this is the source code of show_news.php page, with the hack added:
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'><?PHP
header('Content-Type: text/html; charset=ISO-8859-1', true);
$category = isset($_GET['category'])? $_GET['category'] : false;
$ucat = (!isset($_GET['ucat']))?$category:$ucat;
error_reporting (E_ALL ^ E_NOTICE);
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(eregi("show_news.php", $PHP_SELF)){
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 ".htmlspecialchars($template)." does not exists, note that templates are case sensetive and you must write the name exactly as it is"); }
}
// Prepare requested categories
if(eregi("[a-z]", $category)){
die("Error!
CuteNews has detected that you use $category = "".htmlspecialchars($category).""; but you can call the categories only with their ID 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($value != "1,2,3,4"){ $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);
if( (isset($_GET['include_id']) && $_GET['include_id'] != $include_id) || ( isset($_POST['include_id']) && $_POST['include_id'] != $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: https://cutephp.com/ --></div>
any reply?
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
I tried but no improvement! But I've understand what is the exact problem. The show_news.php page, with the hack added, doesn't allow to show, in my home page, the news like I want. It ignore the customization of every my multiple include commande about the categories to display.
Please try the following:
Replace the code
else{ $category = "1,2,3,4"; $number = "5";
include("./a/show_news.php"); }
with
else{
if (!$_GET['category'] && $_GET['category'] != '1,2,3,4') $category = "1,2,3,4";
$number = "5";
include("./a/show_news.php"); }
I tried. But doesn't change anything... What else can I do, please?
Tell us the exact purpose that it should be. Do you have a home page that displays a news from the category of 1,2,3,4 - it's all right? To the right built-in code that displays the news from category 9, too, all right? Now you have the main page displays all true. I would like to know which URL you enter and that there appears not the case. Or to do so on the main page display category 1,2,3 or others? Then just need to enter the $category = "1,3,4", etc.
The point here is apparently not in the hack, which works fine, but something completely different.
Btw, as long as
$category = isset($_GET['category'])? $_GET['category'] : false;
is in there, there will be some problems, as there is no "category" in the url, its ucat... So I suggest removing that, if you still have it.
if I remove from show_news.php this:
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>$category = isset($_GET['category'])? $_GET['category'] : false;</div>
I can't see full story of my news. With that, I can.
It should show the news exactely as lisenek has written. Adding the hack, main page displays my news like I want. Intially full story didn't work. So I added in show_news.php the code above and now full story works fine. But my main page doesn't display news as lisenek has described. It ignore the customization of every my multiple include commande about the categories to display, showing wrongly all categories for each multiple include commande on main page.
@lisenek: which URL do you want?
Problem is that the right side news does not show the full story, right? Well, the central area shows news form categories 1 2 3 4, while the right side news are from category 9. See the problem?
Using
$category = isset($_GET['ucat'])?$_GET['ucat']:'1,2,3,4';
instead of
$category = "1,2,3,4";
might just work
And don't use
$category = isset($_GET['category'])? $_GET['category'] : false;
Basicly it tries to find a none existent $_GET['category'], and when it does not find it, it gives $category "false" value (disables it). This is why the full story works, as there are no categories set, but why every categories are shown...
Problem is that the right side news does not show the full story, right? Well, the central area shows news form categories 1 2 3 4, while the right side news are from category 9. See the problem?Using
$category = isset($_GET['ucat'])?$_GET['ucat']:'1,2,3,4';
instead of$category = "1,2,3,4";
might just workAnd don't use
$category = isset($_GET['category'])? $_GET['category'] : false;
Basicly it tries to find a none existent $_GET['category'], and when it does not find it, it gives $category "false" value (disables it). This is why the full story works, as there are no categories set, but why every categories are shown...
I tried. But full story doesn't still work fine. When I click on the title of a news, instead to go to the full story, main page shows only the posts of the category that the news I clicked appartains.
CutePHP Forums → Problem Solving / Help & Support → This hack doesn't work. Help me
Powered by PunBB, supported by Informer Technologies, Inc.
The pun_antispam official extension is installed. Copyright © 2003–2009 PunBB.