Pb creation site multilangue-pb de syntaxe

Fermé
Signaler
Messages postés
103
Date d'inscription
vendredi 19 septembre 2008
Statut
Membre
Dernière intervention
26 mars 2015
-
Bonjour,

je suis en train de passer mon site en multilangue et j'ai un pb
j'inclus donc mes variables dans le code php a la place du texte.

les variables sont du type {$site_lang['nom_de_variable']}
avec un include en début de fichier.

ca fonctionne bien jusqu'au fichier login, avec mon fichier login.php rien ne s'affiche, je pige pas bien pourquoi.

peut etre parceque j'ai mis la meme syntaxe dans les exeption if,je sais pas.

EXEMPLE ca marche sur mon fichier contact.php:

<?php

if(!defined('GEN2_PROCESS')) { exit(); }
session_start();
include("Includes/base_Inc.php");
$ref_title = "Contact Us";
if($_POST)
{
mysql_query("INSERT INTO support (username,email,date,ip,message) VALUES ('{$_POST['username']}','{$_POST['email']}',unix_timestamp(),'{$_POST['ip']}','{$_POST['message']}')") or die(mysql_error());
$contents .= "Votre ticket de support a été envoyé.<br>Your support ticket has been sent.";
}
$ip = getenv("REMOTE_ADDR");
$contents .= "
<div id='box9'>
<div id='lb'>
<div id='rb'>
<div id='bb'>
<div id='blc'>
<div id='brc'>
<div id='tb'>
<div id='tlc'>
<div id='trc'>
<div id='content'>
<table>
<tr>
<td><img src='themes/GeN3/images/support.png' align='center'></td>
<td><h3><font color='black'>{$site_lang['contact_us']}</font></h3></td>
</tr>
</table>
<br /><br />
<center>
<form method='post'>
<input type='hidden' name='ip' value='{$ip}'>
<table>";
if($loggedin) {
$contents .= "
<tr>
<td>{$site_lang['your_username']}:</td>
<td><input type='text' readonly name='username' size='35' value='{$ir['username']}' /></td>
</tr>
<tr>
<td>{$site_lang['your_email']}:</td>
<td><input type='text' readonly name='email' size='35' value='{$ir['email']}' /></td>
</tr>";
} else {
$contents .= "
<tr>
<td>{$site_lang['your_email']}:</td>
<td><input type='text' name='email' size='35' value='' /></td>
</tr>";
}
$contents .= "<tr>
<td colspan='2' align='center'>{$site_lang['your_message']}:</td>
</tr>
</table>
<textarea name='message' rows='10' cols='40'></textarea>
<br />
<input type='submit' value='{$site_lang['send_support_ticket']}' />
<br />
</form>
</center>
</font>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
";
?>

PAS DE SOUCIS par contre avec mon fichier login ca marche pas, voila le code:

<?php

if(!defined('GEN2_PROCESS')) { exit(); }
session_start();
include("Includes/base_Inc.php");
$ref_title = "Login";
if($set['recaptcha_enabled'])
{
require_once('modules/recaptcha/recaptchalib.php');
}
$tok_id = sha1(md5(session_id()));
if($loggedin)
{
$error = "You are already logged in.<br>Vous ètes déja connecté.";
$show_login=0;
} elseif($_POST)
{
$username = $do->filter($_POST['login_username']);
$password = $do->filter($_POST['login_password']);
$encoded_password = sha1($password);
if($set['recaptcha_enabled'])
{
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;

# was there a reCAPTCHA response?
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($set['recaptcha_privatekey'],
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);

if (!$resp->is_valid) {
$error=(!$error) ? "{$site_lang['invalid_captcha']}" : $error;
$show_login=1;
}
} else {
$error=(!$error) ? "{$site_lang['invalid_captcha']}" : $error;
$show_login=1;
}
}
if($set['pcaptcha']) {
if( strtolower($_POST['code'])!= strtolower($_SESSION['texto'])){
$error=(!$error) ? "{$site_lang['invalid_captcha']}" : $error;
$show_page = 1;
}
}
if($_POST['token'] != $tok_id)
{
$error=(!$error) ? "{$site_lang['session_expired']}" : $error;
$show_login=1;
}
if(!$username)
{
$error=(!$error) ? "{$site_lang['forgot_fill_user']}" : $error;
$show_login=1;
}
if(!$password)
{
$error=(!$error) ? "{$site_lang['forgot_fill_pass']}" : $error;
$show_login=1;
}


$exi = mysql_query("SELECT COUNT(*) AS cnt FROM users WHERE username='$username' AND password='$encoded_password' LIMIT 1;");
$exi = mysql_fetch_array($exi);
$exi = $exi['cnt'];
if(!$exi)
{
$error=(!$error) ? "{$site_lang['no_account_details']}" : $error;
$show_login=1;
}
if($set['pcaptcha']) {
if( strtolower($_POST['code'])!= strtolower($_SESSION['texto'])){
$error=(!$error) ? "{$site_lang['invalid_captcha']}" : $error;
$show_login=1;
}
}
$exi2 = mysql_query("SELECT COUNT(*) AS cnt FROM users WHERE username='$username' AND password='$encoded_password' AND suspended='0' LIMIT 1;");
$exi2 = mysql_fetch_array($exi2);
$exi2 = $exi2['cnt'];
if(!$exi2)
{
$error=(!$error) ? "{$site_lang['account_suspended']}" : $error;
$show_login=1;
}

if(!$error)
{

if($do->login_user($username,$encoded_password))
{
$contents = "
<div id='box9'>
<div id='lb'>
<div id='rb'>
<div id='bb'>
<div id='blc'>
<div id='brc'>
<div id='tb'>
<div id='tlc'>
<div id='trc'>
<div id='content'>
<h3>{$site_lang['thanks_logging']}</h3>
<p>{$site_lang['take_moments']}</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>";
$loc = ($_GET['return']) ? urldecode($_GET['return']) : "login.php";
$ip = $_SERVER['REMOTE_ADDR'];
$ip_number = sprintf("%u", ip2long($ip));
$country_query = "SELECT cntry,country FROM ip2country WHERE ip_from<=$ip_number AND ip_to>=$ip_number";
$country_exec = mysql_query($country_query);
$ccode_array=mysql_fetch_array($country_exec);
$country_code=$ccode_array['cntry'];
$country_name=$ccode_array['country'];
mysql_query("UPDATE users SET country='{$country_name}' WHERE username = '{$username}'");
$do->redirect($loc);
$show_login=0;
} else {
$error=(!$error) ? "{$site_lang['not_sign_you']}" : $error;
$show_login=1;
}

}

} else {
$show_login=1;
}
if(!$error && $_GET['return'] && !$_POST)
{
$error = "{$site_lang['need_logged']}";
}
if($error)
{
$contents .= "<div class='err'>$error</div>";
}
if($show_login)
{
if($set['recaptcha_enabled'])
{
$recaptcha = recaptcha_get_html($set['recaptcha_publickey'], $error);
}
$contents .= "
<div id='box2'>
<div id='lb'>
<div id='rb'>
<div id='bb'>
<div id='blc'>
<div id='brc'>
<div id='tb'>
<div id='tlc'>
<div id='trc'>
<div id='content'>
<table>
<tr>
<td><img src='themes/GeN3/images/login.png' align='center'></td>
<td><h3><font color='black'>{$site_lang['account_login']}</font></h3></td>
</tr>
</table>
<br /><br />
<form method='post'>
<input type='hidden' name='token' value='$tok_id'>
<table>
<tr>
<td>{$site_lang['username']}:</td>
<td><input type='text' name='login_username' id='l_username' value='{$username}'></td>
</tr>
<tr>
<td>{$site_lang['password']}:</td>
<td><input type='password' name='login_password' id='L_password' value=''></td>
</tr>";
if($set['pcaptcha']) {
$contents .= "
<tr>
<td>{$site_lang['security_code']}:</td>
<td><input type='text' size='3' maxlength='3' name='code' autocomplete='off' class='securitycode' value=''></td>
</tr>
<tr>
<td><img src='image.php?<?php echo $res; ?>' /></td>
</tr>
<tr>
<td>{$recaptcha}</td>
</tr>";
}
$contents .= "
<tr>
<td><br /><br /><input type='submit' value='Login'></td>
</tr>
</table>
</form>
<br />
<a href='reset.php'><b>{$site_lang['reset_password']}</b></a><br />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>";
}
?>


Est ce que vous avez une idée du soucis