PHP Web Host - Quality Web Hosting For All PHP Applications $35/month $250/year (Unlimited) - $25/month - 200,000 impressions - Your Ad Could be Here - Click For Details
  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
technocrat
Involved
Involved


Joined: Jul 07, 2005
Posts: 492

PostPosted: Thu Mar 15, 2007 11:25 pm Reply with quote Back to top

No it will work, but thats because registered globals are turned on. But I would get in the habit of declaring all your globals in included files, just to make sure that something unexpected doesnt happen.

Like I said they are suggestions nothing else. I am just happy you guys secured it. You could hack this really easily in it's original state.
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 4640

PostPosted: Fri Mar 16, 2007 5:50 am Reply with quote Back to top

Thanks - definitely great suggestions! Have you looked at performance impact of using freeresult?
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 14946
Location: Kansas

PostPosted: Fri Mar 16, 2007 8:19 am Reply with quote Back to top

I don't run register_globals on, as a host, and I add register_globals off to my .htaccess just as added insurance.

technocrat wrote:
Second add $db->sql_freeresult();


According to this post,
Only registered users can see links on this board!
Get registered or login to the forums!

Using this function may actually increase the amount of memory used. In my case, the script used 208 bytes less memory when *not* using mysql_free_result().
Check for yourself: call memory_get_usage() at the end of the script.

It is not recommended to use this with PHP 4.x
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 14946
Location: Kansas

PostPosted: Fri Mar 16, 2007 8:51 am Reply with quote Back to top

Mad I inadvertently deleted the first 2 posts of this thread! Rather than try to put them back in order, I'll just repost them here.
-----------------------------------------------------------------------------------------

Technocrat
Posted: Thu Mar 15, 2007 9:47 am
These are just a few suggestions, so you can do what ever with them.

First I would change all the if statements to else if. There is no reason to parse all the other if statements when its not possible to be in two areas at once.

Second add $db->sql_freeresult(); to your queries or add an unbuffered fetch to your db class. It will help keep down the memory usage. You should probably get in the habit of adding it everywhere.

Third $newpagetitle = $slogan; you do not have it globally declared except in the if news statement.
-----------------------------------------------------------------------------------------
KGuske
Posted: Thu Mar 15, 2007 8:39 pm
Interesting ideas. I haven't tested the dynamic titles, really, but I did look at the code and I'm not sure the variables need to be globally declared. Did you verify a problem, technocrat?
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
montego
Site Admin


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

PostPosted: Fri Mar 16, 2007 9:10 am Reply with quote Back to top

Yeah, I don't have register globals on either and I am running 2.10. Odd.

I"ll take a look at your suggestions, especially the else if. I agree with you that from an execution point (rather than parse), it would be quicker.

I have added this to my "to-do" as I have also released this to the public so the non-RN'ers could benefit.
View user's profile Send private message Visit poster's website
Gremmie
Moderator


Joined: Apr 06, 2006
Posts: 2374
Location: Iowa, USA

PostPosted: Fri Mar 16, 2007 9:33 am Reply with quote Back to top

I'm confused about something. You guys may not have register globals turned on, but Nuke essentially overrides you with import_request_variables(). Unless you guys rewrote all of Nuke to use $_POST, $_GET, etc. Confused
View user's profile Send private message
technocrat
Involved
Involved


Joined: Jul 07, 2005
Posts: 492

PostPosted: Fri Mar 16, 2007 9:40 am Reply with quote Back to top

Rolling Eyes Sure you "inadvertently" deleted it ROTFL

Well if it doesn't make a difference in 4 then it does in 5. I took the memory usage down 1/3 by adding freeresults in a lot of places, like mainfile, and sentinel. Plus if you look at the code for phpbb v3 db class they free all the db queries. Not that they are the perfect coders but they generally do good work.
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 14946
Location: Kansas

PostPosted: Fri Mar 16, 2007 9:55 am Reply with quote Back to top

technocrat,

Yes, in PHP 5 it seems it does make a difference. Especially if you use mysqlI
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 4581
Location: Slovakia - working my way around Eastern Europe

PostPosted: Sat Mar 17, 2007 8:02 am Reply with quote Back to top

So there would be some future benefit by perhaps setting a constant in rnconfig.php to indicate whether the user was utilising PHP 5.x.x and then wrapping the freeresult in an if isset so it only gets execute the constant is set?
View user's profile Send private message Send e-mail Visit poster's website
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 14946
Location: Kansas

PostPosted: Sat Mar 17, 2007 8:23 am Reply with quote Back to top

Actually, it would be easier to just do an internal test rather than add another setting Smile
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
gotcha
Regular
Regular


Joined: Mar 14, 2005
Posts: 70

PostPosted: Sat Mar 17, 2007 1:36 pm Reply with quote Back to top

I think it would be nice to make it work similar to the way GT includes the url rewrites.
So if there is a file "dynamic_titles/DT-Forums.php" include it and make a $GLOBAL variable that contains the dynamic title... if the $GLOBAL is empty have it revert to the default $sitename $pagetitle.
Not sure if it will be much faster than using a bunch of if else statements, but it will certainly be alot cleaner and would give developers a chance to include it in their modules Smile
View user's profile Send private message Visit poster's website
montego
Site Admin


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

PostPosted: Sun Mar 18, 2007 9:57 am Reply with quote Back to top

gotcha, the concept is a sound one. We would have to run some tests to see if the If-elseif length is really too long to warrant the additional disk reads. My gut tells me that there is probably some "breaking point", where it might start being the more efficient approach... but, to quote a famous Quality guru Deming: "In God I trust, everyone else, show me the data..." Smile
View user's profile Send private message Visit poster's website
gotcha
Regular
Regular


Joined: Mar 14, 2005
Posts: 70

PostPosted: Sun Mar 18, 2007 4:25 pm Reply with quote Back to top

Maybe if the dynamic title code was included in the GoogleTap/GT-*.php file it would save the extra disk read and eliminate the if $name ==. I know in GT-nextgen(haven't tried yours yet) the GT-*.php file is included before the head(); function is called. I am actually using the method from my last post but I haven't really done any speed comparisons yet.
View user's profile Send private message Visit poster's website
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-2008 by Raven
Proud to be listed at Lobo Links Web Directory

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 Recoded To 100% W3C CSS & HTML 4.01 Transitional Compliance by Raven and 64bitguy ::

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

zerosum