Previous Thread
Next Thread
Print Thread
Rate Thread
#211270 08/06/2001 9:06 PM
Joined: Sep 1999
Posts: 33
Power User
Power User
Offline
Joined: Sep 1999
Posts: 33
Hi Scream,

Fix for weird language file names (at least in the logout.php routine). It might be happening elsewhere too.

In logout.php t he line
$user[loggedout] = 1;
should be
$user['loggedout'] = "1";

I have put some gettype commands in main.inc.php so I can see what is happening. When I execute logout.php from the command line (I am logged out already, no cookies), $user will have a type of "string" instead of "array" when it comes into send_header in main.inc.php. Very weird.

When this happens $user[newlanguage] is equal to "1" or "s" or whatever it grabs from memory. This causes problems with the language files because now it uses that instead of english or whatever.

$user['loggedout'] = "1"; fixes it.

I hope this helps!

Last edited by SitStay; 08/06/2001 9:36 PM.
Sponsored Links
mh #211271 08/07/2001 8:45 AM
Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
Thanks for the info. Will get that changed over.


UBB.threads Developer
Joined: Sep 1999
Posts: 33
Power User
Power User
Offline
Joined: Sep 1999
Posts: 33
I put 5.4.3 into production and this Type Conversion problem bit me again. It seems that typing is a problem with the $user variable which might need to be explored in greater depth. I put gettype statements in the send_header routine and found the type for $user isn't always the array but we expect it to be.

In main.inc.php's send_header routine, I was getting stylesheets not found because they were coming up "/stylesheet/1.css".

When I was testing I found that in the logout.php routine sets the $user[loggedout] flag to 1 right before sending calling send_header. In my original tests, changing this to [:blue]$user['loggedout'] = "1"; kept the type as array in the send_header routine. But when I moved the files into production, the problem crept back in. I could run the exact same program files in one directory and I'd get the error. But in another directory I wouldn't. It seems type is still a problem. So here is what I did to correct it once and for all.

In the send_header routine, I added an if statement to verify that $user is actually an array. Because of the typing problem, sometimes it is Boolean and sometimes it is a string. In those cases this section will cause problems. But also in those cases, none of the fields in this section are set so bypassing them doesn't cause problems. My additions are in blue.

[:blue]if ( is_array($user) ) {
// -----------------------------
// Grab any personal preferences
$FrontPage = $user[U_FrontPage];
$Privates = $user[U_Privates];
$StyleSheet= $user[U_StyleSheet];
$Status = $user[U_Status];
if ($user[newlanguage]) {
require ("$config[path]/languages/$user[newlanguage]/generic.php");
}
[:blue]}

This has solved the problem and I am no longer seeing the stylesheet errors.


mh #211273 08/10/2001 9:53 AM
Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
Thanks for the info. I'm going to spend some time and change the majority of the arrays to the ['key'] type instead of the [key], at least the ones that seem to be causing some problems currently.


UBB.threads Developer

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Bill B
Bill B
Issaquah, WA
Posts: 87
Joined: December 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240506)