473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Change language works after refresh

My multilanguage website still doesn't work.... really it works after a
refresh:
when I first start the browser, I get the following error:

Warning: main(lang..inc.php) [function.main]: failed to open stream: No
such file or directory in C:\wampp2\htdocs\set_language.php on line 6

Fatal error: main() [function.require]: Failed opening required
'lang..inc.php' (include_path='\wampp2\php\pear\') in
C:\wampp2\htdocs\set_language.php on line 6

then I make refresh and it works good. Here's my code:

main.php
<?
session_start();
define("DEFAULT_LANGUAGE", 'ge');
if (!isset($_SESSION['lang'])) {
$_SESSION['lang'] = DEFAULT_LANGUAGE;
}
include("set_language.php");
?>
set_language.php
<?php
if (isset($_GET['lang']))
{
$lang = $_GET['lang'];
}
require_once("lang.{$lang}.inc.php"); That's Line 6!!!
?>
<td align="left" width="50"><a href="?lang=ge"><? echo "DEUTSCH"
?></a></td>
<td align="left" width="50"><a href="?lang=en"><? echo "ENGLISH"
?></a></td>
<td align="left" width="50"><a href="?lang=sp"><? echo "ESPAÑOL"
?></a></td>

Any help will be welcomed.

Jul 17 '05 #1
1 3301
be*****@coaster.ch wrote:
main.php
<?
session_start();
define("DEFAULT_LANGUAGE", 'ge');
if (!isset($_SESSION['lang'])) {
$_SESSION['lang'] = DEFAULT_LANGUAGE;
}
include("set_language.php");


session_start();
define("DEFAULT_LANGUAGE", 'ge');

if (isset($_GET['lang'])) {
$_SESSION['lang'] = $_GET['lang'];
} else if (!isset($_SESSION['lang'])) {
$_SESSION['lang'] = DEFAULT_LANGUAGE;
}

$lang = $_SESSION['lang'];
include("set_language.php");

And in set_language.php, to prevent it is called seperately:

if (basename($_SERVER['PHP_SELF']) != 'main.php')) {
header("Location: http://{$_SERVER['HTTP_HOST']}/main.php");
exit;
}
JW

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Knud | last post by:
I have a frameset where a hidden frame reloads every 5 seconds and collects data from the sever if there are any changes made in a database. The hidden page updates Div fields on other frames with...
2
by: Galina | last post by:
Hello I have an application in MS Access 2000. I have a form, which includes a subform. The subform is based on a table, but locked for any editing. There is Edit button. When clicked, it starts a...
0
by: sastwhc | last post by:
sastwhc wrote: > *Hi all > I try change language client side programatically.In my case farsi a > Right to Left Language,the curser direction changed by dir=rtl TAG > changed to correct direction...
4
by: Tedmond | last post by:
Dear all, My application allows users to switch languages at run time. I use the following code to change the UI Culture but all controls are remaining unchanged. ...
3
by: R.A.F. | last post by:
Hi, I have a custom control in which i have a property based on CollectionBase class. like the following one : //------- XGrid.cs file --------------// public ColumnsCollection Columns {
7
by: Fabio Mastria | last post by:
Looks like a joke... : As I say in the subject... I create a javascript file, with this function: function IndexChanged(source){ alert("Hallo");
7
AccessIdiot
by: AccessIdiot | last post by:
This is driving me nuts. I have an unbound textbox (txt_SumSize) in my subform that holds the total of a field (Debitage_Size_Quantity)seen in datasheet view (control source =Sum(). I have an...
2
by: malcster2 | last post by:
hello, i am a beginner to ajax. i have created a mysql database, which i would like to access from a web page. i have created 3 files, a html to display the data, a php file to extract the data,...
8
by: ziycon | last post by:
I have a select option with two languages english and irish, and when the user selects one i use the onchange function to change the session language variable to the new language but the new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.