I have website with nginx as reverse proxy and apache as backend with mod_php. Sometimes nginx return 502 error on specific url (like http://example.com/ipb.html?automodule=elfchat) , because apache close connection. In good scenario – script should redirect me to another page. Here is file which crash connection:
define('ELFCHAT_VERSION', '4.2.1');
include_once(ELFCHAT_PATH."config.php");
include_once(ELFCHAT_PATH."settings.php");
include_once(ELFCHAT_PATH."error.php");
include_once(ELFCHAT_PATH."kernel/db.php");
include_once(ELFCHAT_PATH."kernel/sessions.php");
include_once(ELFCHAT_PATH."kernel/skinloader.php");
include_once(ELFCHAT_PATH."kernel/kernel.php");
Elfchat::Init($config, unserialize($settings));
Skin::Setskinpath("skin/".Elfchat::Settings("skin")."/");
/**
* Код для пользовательского смена скина и языка.
*/
Elfchat::Session()->start();
if(isset($_GET['useskin']))
{
if($_GET['useskin'] == "ichat")$skin = "ichat";
else $skin = "elfskin";
$_SESSION['useskin'] = $skin;
}
if(isset($_SESSION['useskin']))
{
if($_SESSION['useskin'] == "ichat")$skin = "ichat";
else $skin = "elfskin";
Skin::Setskinpath("skin/".$skin."/");
}
/**
* Конец дополнительного кода
*/
@header('Content-Type: text/html; charset=utf-8');
If i comment out last line everything start works, but with bad encoding, after deleting comments everything work even encoding is good. After some time things gone bad.
Please help, i`m nginx newbie.
I forgot to say – i upgraded php version from 5.2 to 5.3 and some of code will break because php settings is secure. About solution:
this is unbelievable – someone write these code
eval(base64_decode("aWYoJG5hbWUgPT0gIkVsZmV0IikkaHRtbG5hbWUgPSAiPGJpZz5FbGZldDwvYmlnPiI7"));which to do this thing
if($name == "Elfet")$htmlname = "<big>Elfet</big>";i replace eval with pure code and everything works!