Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Payou on June 26, 2020, 12:11:34 PM

Title: White Screen when not logged in - SMF 2.0.17
Post by: Payou on June 26, 2020, 12:11:34 PM
Hello!

I am actually making a forum using SMF 2.0.17. The forum was looking good but this morning I realized that the forum is completely blank (even if I inspect the page) when the user is not logged in. I dont know where I can find the MySQL and PHP version I use.

You can still go manually on the forum using ?action=login to log on. Once you're on any account, the forum goes back to normal, no blank page whatsoever.
I checked my log_errors on my db but it only returns this error
Quote2: Use of undefined constant Site - assumed 'Site' (this will throw an Error in a future version of PHP)
[...]/BoardIndex.template.php (body_above sub template - eval?) - Line 288
But I checked my line 288 and it's blank, there's nothing on this line. There are on 287 and 289, but not 288.

The problem is that when you're not logged in, the page is completely white, so I can't have members registering. I tried adding some code in the header of the index_template.php to force the redirection to the login page (only to the users that are not logged in yet) :


$redirecturl = "http://lsplusforum.fr/forum/index.php?action=login";
if(empty($context['user']['is_logged']))
echo '<meta http-equiv="refresh" content="60;url=\'' . $redirecturl . '\'" />';


It does work perfectly when you are on the login page, but it doesn't work on the index.php alone, even when content is at 0.

You can try it for yourself at lsplusforum.fr/forum/index.php
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: Sir Osis of Liver on June 26, 2020, 12:23:03 PM
In your database, go to smf_settings, set theme_default to 1.
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: Payou on June 26, 2020, 12:27:49 PM
It is already set on 1
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: Sir Osis of Liver on June 26, 2020, 12:41:17 PM
I'm seeing custom login page, not default Curve.  Are you using SSI for login?

You can get php and mysql versions using phpinfo (attached), but don't think that's your problem.
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: Sir Osis of Liver on June 26, 2020, 12:48:55 PM
Looks like you're running Greeny theme.  Are theme_allow, theme_default, theme_guests all set to 1?

If you can login and get to admin, set overall default theme to Curve and reset everyone.
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: Shambles on June 26, 2020, 12:49:46 PM
Did you by any chance remove some or all the files in the default (curve) theme folder?


(https://i.imgur.com/Ix5KSHG.jpg)
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: Arantor on June 26, 2020, 12:55:47 PM
QuoteI tried adding some code in the header of the index_template.php to force the redirection to the login page (only to the users that are not logged in yet) :

You don't need to do that, please remove your changes; you can disable guest access from an option in the admin panel.
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: Payou on June 26, 2020, 01:04:50 PM
@Shambles No, I only use the Greeny Theme.

@Arantor I put this code to try if it could change anything, not necessarily make it permanent

@Sir Osis. I'm not on the computer right now, will try later tonight
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: Kindred on June 26, 2020, 01:07:09 PM
you use only the greeny theme...  BUT -- you NEVER can remove the files in the default theme folder (aka Curve theme) -- nor should you replace those files with your custom theme -- always use a separate directory for your custom themes -- the default theme is the fall-back if the custom theme has not defined a custom version of any individual template file.
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: Sir Osis of Liver on June 26, 2020, 01:11:45 PM
It's installed in /Themes/Greeny/, but some of it's been modded, and Curve may be broken.  Guests see Greeny, registration loads, but that's as far as I can get.
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: Payou on June 26, 2020, 01:19:11 PM
@Kindred I really dont remember deleting or editing any files in the Curvy Theme. Though, someone else used to make the forum before me. But they didn't have any knowledge in ftp and stuff so I don't think it were them.

@Sir Osis I've made an account so you can test the logged side.
User : smfsupport
Pass : support2020

Yes I did add plugins to the forum, and I know how to script in php HTML so I edited some pages. But I didn't make any changes recently that would explain my problem.
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: Sir Osis of Liver on June 26, 2020, 01:35:31 PM
Everything seems to be working in Greeny when logged in.  Best guess is guests are seeing different theme.  Check if  theme_default, theme_guests are set to 1, that should reset everything to Curve.  If theme_default is already set to 1, you've broken something in theme installs, or settings are screwed up.  Have you run repair_settings?  It allows you to fix theme paths and reset all users to default Curve.

Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: lurkalot on June 26, 2020, 02:15:34 PM
Funny enough we had exact same scenario over on the tinyportal.net site about 6 days ago.  So thought I'd throw it in here just in case.  ;)

You could view the site logged in, but as guest the site was giving a white screen.   The only thing I noticed was one of the recent posts contained Turkish language and was showing strange characters Dimond's etc in the topic title.  This caused the page to choke completely for some reason, just a white page, and only as guest.  I edited the Topic title and the page loaded normally. If I pasted the original title back in it choked with a white screen again. 

Our database wasn't properly converted to utf8, which it is now.    Everything back to normal.  Never seen this happen before.
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: Payou on June 26, 2020, 02:50:45 PM
@lurkalot I tried what you said. In French we use acute accent just like in my case : Deban = Dé-bannissement.

I tried changing that 'é' to a 'e' and it resolved the problem.
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: lurkalot on June 26, 2020, 02:53:49 PM
Quote from: Payou on June 26, 2020, 02:50:45 PM
@lurkalot I tried what you said. In French we use acute accent just like in my case : Deban = Dé-bannissement.

I tried changing that 'é' to a 'e' and it resolved the problem.

Yep, that was worth mentioning then after all.  It's working for me too now.  ;)

Now all you've got to do it stop it happening again.
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: Payou on June 26, 2020, 02:58:38 PM
I will convert my database to utf8 like you said as soon as I get to my computer
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: Sir Osis of Liver on June 26, 2020, 09:25:18 PM
Nice catch, Mick.
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: lurkalot on June 27, 2020, 07:33:56 AM
Quote from: Sir Osis of Liver on June 26, 2020, 09:25:18 PM
Nice catch, Mick.

Thanks, but still don't know why it would spit its dummy out on something like this.  Like I said I haven't noticed it before until last week when we had the issue.
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: Jesse17 on August 30, 2020, 06:02:12 PM
My site has been running since 2011, IIRC. No problems. In May I updated one version at a time from 2.0.8 to 2.0.17. Still no problems until the last week or two where I started having this same issue. You could log in if you followed a link directly to a thread/forum/post/etc. but if you weren't logged in when you went to the landing page you got the white screen.

After reading this thread, I converted the database to UTF8 and all is well again.
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: izotz on October 30, 2021, 11:25:53 AM
Quote from: lurkalot on June 26, 2020, 02:15:34 PMFunny enough we had exact same scenario over on the tinyportal.net site about 6 days ago.  So thought I'd throw it in here just in case.  ;)

You could view the site logged in, but as guest the site was giving a white screen.   The only thing I noticed was one of the recent posts contained Turkish language and was showing strange characters Dimond's etc in the topic title.  This caused the page to choke completely for some reason, just a white page, and only as guest.  I edited the Topic title and the page loaded normally. If I pasted the original title back in it choked with a white screen again. 

Our database wasn't properly converted to utf8, which it is now.    Everything back to normal.  Never seen this happen before.

This was exactly the behaviour in our website for many users. I was confused because it did work for many of us, so I thought it was browser related. But somebody spotted the offending post with special characters, edited it, and it works better now. So thanks for the tip!  :)

I understand that the next step is to have a look at the database. What do you mean that it was not "properly" converted utf8? How can I check this? I thought I had converted it a few years ago, but I can't be sure what I did. I can only see that the database string columns collation is utf8_general_ci . Is this ok?

What else should I do about this?
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: izotz on February 27, 2022, 05:44:26 AM
I had my moderators editing new post titles containing special characters for the last while to avoid this error.
I think my database is ok, but I can't tell for sure what to do about it, or how I can tell it is ok or not, or how to do it.
Any idea if this would be fixed with the recent upgrade to 2.1.1?
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: izotz on May 12, 2022, 12:14:46 PM
I don't know if this will be helpful for anybody, but I think this has not happened to us after we upgraded to 2.1.x, so I assume it got fixed.

Thanks for all the hard work!  :)
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: Doug Heffernan on May 12, 2022, 01:05:10 PM
Glad to see that the issue has been fixed and thank you for letting us know and posting the solution as it will help other users too who might run into the same issue. Marking this as solved.
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: btechnix on January 23, 2024, 05:40:53 PM
Another situation which generates the same problem can be seen here https://www.simplemachines.org/community/index.php?topic=588053.0 (https://www.simplemachines.org/community/index.php?topic=588053.0)
Title: Re: White Screen when not logged in - SMF 2.0.17
Post by: Kindred on January 23, 2024, 07:14:36 PM
Please do not resurrect 2 year old topics...  the original problem described here was fixed by upgrading ....   and, as I said in your topic -- by correctly converting to utf8 instead of hacking the system because you dud it wrong in thr first place.