473,241 Members | 1,555 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,241 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 3295
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: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.