Author |
Message |
Manuel
Regular


Joined: May 28, 2005
Posts: 90
|
Posted:
Sun Jul 03, 2005 11:04 pm |
|
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! |
|
|
 |
chatserv
Member Emeritus

Joined: May 02, 2003
Posts: 1389
Location: Puerto Rico
|
Posted:
Sun Jul 03, 2005 11:47 pm |
|
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. |
|
|
|
 |
Manuel

|
Posted:
Sun Jul 03, 2005 11:57 pm |
|
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  |
|
|
|
 |
chatserv

|
Posted:
Mon Jul 04, 2005 12:12 am |
|
Ok so let's try changing that line:
Code:if ($userdata['user_level'] > 1 && !ereg("uacp", $url)) {
|
|
|
|
|
 |
Manuel

|
Posted:
Mon Jul 04, 2005 12:20 am |
|
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...
may i have found some interesting... $SID is not set.. it's empty 8| |
|
|
|
 |
Manuel

|
Posted:
Wed Jul 06, 2005 11:50 am |
|
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

|
Posted:
Wed Jul 06, 2005 12:34 pm |
|
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

|
Posted:
Thu Jul 07, 2005 10:18 pm |
|
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

|
Posted:
Thu Jul 07, 2005 11:03 pm |
|
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

|
Posted:
Thu Jul 07, 2005 11:16 pm |
|
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

|
Posted:
Thu Jul 07, 2005 11:43 pm |
|
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

|
Posted:
Fri Jul 08, 2005 12:16 am |
|
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

|
Posted:
Fri Jul 08, 2005 12:29 am |
|
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

|
Posted:
Sun Jul 10, 2005 6:45 am |
|
i'm getting a headaches
$SID is *always* empty, in all links (default too). this is not a cookie problem.
in administration it works |
|
|
|
 |
|