Author |
Message |
LadySyren
Regular
![Regular Regular](modules/Forums/images/ranks/2stars.gif)
![](modules/Forums/images/avatars/blank.gif)
Joined: Sep 03, 2004
Posts: 56
Location: Iowa
|
Posted:
Sun Dec 26, 2004 12:16 am |
|
I wasn't sure where to post this, so if its in the wrong area I apologize. I was just wondering if someone would be able to tell me if there is anything wrong with this ...
<?php
/************************************************************************************/
/* /*
/* QOTM Block for PHP-Nuke 6.5-7.6 /*
/* v1.0 /*
/* /*
/* Copyright © 2004 by: JRSweets (JRSweets@gmail.com) /*
/* http://www.jeffrusso.net /*
/* /*
/* This program is free software. You can redistribute it and/or modify /*
/* it under the terms of the GNU General Public License as published by /*
/* the Free Software Foundation; either version 2 of the License. /*
/* /*
/************************************************************************************/
if(stristr($_SERVER['SCRIPT_NAME'],"block-QOTM.php")) {
Header("Location: index.php");
die();
}
global $prefix;
$quote_count = 0;
$sql = "SELECT COUNT(*) FROM $prefix"._bbqotm;
$quote_count = $db->sql_query($sql);
if ($quote_count > 0)
{
$sql ="SELECT * FROM $prefix"._qotm." ORDERY BY rand()";
$row = $db->sql_fetchrow($db->sql_query($sql));
$content = '<center><font class=tiny><i>';
$content .= trim($row[quote_text]);
$content .= '</i><br>';
$content .= '- '.stripslashes($row[quote_author]).'</font></center>';
}
else
{
$content = 'No Quotes in Database';
}
?>
I did as instructed and it kept telling me this odd error. Something about a non member function (or something like that) on line 25 in the coding. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
PHrEEkie
Subject Matter Expert
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Feb 23, 2004
Posts: 358
|
Posted:
Sun Dec 26, 2004 12:22 am |
|
Add $db to the global line
global $db, $prefix;
PHrEEk |
_________________ PHP - Breaking your legacy scripts one build at a time. |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
LadySyren
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sun Dec 26, 2004 12:40 am |
|
Thanks, I did that and it seems to be working now. There's just one problem. It appears that there isn't a way for someone to add or submit a quote. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
PHrEEkie
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sun Dec 26, 2004 12:57 am |
|
You'd have to add a form to it, and depending on how complicated you wanted to get with the form, you might need to create a module for Quote submissions. Anytime you want to allow user submissions, you are then getting into an area of security concern. I can't imagine there isn't already a random quote module with block available anywhere? Have you had a look around, or has everything left you wanting to create a custom one? It's a lot of work, because not only do you have to create the submission form, you also have to have a receiving script to process the submission, check it for security issues, and add it to the database.
PHrEEk |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
LadySyren
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sun Dec 26, 2004 8:13 am |
|
Well, according to the information about this quote of the moment block I downloaded, everythings suppose to be there already to allow users to submit a quote, let admins review it and either accept or deny it, etc. Only things I see are the block itself, no quotes, no way for users to submit them. I also see the quote of the moment control/admin area in the forums admin control panel but that only has config, review, and management. There's nothing even for an admin to enter a quote. I'd love to find a quote of the moment or quote of the day block that will allow users to submit their own quotes but so far this is the only one I've found and it's not usable. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
JRSweets
Worker
![Worker Worker](modules/Forums/images/ranks/3stars.gif)
![](modules/Forums/images/avatars/1893895841d22f8dea615.gif)
Joined: Aug 06, 2004
Posts: 192
|
Posted:
Mon Dec 27, 2004 10:12 am |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
LadySyren
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 27, 2004 11:33 am |
|
Oh peachy Thanks a bunch. I've downloaded the one you said to and again, did everything as instructed. I tried to submit a quote to test it out and I get this error message:
Failed to insert quote into table
DEBUG MODE
SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'Syren', '', '2', '63.186.1.4', '1104168701')' at line 1
INSERT INTO nuke_bbqotm (quote_text, quote_author, quote_enabled, quote_user_id, quote_ipaddress, quote_date) VALUES ('\If love is so blind, why is lingerie so popular?\', 'Syren', '', '2', '63.186.1.4', '1104168701')
Line : 128
File : /home/xxxxx/public_html/xxxxx/modules/Forums/qotm_user.php |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
LadySyren
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 27, 2004 11:48 am |
|
Actually, I figured out why I got that error so I fixed it Thanks a bunch for all the help, guys!!
Happy Holidays! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
JRSweets
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 27, 2004 12:02 pm |
|
Why did you get the error? Post it here, it may help someone else. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
LadySyren
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 27, 2004 3:29 pm |
|
Well, that error showed up because when I submitted a quote, I had included " "'s in with the text. IE: "If love is so blind, why is lingerie so popular?" When people submit their own quotes, they have to just submit the text without the " "'s . Make sense? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
JRSweets
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 27, 2004 6:03 pm |
|
If you find these lines in quote_user.php
Code: //Lets do some security checking of the submitted data
$quote = str_replace("\'","''",$HTTP_POST_VARS['quote_text']);
$quote = preg_replace(array('#&(?!(\#[0-9]+;))#', '#<#', '#>#'), array('&', '<', '>'),$quote);
//Remove quotes if there
$quote = str_replace("\"","",$quote);
|
Replace with this:
Code: //Remove quotes if there
$quote = str_replace("\"","",$HTTP_POST_VARS['quote_text']);
//Lets do some security checking of the submitted data
$quote = str_replace("\'","''",$quote);
$quote = preg_replace(array('#&(?!(\#[0-9]+;))#', '#<#', '#>#'), array('&', '<', '>'),$quote);
|
It won't matter if the user submits the quote surrounded by quotation marks or not. (That was what I was trying to do in the first place) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
LadySyren
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Dec 28, 2004 9:19 am |
|
Oh wonderful! Thanks so much! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Deseroka
Client
![](modules/Forums/images/avatars/Animaniacs/Animaniacs_-_Stinkbomb.gif)
Joined: Apr 15, 2003
Posts: 466
Location: FL
|
Posted:
Tue Jan 04, 2005 6:08 am |
|
Has anyone successfully made this work with a theme like Chronicles? I guess the images interfere, it shows up in a theme like 3DFantasy, but not Chronicles. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
JRSweets
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Jan 07, 2005 1:30 pm |
|
I have never had this problem.
Side note: If anyone wants to add the number of waiting quotes to the admin waiting content block...
(If using nuke older than 7.6 the replace ".$admin_file." with "admin".)
Open mainfile.php and find:
Code:$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=DownloadsListBrokenDownloads\">"._BROKENDOWN."</a>: $brokend<br></font>";
|
Add add:
Code:$qotmreqd = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_bbqotm WHERE quote_enabled='0'"));
$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=forums\">Waiting Quotes</a>: $qotmreqd<br></font>";
|
|
Last edited by JRSweets on Fri Jan 07, 2005 1:39 pm; edited 2 times in total |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Deseroka
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Jan 07, 2005 1:35 pm |
|
Thank you, but I am sorry. I got impatient and ended up removing the application and just adding them into my header. Very nice mod tho, and I love that members were able to submit. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
JRSweets
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Jan 07, 2005 1:39 pm |
|
Deseroka wrote: | Has anyone successfully made this work with a theme like Chronicles? I guess the images interfere, it shows up in a theme like 3DFantasy, but not Chronicles. |
Code:<?php
/************************************************************************************/
/* */
/* QOTM Block for PHP-Nuke 6.5-7.6 */
/* v1.0 */
/* */
/* Copyright © 2004 by: JRSweets (JRSweets@gmail.com) */
/* http://www.jeffrusso.net */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/* */
/************************************************************************************/
if(stristr($_SERVER['SCRIPT_NAME'], "block-Quote_of_the_Moment.php")) {
Header("Location: index.php");
die();
}
global $db, $prefix;
$quote_count = 0;
$sql = "SELECT COUNT(*) FROM $prefix"._bbqotm;
$quote_count = $db->sql_query($sql);
if ($quote_count > 0)
{
$sql ="SELECT quote_text, quote_author FROM $prefix"._bbqotm." WHERE quote_enabled = 1 ORDER BY rand()";
$row = $db->sql_fetchrow($db->sql_query($sql));
$content = '<center><font class=tiny><i>';
$content .= trim($row['quote_text']);
$content .= '</i><br>';
$content .= '- '.stripslashes($row['quote_author']).'</font></center>';
}
else
{
$content = 'No Quotes in Database';
}
?>
|
This is the whole updated block, it should intefere with anything. No images or anything are called. I have it working with 5 different themes on my site.
Hmm.... Strange |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Deseroka
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Jan 07, 2005 2:19 pm |
|
It worked in 3d fantasy, elektro, all of the others, but could not get it to work in Chronicles. I know this theme also interferes with the public message so....I dunno. You know much more than me ![Embarassed](modules/Forums/images/smiles/icon_redface.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
JRSweets
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Jan 07, 2005 3:38 pm |
|
If you ever try to install it again, send me a pm and I will see if I can get it working. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Deseroka
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Jan 07, 2005 3:57 pm |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|