You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 41 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - Custom headline blocks not properly updating database [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
thepacketmaster
Nuke Cadet
Nuke Cadet


Joined: Jul 12, 2003
Posts: 3


PostPosted: Thu Jul 24, 2003 6:19 am Reply with quoteBack to top

I'm working with phpnuke 6.5. Sorry if this is already fixed in later versions.

I added a new block to download recent news from Slashdot. I've encountered a problem that every time I load a page on my site, it always calls the Slashdot site, even though the refresh is set for 1 hour. It turns out that some of the slashdot headlines have apostrophes and this breaks the SQL statement to update the content.

In the mainfile.php, you have lines like this:

$sql = "UPDATE ".$prefix."_blocks SET content='$content', time='$btime' WHERE bid='$bid'";

When this line gets called and $content has an apostrophe, it breaks the SQL statement, and the time doesn't get updated. So it keeps calling the site. The line should be updated to use the mysql_escape_string function to escape certain special characters:

$sql = "UPDATE ".$prefix."_blocks SET content='".mysql_escape_string($content)."', time='$btime' WHERE bid='$bid'";

Once I put this fix in, everything worked as expected. The database now updates properly. This mysql_escape_string should be used anywhere that the content may vary. (It should really be used everywhere.)
Find all posts by thepacketmasterView user's profileSend private message
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next 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



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by · TOGETHER TEAM srl ITALY http://www.togetherteam.it · DONDELEO E-COMMERCE http://www.DonDeLeo.com
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.158 Seconds - 280 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::