Forum Topic: Php: Languages (system) (basic)

(773 views • 4 replies)

This topic is 1 page long.

<< < > >>
None

Craige

Reply To Post Reply & Quote

Posted at: 8/11/06 08:01 PM

Craige LIGHT LEVEL 08

Sign-Up: 07/17/04

Posts: 3,070

Everyone note: in his sample index file, he should have used double quotes on the seccond include. It will not work without the double quotes (unless you change the code a little).

Other than that, Neill, it was a pretty decent tutorial. I would havd thought the topic to be self explanitory, but then for some people...

One thing though was your line spacing. I really think it should have been every line, though this did seem pretty on the eyes.


None

henke37

Reply To Post Reply & Quote

Posted at: 8/12/06 07:21 AM

henke37 NEUTRAL LEVEL 16

Sign-Up: 09/10/04

Posts: 2,627

A few thinngs:
1 It would be a lot better if you made it read the header specifieing what langs the client can use.
2 You better make sure nothing nasty slips into the $choice.
3 You shouldn't polute the variable space, use an array.

Move on to ActionScript 3! And please, drop the mysql PHP extension, it's so stale that it lacks features that is no longer considered new! Go mysqli or pdo instead.


None

elbekko

Reply To Post Reply & Quote

Posted at: 8/12/06 08:00 AM

elbekko EVIL LEVEL 16

Sign-Up: 07/23/04

Posts: 6,450

At 8/12/06 07:21 AM, henke37 wrote: 3 You shouldn't polute the variable space, use an array.

Indeed.
Just doing this:

<?php
include 'lang/'.$user['lang'].'/lang.php';
echo $site_lang['Hello'];
?>

And lang/*/lang.php could contain this:
<?php
$site_lang = array(
"hello" => "hi and welcome"
);
?>

And easily expandable... I'm using this system right now =)

"My software never has bugs. It just develops random features. " - Unknown

[ PHP: Main | Omigod, a blog ]

BBS Signature

None

henke37

Reply To Post Reply & Quote

Posted at: 8/13/06 07:21 AM

henke37 NEUTRAL LEVEL 16

Sign-Up: 09/10/04

Posts: 2,627

All major webbrowsers sends a request header specifying what langs the user wants the info in.
Ever seen a error message in your native lang from a foregin server? That is that header.
But your design allows the user to chose their lang, but the header is a good default.

About the dropdown, nothing stops a hacker from makeing their own form.

Move on to ActionScript 3! And please, drop the mysql PHP extension, it's so stale that it lacks features that is no longer considered new! Go mysqli or pdo instead.


None

henke37

Reply To Post Reply & Quote

Posted at: 8/13/06 05:23 PM

henke37 NEUTRAL LEVEL 16

Sign-Up: 09/10/04

Posts: 2,627

I think you are failing to see how serious it is if a hacker can pass a string to include.

Move on to ActionScript 3! And please, drop the mysql PHP extension, it's so stale that it lacks features that is no longer considered new! Go mysqli or pdo instead.


All times are Eastern Standard Time (GMT -5) | Current Time: 09:11 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!