PHP Web Host - Quality Web Hosting For All PHP Applications Sign up for PayPal and start accepting credit card payments instantly
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
eldorado
Involved
Involved


Joined: Sep 10, 2008
Posts: 366
Location: France

PostPosted: Sun Apr 26, 2009 10:57 am Reply with quote Back to top

evaders99 wrote:
Quote:
8. stripslashes on every form to prevent sql injection.


Actually no. addslashes is what you want to prevent sql injections. Better, use mysql_real_escape_string (only if using MySQL databases)

my bad sorry. I better review my ongoing module Razz

Anyway i'm OffTopic

I can't think of anything else i've seen during my coding session apart from this bit.
If ($string== "" );
to
If("" == $string); I'm sure I saw raven post something about conditionals.
View user's profile Send private message Visit poster's website MSN Messenger
montego
Former Admin in Good Standing


Joined: Aug 29, 2004
Posts: 9071
Location: Arizona

PostPosted: Mon Apr 27, 2009 10:01 pm Reply with quote Back to top

It is just to keep you from messing up by accidentally using an assignment of "=" instead of the comparison operator "==". No other reason really.

I usually use if (empty($string)) if I also want to consider other values as "no input". See the PHP manual for what I mean... But, just remember that there is no silver bullet. "Know thy input".... "Cleanse thy input"... and then "Use thy input appropriately" (as you may need to do different things depending upon what comes next.
View user's profile Send private message Visit poster's website
eldorado
Involved
Involved


Joined: Sep 10, 2008
Posts: 366
Location: France

PostPosted: Tue Apr 28, 2009 12:20 am Reply with quote Back to top

montego wrote:
It is just to keep you from messing up by accidentally using an assignment of "=" instead of the comparison operator "==". No other reason really.

I should have explained this ^_^ .
Anyway I think that these two should be standardize for nuke coding and this post be a reference for future modules posted in this section.
View user's profile Send private message Visit poster's website MSN Messenger
technocrat
Life Cycles Becoming CPU Cycles


Joined: Jul 07, 2005
Posts: 511

PostPosted: Sun May 03, 2009 10:14 am Reply with quote Back to top

$string == "" would create a warning and shouldn't be used. As montego said you should be using empty()
View user's profile Send private message
duck
Worker
Worker


Joined: Jul 03, 2006
Posts: 247

PostPosted: Wed Sep 16, 2009 10:24 am Reply with quote Back to top

I thought I would chime in here with an idea for the standardization topic in case it ever becomes a reality.

How about Standardizing SQL inserts MUST always be Extended?

Reasoning behind this if using extended inserts and should fields be added to a table in future there is less likely to break of old code. I mean if current fields drop or are altered this may not help much but at least when wanting to add to or improve the functionality of a table with new fields we don't start breaking a bunch of other modules dependent on it.

Just something to think about when compiling your list of Do's and Don'ts for Standardization or compatibility.
View user's profile Send private message
fkelly
Moderator


Joined: Aug 30, 2005
Posts: 3137
Location: near Albany NY

PostPosted: Wed Sep 16, 2009 12:31 pm Reply with quote Back to top

Duck, thank you for reminding me of this. I agree wholeheartedly. This has always bugged my about Nuke.

I assume you are talking about syntax where you have a list of values that have to be in the exact order that the fields are defined in the table. As in this horrible example:

Code:
INSERT INTO $user_prefix.`_users` VALUES (1, '', 'Anonymous', '', '', '', 'blank.gif', 'Oct 10, 2008', '', '', '', '', '', 0, 0, '', '', '', '', 10, '', 0, 0, 0, '', 0, '', '', 4096, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 10, NULL, 'english', 'D M d, Y g:i a', 0, 0, 0, NULL, 1, 1, 1, 1, 1, 1, 1, 1, 0, 3, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0);


Try to figure out where a new or missing field goes in there. It would be so much nicer and maintainable if the code said user_id = '1'
username = 'anonymous' ... etc.

one per line. I'd like to see us "backport" (as Chloe on the TV show 24 used to day) that approach into RN as time permits.
View user's profile Send private message Visit poster's website
duck
Worker
Worker


Joined: Jul 03, 2006
Posts: 247

PostPosted: Wed Sep 16, 2009 1:09 pm Reply with quote Back to top

Yes that was exactly what I am referring to and he has always bugged me too! lol

And BTW 24 Rocks! Cool (but last season kind of sucked unfortunately so I hope the do better this year)
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum