I posting link here : project website http://www.stolarstvofatura.sk/
I got on the top ofindex page php tags
I checked the path and everything.. everything is okay i dont know where is problem
This is on index page -
<?php
include 'config.php';
?>
This is on config page which is on same dir like index
<?php
session_start();
if (!isset($_SESSION['lang'])) {
$_SESSION['lang'] = "sk";
} else if (isset($_GET['lang']) && $_SESSION['lang'] !=
$_GET['lang'] && !empty($_GET['lang']) ) {
if ($_GET['lang'] == "sk") {
$_SESSION['lang'] = "sk";
} else if($_GET['lang'] == "en") {
$_SESSION['lang'] = "en";
}
}
require_once "languages/" . $_SESSION['lang'] . ".php";
?>
I expected no errors
You can probably simplify the logic used to select the language and, so long as yu start the session at the beginning of each page ( as here ) then clicking "about us" or whatever should not affect the language chosen.
<?php
/* config.php */
session_start();
$qvar='lang';
$svar='language';
$default='sk';
$languages=array('en','sk','de'); # 3 language options
if( !isset( $_SESSION[ $svar ] ) )$_SESSION[ $svar ]=$default;
if( isset( $_GET[ $qvar ] ) && in_array( strtolower( $_GET[ $qvar ] ), $languages ) ) $_SESSION[ $svar ]=strtolower( $_GET[ $qvar ] );
$languagefile = sprintf( '%s/languages/%s.php', $_SERVER['DOCUMENT_ROOT'], $_SESSION[ $svar ] );
require realpath( $languagefile );
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.