if ($username == "" || $password == "") { session_start(); $username = isset($_SESSION['username']) ? $_SESSION['username'] : ""; $password = isset($_SESSION['password']) ? $_SESSION['password'] : ""; if ($username == "" || $password == "") { $username = isset($_COOKIE["StarDict_username"]) ? $_COOKIE["StarDict_username"] : ""; $password = isset($_COOKIE["StarDict_password"]) ? $_COOKIE["StarDict_password"] : ""; if ($username != "" && $password != "") { $_SESSION['username'] = $username; $_SESSION['password'] = $password; } } } $args; include_once 'arg.php'; if ($username != "" && $password != "") { $eusername = encode_command_arg($username); $epassword = encode_command_arg($password); $args = "-ar " . $eusername . " " . $epassword . " "; } else { $args = ""; } $equeryword = encode_command_arg($queryword); $args .= "-qs " . $equeryword; include_once 'backend.php'; echo call_stardict_client($args); if ($username == "" || $password == "") { echo "<br>You are guest user, try to <a href=\"http://www.stardict.org/register.php\" target=\"_blank\">Register</a> an account and choose your custom dictionaries."; } echo "</body></html>"; ob_end_flush();
<?php header("Content-type:text/html; charset=utf-8"); session_start(); $username = isset($_SESSION['username']) ? $_SESSION['username'] : ""; $password = isset($_SESSION['password']) ? $_SESSION['password'] : ""; if ($username != "" && $password != "") { $lang = isset($_REQUEST['l']) ? $_REQUEST['l'] : ""; $args; include_once 'arg.php'; $eusername = encode_command_arg($username); $epassword = encode_command_arg($password); $elang = encode_command_arg($lang); $args = "-ar " . $eusername . " " . $epassword . " -sl " . $elang; include_once 'backend.php'; $content = call_stardict_client($args); if ($content == "") { $_SESSION['language'] = $lang; setcookie("StarDict_language", $lang, time() + 60 * 60 * 24 * 30, '/'); } else { echo $content; } } else { echo "Error, didn't login!"; }