SpeedUp mainfile.php in KB - Selecting Theme Problem

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   SpeedUp mainfile.php in KB - Selecting Theme Problem
Trubador
CZ Active Member
Trubador has been a member for over 19 year's 19 Year Member
uk.gif
Occupation: Aircraft Technician
Age: 52
Gender: Male
Status: Offline
Joined: Nov 16, 2004
0.01 posts per day
Posts: 104
Points: 4,807
   
I've inserted all the fixes described in this KB and the webpage does speed up slightly. Thanks.

However, when in Your Account, I have to select a Theme change twice. The first time it just refreshes and automatically shows the theme just selected in the dropdown menu. I have to select again for the theme to finally change.

Using PhPNuke 7.4

Any ideas on a fix?

Trub




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#2   
Telli
Site Admin
Telli has been a member for over 20 year's 20 Year Member
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.06 posts per day
Posts: 8089
Points: 494,430
   
I did notice this but havnt had any time to look into it. I added a second function in my mainfile and changed it in the Your_Account module.


function getusrinfo_theme($user) {
    global $userinfo, $user_prefix, $db;
    $user2 = base64_decode($user);
    $user3 = explode(":", $user2);
    $sql = "SELECT * FROM ".$user_prefix."_users WHERE username='$user3[1]' AND user_password='$user3[2]'";
    $result = $db->sql_query($sql);
    if ($db->sql_numrows($result) == 1) {
       $userinfo = $db->sql_fetchrow($result);
    }
    return $userinfo;
}


A temp fix till I have some time to debug it.



_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   re: SpeedUp mainfile.php in KB - Selecting Theme Problem
Trubador
CZ Active Member
Trubador has been a member for over 19 year's 19 Year Member
uk.gif
Occupation: Aircraft Technician
Age: 52
Gender: Male
Status: Offline
Joined: Nov 16, 2004
0.01 posts per day
Posts: 104
Points: 4,807
   
Thanks Telli.

Trub




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#4   
JRSweets
CZ Active Member
 Codezwiz Site Donator
JRSweets has been a member for over 20 year's 20 Year Member
usa.gif massachusetts.gif
Age: 42
Gender: Male
Fav. Sports Team: NE Patriots
Website:
Status: Offline
Joined: Apr 07, 2004
0.04 posts per day
Posts: 259
Points: 19,861
  MSN Messenger 
I have also noticed this problem, and I just thought it was me until I occured in a new site I setup. Somehow NukeSentinel and CNB/NSN YA make you have to select to change the theme twice it you install all the speed hacks.

Try commenting out the NukeSentinel and CNBYA/NSNYA includes in mainfile.php and you will be able to change themes without having to do it twice.

I have found if you change the function to this:
function getusrinfo($user) {
    global $user_prefix, $db, $userinfo;
    if (!$user || $user == '') { return NULL; }
    if(!is_array($user)) {
        $user = base64_decode($user);
        $user = explode(":", $user);
    }
    if (is_array($userrow)) {
        if ($userrow['username'] == $user[1] && $userrow['user_password'] = $user[2]) {
            return $userrow;
        }
    }
    $sql = "SELECT * FROM ".$user_prefix."_users WHERE username='$user[1]' AND user_password='$user[2]'";
    $result = $db->sql_query($sql);
    if ($db->sql_numrows($result) == 1) {
        static $userrow;
        $userrow = $db->sql_fetchrow($result);
        return $userinfo = $userrow;
    }
    unset($userinfo);
}


Everything will work. Basically the static varible is moved down in the function. I don't know if this still increads speed but its what I have been using.

Where do you make the change in YA?


Back to top Reply with quote
#5   
Trubador
CZ Active Member
Trubador has been a member for over 19 year's 19 Year Member
uk.gif
Occupation: Aircraft Technician
Age: 52
Gender: Male
Status: Offline
Joined: Nov 16, 2004
0.01 posts per day
Posts: 104
Points: 4,807
   


Originally posted by JRSweets @ Fri Feb 25, 2005 3:43 pm:

Basically the static varible is moved down in the function. I don't know if this still increads speed but its what I have been using.

Where do you make the change in YA?


That was definetly directed to you Telli.....

I think JR has come to understand how totally code illiterate I am!!!! icon_cry.gif icon_biggrin.gif

Thanks for the info JR, as you know I've just installed CNBYA.

Cheers

Trub




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#6   
JRSweets
CZ Active Member
 Codezwiz Site Donator
JRSweets has been a member for over 20 year's 20 Year Member
usa.gif massachusetts.gif
Age: 42
Gender: Male
Fav. Sports Team: NE Patriots
Website:
Status: Offline
Joined: Apr 07, 2004
0.04 posts per day
Posts: 259
Points: 19,861
  MSN Messenger 
I have tried both fixes out and Telli's fix works better as it appears the modified function I posted doesn't reduce the sql queries like the original function.

So use the all the edits in the KB and then place telli's new function in mainfile.php and (in CNBYA) open modules/Forums/Your_Account/public/savetheme.php and replace the:
getusrinfo($user);


With this line:
getusrinfo_theme($user);



Back to top Reply with quote
#7   re: SpeedUp mainfile.php in KB - Selecting Theme Problem
Trubador
CZ Active Member
Trubador has been a member for over 19 year's 19 Year Member
uk.gif
Occupation: Aircraft Technician
Age: 52
Gender: Male
Status: Offline
Joined: Nov 16, 2004
0.01 posts per day
Posts: 104
Points: 4,807
   
Thanks for that both and thanks for your patience. I'm slowly getting my head around PhP.
Given a decade or two I may not even need to ask these questions. icon_biggrin.gif

I'm in the middle of theme editing, so I'll give these a go as soon as I can.

Cheers

Trub

*EDIT* Works great, cant really tell with the page generation time, down to 0.160 ish icon_eek.gif icon_biggrin.gif Happy with that!!!




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#8   
JRSweets
CZ Active Member
 Codezwiz Site Donator
JRSweets has been a member for over 20 year's 20 Year Member
usa.gif massachusetts.gif
Age: 42
Gender: Male
Fav. Sports Team: NE Patriots
Website:
Status: Offline
Joined: Apr 07, 2004
0.04 posts per day
Posts: 259
Points: 19,861
  MSN Messenger 
I have the number of sql queries displayed on my site like here and it really cuts them down alot.

Thanks for the fix Telli. icon_biggrin.gif



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
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 cannot attach files in this forum
You cannot download files in this forum