Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
Manuel
Regular
Regular



Joined: May 28, 2005
Posts: 90

PostPosted: Sun Jul 03, 2005 11:04 pm Reply with quote

i have added to includes/pageheader.php these lines:

Code:


// MOD by Manuel @ UltraDigital.it - Attach MOD
'L_ATTACH' => $lang['Attach_posting_cp'],
'L_ATTACH_RULES' => $lang['Rules_page'],
'U_ATTACH' => append_sid('uacp.'.$phpEx.'&u='.$userdata["user_id"]),
'U_ATTACH_RULES' => append_sid('attach_rules.'.$phpEx),


in my local test i get the menu link correctly (http://home/UltraDigital/modules.php?name=Forums&file=uacp&u=2&sid=SSSSSSSSIIIIIDDDDDDDDDDDLOL)

but when i'm online i get this: http://www.ultradigital.it/modules.php?name=Forums&file=uacp&u=2

without appending the sid nothing works ;( help!

_________________
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
chatserv
Member Emeritus



Joined: May 02, 2003
Posts: 1389
Location: Puerto Rico

PostPosted: Sun Jul 03, 2005 11:47 pm Reply with quote

Let's see if we can add the sid, open includes/sessions.php and near the end of the file find the append_sid function, in it look for:
Code:
if (ereg("admin=1", $url) || ereg("admin_", $url) || ereg("pane=", $url)){

change that to:
Code:
if (ereg("admin=1", $url) || ereg("admin_", $url) || ereg("pane=", $url) || ereg("uacp", $url)){


And retry going to the url.
 
View user's profile Send private message Visit poster's website
Manuel







PostPosted: Sun Jul 03, 2005 11:57 pm Reply with quote

Code:


if (ereg("admin=1", $url) || ereg("admin_", $url) || ereg("pane=", $url) || ereg("uacp", $url)) {
                        //  The format is fine, don't change a thing.
   } else if (ereg("Your_Account", $url)){


as you can see we don't change a thing lol

i hope the problem is not some lines after...

Quote:

if ($userdata['user_level'] > 1) {


what i can't understand is why work on my localhost and not online Sad
 
chatserv







PostPosted: Mon Jul 04, 2005 12:12 am Reply with quote

Ok so let's try changing that line:
Code:
if ($userdata['user_level'] > 1 && !ereg("uacp", $url)) {
 
Manuel







PostPosted: Mon Jul 04, 2005 12:20 am Reply with quote

no your code above do not permit to append the sid and i want the exact opposite. i tried also || ereg("uacp", $url)) but doesn't work.
i think that this problem is related to the server so the code is somewhere out of there... Neutral

may i have found some interesting... $SID is not set.. it's empty 8|
 
Manuel







PostPosted: Wed Jul 06, 2005 11:50 am Reply with quote

trying to resolve this strange problems i fixed some little bugs in sessions.php

Code:



function append_sid($url, $non_html_amp = false)
{
   global $SID, $admin, $userdata;
   if (ereg("admin=1", $url) || ereg("admin_", $url) || ereg("pane=", $url)) {
      //  The format is fine, don't change a thing.
   } else if (ereg("Your_Account", $url)){
          $url = str_replace(".php", "", $url);       //  Strip the .php from all the files,
          $url = str_replace("modules", "modules.php", $url); //  and put it back for the modules.php
   }
   else if (ereg("redirect", $url))
   {
          $url = str_replace("login.php", "modules.php?name=Your_Account", $url);       //  Strip the .php from all the files,
          $url = str_replace(".php", "", $url);       //  Strip the .php from all the files,
          $url = str_replace("?redirect", "&redirect", $url);       //  Strip the .php from all the files,
          $url = str_replace("modules", "modules.php", $url); //  and put it back for the modules.php
   }
   else if (ereg("menu=1", $url))
   {
          $url = str_replace("?", "&", $url); // As we are already in nuke, change the ? to &
          $url = str_replace(".php", "", $url);       //  Strip the .php from all the files,
       $url = "../../../modules.php?name=Forums&file=$url";
   }
   else if ((ereg("privmsg", $url)) && (!ereg("highlight=privmsg", $url)))
   {
          $url = str_replace("?", "&", $url); // As we are already in nuke, change the ? to &
          $url = str_replace("privmsg.php", "modules.php?name=Private_Messages&file=index", $url); //  and put it back for the modules.php
   }
   else if ((ereg("profile", $url)) && (!ereg("highlight", $url) && !ereg("profile", $url)))
   {
          $url = str_replace("?", "&", $url); // As we are already in nuke, change the ? to &
          $url = str_replace("profile.php", "modules.php?name=Forums&file=profile", $url); //  and put it back for the modules.php
   }
   else if ((ereg("memberlist", $url)) && (!ereg("highlight=memberlist", $url)))
   {
          $url = str_replace("?", "&", $url); // As we are already in nuke, change the ? to &
          $url = str_replace("memberlist.php", "modules.php?name=Members_List&file=index", $url); //  and put it back for the modules.php
   } else {
          $url = str_replace("?", "&", $url); // As we are already in nuke, change the ? to &
          $url = str_replace(".php", "", $url);
          $url = "modules.php?name=Forums&file=".$url; //Change to Nuke format
   }
   if ($userdata['user_level'] > 1 ) {
      if ( !empty($SID) && !eregi('sid=', $url) ) {
         $url .= ( ( strpos($url, '?') != false ) ? ( ( $non_html_amp ) ? '&' : '&' ) : '?' ) . $SID;
      }   
   }
   return($url);
}

function admin_sid($url, $non_html_amp = false) {
   global $SID;
   $url = "../../../modules.php?name=Forums&file=$url";
   if ( !empty($SID) && !preg_match('#sid=#', $url) ) {
      $url .= ( ( strpos($url, '?') != false ) ?  ( ( $non_html_amp ) ? '&' : '&' ) : '?' ) . $SID;
   }
   return $url;
}



but i am still getting the error.... seems that $SID is not loaded only when the site is running online ;(
 
chatserv







PostPosted: Wed Jul 06, 2005 12:34 pm Reply with quote

Go to the forum's admin section and hover over the left side links, the browser's status bar should display the url with the sid attached. If it doesn't your sid is empty and that's what we should check next.
 
Manuel







PostPosted: Thu Jul 07, 2005 10:18 pm Reply with quote

i forgot to say that, in forum's admin i have the correct sid
in this case function admin_sid() has sid set correctly
i'm going to check if this error can be reconduced at the last patch 2.0.16
 
chatserv







PostPosted: Thu Jul 07, 2005 11:03 pm Reply with quote

Both append_sid and admin_sid grab the sid value from the same global so if the admin section shows it that means $sid is not empty, the one variant they have is admin_sid uses:
Code:
if ( !empty($SID) && !preg_match('#sid=#', $url) )

while append_sid uses:
Code:
if ( !empty($SID) && !eregi('sid=', $url) )

so you might try switching 'sid=' to '#sid=#' in append_sid to see if it makes any difference.

The:
Code:
if ($userdata['user_level'] > 1) {

in append_sid is meant to remove the side for logged in users. so as a test you might first want to try changing the append_sid function to:
Code:
function append_sid($url, $non_html_amp = false)

{
   global $SID, $admin, $userdata;
   if (ereg("admin=1", $url) || ereg("admin_", $url) || ereg("pane=", $url)){
                        //  The format is fine, don't change a thing.
   } else if (ereg("Your_Account", $url)){
           $url = str_replace(".php", "", $url);       //  Strip the .php from all the files,
           $url = str_replace("modules", "modules.php", $url); //  and put it back for the modules.php
   }
   else if (ereg("redirect", $url))
   {
           $url = str_replace("login.php", "modules.php?name=Your_Account", $url);       //  Strip the .php from all the files,
           $url = str_replace(".php", "", $url);       //  Strip the .php from all the files,
           $url = str_replace("?redirect", "&redirect", $url);       //  Strip the .php from all the files,
           $url = str_replace("modules", "modules.php", $url); //  and put it back for the modules.php
   }
   else if (ereg("menu=1", $url))
   {
           $url = str_replace("?", "&", $url); // As we are already in nuke, change the ? to &
           $url = str_replace(".php", "", $url);       //  Strip the .php from all the files,
       $url = "../../../modules.php?name=Forums&file=$url";
   }
   else if ((ereg("privmsg", $url)) && (!ereg("highlight=privmsg", $url)))
   {
           $url = str_replace("?", "&", $url); // As we are already in nuke, change the ? to &
           $url = str_replace("privmsg.php", "modules.php?name=Private_Messages&file=index", $url); //  and put it back for the modules.php
   }
   else if ((ereg("profile", $url)) && (!ereg("highlight", $url) && !ereg("profile", $url)))
   {
           $url = str_replace("?", "&", $url); // As we are already in nuke, change the ? to &
           $url = str_replace("profile.php", "modules.php?name=Forums&file=profile", $url); //  and put it back for the modules.php
       $dummy = 1;
   }
   else if ((ereg("memberlist", $url)) && (!ereg("highlight=memberlist", $url)))
   {
           $url = str_replace("?", "&", $url); // As we are already in nuke, change the ? to &
           $url = str_replace("memberlist.php", "modules.php?name=Members_List&file=index", $url); //  and put it back for the modules.php
   } else {
           $url = str_replace("?", "&", $url); // As we are already in nuke, change the ? to &
           $url = str_replace(".php", "", $url);
           $url = "modules.php?name=Forums&file=".$url; //Change to Nuke format
   }

   //if ($userdata['user_level'] > 1) {
   if ( !empty($SID) && !eregi('sid=', $url) )
   {
       if ( !empty($SID) && !eregi('sid=', $url) )   {
      $url .= ( ( strpos($url, '?') != false ) ?  ( ( $non_html_amp ) ? '&' : '&' ) : '?' ) . $SID;
          }
      }   
   //}
   return($url);
}
 
Manuel







PostPosted: Thu Jul 07, 2005 11:16 pm Reply with quote

thanks but i already tried this

i've added echo $SID before the IF to see if $sid was set but it was empty, as i already said...
 
chatserv







PostPosted: Thu Jul 07, 2005 11:43 pm Reply with quote

Echo will not return anything within forum files because data must first pass through the template function files and then get formated for the theme. Ok, this reverts the append_sid to the format used by standalone phpBB (with the exception of the url formatting required for the urls to work inside of Nuke, load it and browse through the forums (not only on the url of the mod you are trying to add) to see if the sid gets added to forum urls like when viewing a topic. I tested it and it added the sid to my test site's forums.

Code:
function append_sid($url, $non_html_amp = false)

{
   global $SID, $admin, $userdata;
   if (ereg("admin=1", $url) || ereg("admin_", $url) || ereg("pane=", $url)){
                        //  The format is fine, don't change a thing.
   } else if (ereg("Your_Account", $url)){
           $url = str_replace(".php", "", $url);       //  Strip the .php from all the files,
           $url = str_replace("modules", "modules.php", $url); //  and put it back for the modules.php
   }
   else if (ereg("redirect", $url))
   {
           $url = str_replace("login.php", "modules.php?name=Your_Account", $url);       //  Strip the .php from all the files,
           $url = str_replace(".php", "", $url);       //  Strip the .php from all the files,
           $url = str_replace("?redirect", "&redirect", $url);       //  Strip the .php from all the files,
           $url = str_replace("modules", "modules.php", $url); //  and put it back for the modules.php
   }
   else if (ereg("menu=1", $url))
   {
           $url = str_replace("?", "&", $url); // As we are already in nuke, change the ? to &
           $url = str_replace(".php", "", $url);       //  Strip the .php from all the files,
       $url = "../../../modules.php?name=Forums&file=$url";
   }
   else if ((ereg("privmsg", $url)) && (!ereg("highlight=privmsg", $url)))
   {
           $url = str_replace("?", "&", $url); // As we are already in nuke, change the ? to &
           $url = str_replace("privmsg.php", "modules.php?name=Private_Messages&file=index", $url); //  and put it back for the modules.php
   }
   else if ((ereg("profile", $url)) && (!ereg("highlight", $url) && !ereg("profile", $url)))
   {
           $url = str_replace("?", "&", $url); // As we are already in nuke, change the ? to &
           $url = str_replace("profile.php", "forums.html?file=profile", $url); //  and put it back for the modules.php
       $dummy = 1;
   }
   else if ((ereg("memberlist", $url)) && (!ereg("highlight=memberlist", $url)))
   {
           $url = str_replace("?", "&", $url); // As we are already in nuke, change the ? to &
           $url = str_replace("memberlist.php", "modules.php?name=Members_List&file=index", $url); //  and put it back for the modules.php
   } else {
           $url = str_replace("?", "&", $url); // As we are already in nuke, change the ? to &
           $url = str_replace(".php", "", $url);
           $url = "forums.html?file=".$url; //Change to Nuke format
   }

   if ( !empty($SID) && !preg_match('#sid=#', $url) )
   {
      $url .= ( ( strpos($url, '?') != false ) ?  ( ( $non_html_amp ) ? '&' : '&' ) : '?' ) . $SID;
   }

   return $url;

}
 
Manuel







PostPosted: Fri Jul 08, 2005 12:16 am Reply with quote

i don't know how to thank you 4 your help but not even this works... in other links i haven't the sid because is unuseful (like this forum's menu), in admin i get the correct sid
 
chatserv







PostPosted: Fri Jul 08, 2005 12:29 am Reply with quote

Something is wrong in your files then, i tried the above edited function on several sites and sure enough the sid was attached to the url, email me your functions.php and sessions.php files, i want to take a look at them, in the email include the Nuke and BBtoNuke version numbers, do not zip the two files.

chatserv at nukefixes dot com
 
Manuel







PostPosted: Sun Jul 10, 2005 6:45 am Reply with quote

i'm getting a headaches

$SID is *always* empty, in all links (default too). this is not a cookie problem.

in administration it works
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©