Store Mode

$_SERVER should be $SERVER in my setup?? - Store Mode

$_SERVER should be $SERVER in my setup??

by MyGamesShop » Tue Apr 09, 2024 8:07 am

maintenance.php

<input type="button" class="button" value="Continue" onclick="window.location.href='<?= dirname($SERVER["REQUEST_URI"])."/index.php?language=en" ?>'" />


Apache2 supplies the $SERVER for me, Accepted below fix also suitable but less portable (In my case Apache2). A note in the read-me might might be nice. Thanks Raiwa for your reply.
Last edited by MyGamesShop on Wed Apr 10, 2024 3:50 am
MyGamesShop
Contributor
Posts: 131
Joined: Wed Mar 10, 2021 3:02 am
Phoenix Version: v1.1.0.6
Contact:

Re: $_SERVER should be $SERVER in my setup??

by raiwa » Tue Apr 09, 2024 8:29 am

$_SERVER is correct. See:
https://www.php.net/manual/en/reserved. ... server.php

But in some server installation $_SERVER may not be defined or not allowed.
The workaround would be to use your domain like this:

Code: Select all

      <input type="button"  class="button" value="Continue" onclick="window.location.href='<?= "https://mydomain.com/index.php?language=en" ?>'" />
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
raiwa
Certified Developer
Posts: 1640
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Contact:

I was wrong. Re: $_SERVER should be $SERVER in my setup??

by MyGamesShop » Thu Apr 11, 2024 4:00 am

$_SERVER["REQUEST_URI"] should be $_SERVER["SERVER_NAME"] after reading that document you referred me to.

So you wont need to add a note. :) I find a bug me tinks in 1.6.0 :)
MyGamesShop
Contributor
Posts: 131
Joined: Wed Mar 10, 2021 3:02 am
Phoenix Version: v1.1.0.6
Contact:

Re: $_SERVER should be $SERVER in my setup??

by raiwa » Thu Apr 11, 2024 7:25 am

dirname($_SERVER["REQUEST_URI"]) is correct. It includes the complete path if the store is under subdirectory.
$_SERVER["SERVER_NAME"] only gives the domain.

What seems to produce problems in some installations is the slash: "/index.php". So for now I think the most stable and universal version (apart of the hardcoded URL) would be:

Code: Select all

dirname($_SERVER["REQUEST_URI"]) . "?language=en"
Can you try and confirm please.
Please try for both settings: online and offline.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
raiwa
Certified Developer
Posts: 1640
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Contact:

Can you try and confirm please.

by MyGamesShop » Sat Apr 13, 2024 11:58 pm

Yes that works well, thank-you Raiwa :)
MyGamesShop
Contributor
Posts: 131
Joined: Wed Mar 10, 2021 3:02 am
Phoenix Version: v1.1.0.6
Contact: