Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
Argus
Client



Joined: Oct 06, 2003
Posts: 81

PostPosted: Thu Oct 16, 2003 4:57 pm Reply with quote

Heya...

I'm having a small problem with a block atm. Here's the block:

Code:


<?php

/************************************************/
/* Last Posts from Invision Board               */
/* A block for phpNuke 6.0 - 6.6                */
/* By Patrick (http://www.actionrpg.net)        */
/*                                              */
/* All credit goes to:                          */
/* Holbrookau - http://phpnuke.holbrookau.com   */
/* VladOr - http://www.cm4.ru                   */
/*                                              */
/* All I have done is combined those two. The   */
/* VladOr block hardly worked for me, and the   */
/* Holbrookau block required a shared database. */
/* Thank you for downloading. I hope you enjoy! */
/************************************************/

if (eregi("block-IPB_last_posts.php", $PHP_SELF)) {
Header("Location: index.php");
die();
}
global $admin;

$ibf_sql_host = "localhost";
$ibf_sql_user = "XXXX";            // DB username
$ibf_sql_password = "XXXX";        // DB password
$ibf_sql_dbname = "forums";          // DB name

$ibf_path = "forums/index.php"; // path from phpNuke root directory to IPB index.php
$ibf_table_prefix = "ibf_";     // change if your IPB table prefix is not ibf_
$limit = "10";                  // How many threads would you like to display?
$noshow = "0";                  // Don't show posts from these forums - seperate IDs with commas, eg: "2,8"
$scroll = "1";                  // Scroll - 1=On, 0=Off

$ibf_connect = mysql_connect($ibf_sql_host, $ibf_sql_user, $ibf_sql_password);

if(!$ibf_connect)

{
        echo $content="<div style=\"font-color:#ff0000; font-weight:bold;\">Error: Could not connect to database server</div>";
}
else
{
   $ibf_db = mysql_select_db($ibf_sql_dbname, $ibf_connect);

   if (is_admin($admin))
   {
      $ibf_query = mysql_query("SELECT DISTINCT tid, title, last_poster_name, last_poster_id, forum_id FROM ".$ibf_table_prefix."topics ORDER BY last_post DESC LIMIT ".$limit, $ibf_connect);
   }
   else
   {
      $ibf_query = mysql_query("SELECT DISTINCT tid, title, last_poster_name, last_poster_id, forum_id FROM ".$ibf_table_prefix."topics  WHERE forum_id NOT IN ($noshow) ORDER BY last_post DESC LIMIT ".$limit, $ibf_connect);
   }
   if ($scroll=="1")
   {
      $content = " <MARQUEE behavior= \"scroll\" align= \"center\" direction= \"up\" height=\"150\" scrollamount= \"1\" scrolldelay= \"10\" onmouseover='this.stop()' onmouseout='this.start()'>";
   }
   while($ibf_result = mysql_fetch_row($ibf_query))
   {
      $content .= "<br><b><strong><big>ยท</big></strong>&nbsp;<a href=\"/".$ibf_path."?act=ST&amp;f=".$ibf_result[4]."&amp;t=".$ibf_result[0]."&amp;view=getnewpost\">".$ibf_result[1]."</a></b> <i>by ";
      if($ibf_result[3] != 0)
      {
         $content .= "<a href=\"".$ibf_path."?act=Profile&amp;CODE=03&amp;MID=".$ibf_result[3]."\">".$ibf_result[2]."</a></i><br>\n";
      }
      else
      {
         $content = $ibf_result[2]."</i></p>\n";
      }
   }
   mysql_free_result($ibf_query);
}
mysql_close($ibf_connect);
?>


The block works, however any block or even module (if its on the right) that loads after it gets no input. They show up as no content now for this block etc. Does anyone know why this is happening?

Thanks much,

-Arg
 
View user's profile Send private message
scottr
PHP-Portal Project



Joined: Jan 21, 2003
Posts: 41
Location: Southern California

PostPosted: Thu Oct 16, 2003 5:48 pm Reply with quote

Maybe get rid of that last mysql_close() statement ?
 
View user's profile Send private message Visit poster's website Yahoo Messenger
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Thu Oct 16, 2003 6:54 pm Reply with quote

That's usually a sign that either a variable name is clashing with nuke or the form is maligned, meaning an open form tag or something. Can you provide a link so I can see this in action?
 
View user's profile Send private message
Argus







PostPosted: Thu Oct 16, 2003 10:05 pm Reply with quote

I added the close thinking that was the problem, but nothing changed when I did. A link to the page is Only registered users can see links on this board! Get registered or login!. Top right side. Site is a work in progress.

-Thanks
 
Raven







PostPosted: Fri Oct 17, 2003 5:07 am Reply with quote

I clicked on the link and I don't see the problem. What am I missing?
 
Argus







PostPosted: Fri Oct 17, 2003 10:18 am Reply with quote

Mmmm someone's been editting the page I think. I put the survey block and the big story of today block back in and you can see the prob.

-Arg
 
Raven







PostPosted: Fri Oct 17, 2003 1:11 pm Reply with quote

Well, there may not be a biggest story and is the survey module active? The reason I ask is that there is a Gaming League's block that is working. Try moving the who's online block on the right to see if it works or not.
 
Argus







PostPosted: Fri Oct 17, 2003 1:55 pm Reply with quote

Hehe, I think thats because its just content - pure html (the gaming league block) Here, I'll move it to the left side and you can see what happens Razz

-Arg
 
Raven







PostPosted: Fri Oct 17, 2003 5:45 pm Reply with quote

Well, I have looked at this for about an hour or more and I can't see anything wrong. The symptoms are as I said earlier. It's as if nuke thinks it's done building so I think there is a variable being used in the script that is confusing nuke. This is how I would debug it if it were me. I would rename these variables in the script to have a prefix of xxx_ (limit, noshow, scroll). Then, see if you still have the problem. Also, the variable $PHP_SELF should be $_SERVER['PHP_SELF']. Also, modify this code
Code:
        echo $content="<div style=\"font-color:#ff0000; font-weight:bold;\">Error: Could not connect to database server</div>";
to
Code:
        $content="<div style=\"font-color:#ff0000; font-weight:bold;\">Error: Could not connect to database server</div>";
That coding seems troublesome to me.
 
Argus







PostPosted: Sun Oct 19, 2003 3:34 pm Reply with quote

Heyas...

I made the changes as suggested with no effect. Thanks for looking at it though. I was also trying to create a custom block by hacking another with no success. Do I understand you will take on small projects like this for $?

Thanks,

-Arg
 
Raven







PostPosted: Sun Oct 19, 2003 4:56 pm Reply with quote

I do custom contracting work, yes. I also have a couple of people who I refer work to. Send me an email with your specs.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©