Fonction utf8_decode()
Résolu
minoula2006
-
minoula2006 -
minoula2006 -
Bonjour,
Bonjour,
je veut mettre dans mes pages php la fonction string utf8_decode ( string $data )
mais je ne sais pas comment l'intégrer je suis débutante aidez moi svp
c la page contact.php
c la page valid_contact.php
c la page contact_list.php (partie administrative)
Bonjour,
je veut mettre dans mes pages php la fonction string utf8_decode ( string $data )
mais je ne sais pas comment l'intégrer je suis débutante aidez moi svp
c la page contact.php
<?php header ('Content-Type: text/html; charset=utf-8'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="ar" dir="rtl"><!-- InstanceBegin template="/Templates/mod-arb.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>contact</title>
<script language="JavaScript" type="text/javascript">
function Verifsaisie()
{
if (document.Dataform.nom.value=='')
{alert('الرجاء أدخل اسمك !');
document.Dataform.nom.focus();
return false;
}
if (document.Dataform.prenom.value=='')
{alert('الرجاء أدخل اللقب !');
document.Dataform.prenom.focus();
return false;
}
if (document.Dataform.adresse.value=='')
{alert('الرجاء أدخل العنوان !');
document.Dataform.adresse.focus();
return false;
}
if (document.Dataform.tel.value=='')
{alert('الرجاء أدخل رقم الهاتف !');
document.Dataform.tel.focus();
return false;
}
if (document.Dataform.message.value=='')
{alert('الرجاء أدخل رسالتك !');
document.Dataform.message.focus();
return false;
}
if (document.Dataform.email.value!='') {
var usr = "([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";
var domain = "([a-zA-Z0-9][a-zA-Z0-9._-]*\\.)*[a-zA-Z0-9][a-zA-Z0-9._-]*\\.[a-zA-Z]{2,5}";
var regex = "^"+usr+"\@"+domain+"$";
var myrxp = new RegExp(regex);
var check = (myrxp.test(document.Dataform.email.value));
if (check!=true) {
alert('الرجاء إدخال بريد الكتروني صحيح !');
document.Dataform.email.focus();
document.Dataform.email.value=''
return false;
}
}
return true;
}
</script>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
body {
background-repeat: repeat;
background-image: url(../images-index/bg.gif);
}
-->
</style>
<script type="text/JavaScript">
<!--
function mmLoadMenus() {
if (window.mm_menu_0107084945_0) return;
window.mm_menu_0107084945_0 = new Menu("root",140,18,"Segoe UI",12,"#000000","#0000FF","#99CCFF","#FFFF99","right","middle",3,0,1000,-5,7,true,true,true,0,false,true);
mm_menu_0107084945_0.addMenuItem("المـوقـع الـجـغـرافــي","location='../ar/situation-geographique.html'");
mm_menu_0107084945_0.addMenuItem("الـمـديـنـة بـالأرقــام","location='../ar/chiffre.html'");
mm_menu_0107084945_0.addMenuItem("المـواقـع السيــاحية وغيرها","location='../ar/touristique.html'");
mm_menu_0107084945_0.addMenuItem("تــاريـخ المـديــنــة","location='../ar/historique.html'");
mm_menu_0107084945_0.hideOnMouseOut=true;
mm_menu_0107084945_0.bgColor='#FFFFFF';
mm_menu_0107084945_0.menuBorder=1;
mm_menu_0107084945_0.menuLiteBgColor='#FFFFFF';
mm_menu_0107084945_0.menuBorderBgColor='#FFFFFF';
window.mm_menu_0107085744_0 = new Menu("root",145,18,"Segoe UI",12,"#000000","#0000FF","#99CCFF","#FFFF99","right","middle",3,0,1000,-5,7,true,true,true,0,false,true);
mm_menu_0107085744_0.addMenuItem("تــاريــخ الإحـــداث","location='../ar/date_creation.html'");
mm_menu_0107085744_0.addMenuItem("الدوائــر الـبــلـديـة","location='../ar/arrondissements.html'");
mm_menu_0107085744_0.addMenuItem("المـجــلـس الـبـلـدي","location='../ar/conseil.html'");
mm_menu_0107085744_0.addMenuItem("المجلس البلـدي للأطـفـال","location='../ar/enfants.html'");
mm_menu_0107085744_0.addMenuItem("المصـالـح البـلـديــة","location='../ar/services.html'");
mm_menu_0107085744_0.hideOnMouseOut=true;
mm_menu_0107085744_0.bgColor='#FFFFFF';
mm_menu_0107085744_0.menuBorder=1;
mm_menu_0107085744_0.menuLiteBgColor='#FFFFFF';
mm_menu_0107085744_0.menuBorderBgColor='#FFFFFF';
window.mm_menu_0107090801_0 = new Menu("root",154,18,"Segoe UI",12,"#000000","#0000FF","#99CCFF","#FFFF99","right","middle",3,0,1000,-5,7,true,true,true,0,false,true);
mm_menu_0107090801_0.addMenuItem("الحـــالــة المـدنــيــة","location='../ar/relations.html'");
mm_menu_0107090801_0.addMenuItem("الـتـعـريــف بالامــضـاء","location='../ar/relations2.html'");
mm_menu_0107090801_0.addMenuItem("الـجـبـايــة الـمـحـلـيـة","location='../ar/relations3.html'");
mm_menu_0107090801_0.addMenuItem("رخـــصـة الــبـــنــاء","location='../ar/relations4.html'");
mm_menu_0107090801_0.addMenuItem("الإشـهاد بمطابقـة النسخ للاصـل","location='../ar/relations5.html'");
mm_menu_0107090801_0.addMenuItem("كراس شروط صلـوحيـة المحـل","location='../ar/relations6.html'");
mm_menu_0107090801_0.hideOnMouseOut=true;
mm_menu_0107090801_0.bgColor='#FFFFFF';
mm_menu_0107090801_0.menuBorder=1;
mm_menu_0107090801_0.menuLiteBgColor='#FFFFFF';
mm_menu_0107090801_0.menuBorderBgColor='#FFFFFF';
mm_menu_0107090801_0.writeMenus();
} // mmLoadMenus()
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<link href="../css/styles.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<script language="JavaScript" src="mm_menu.js"></script>
</head>
<body onload="MM_preloadImages('../fr/IMAGE/email1-1.gif','../fr/IMAGE/b2-over.gif','../fr/IMAGE/b4-over.gif','../fr/IMAGE/b5-over.gif','../fr/IMAGE/b3-over.gif','../fr/IMAGE/b1-over.gif','../fr/IMAGE/accueil1-1.gif','photos/images_mod-fr/b5-over.gif','photos/images_mod-fr/b3-over.gif','photos/images_mod-fr/accueil1-1.gif','photos/images_mod-fr/email1-1.gif','images/accueil1-1.gif','images/email1-1.gif','photos/imges_mod-ar/b2.gif','photos/imges_mod-ar/b3-over.gif','photos/imges_mod-ar/b1-over.gif')">
<script language="JavaScript1.2">mmLoadMenus();</script>
<table width="771" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="771" height="89" align="center">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" height="89" align="center" valign="top"><img src="../Templates/photos/imges_mod-ar/bn5.gif" width="154" height="89" /></td>
<td width="20%" align="center" valign="top"><img src="../Templates/photos/imges_mod-ar/bn4.gif" width="154" height="89" /></td>
<td width="20%" align="center" valign="top"><img src="../Templates/photos/imges_mod-ar/bn3.gif" width="154" height="89" /></td>
<td width="20%" align="center" valign="top"><img src="../Templates/photos/imges_mod-ar/bn2.gif" width="154" height="89" /></td>
<td width="20%" align="center" valign="top"><img src="../Templates/photos/imges_mod-ar/bn1.gif" width="155" height="89" /></td>
</tr>
</table> </td>
</tr>
<tr>
<td align="center">
<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><a href="../index.html"><img src="../Templates/photos/imges_mod-ar/accueil1.gif" name="pic" width="72" height="23" border="0" id="pic" /></a></td>
<td><a href="contact.php"><img src="../Templates/photos/imges_mod-ar/email1.gif" name="pic2" width="71" height="23" border="0" id="pic2" /></a></td>
<td><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('pic3','','../Templates/photos/imges_mod-ar/b1-over.gif',1)"><img src="../Templates/photos/imges_mod-ar/b1.gif" name="pic3" width="125" height="23" border="0" id="pic3" onmouseover="MM_showMenu(window.mm_menu_0107084945_0,0,23,null,'pic3')" onmouseout="MM_startTimeout();" /></a></td>
<td><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('pic4','','../Templates/photos/imges_mod-ar/b2-over.gif',1)"><img src="../Templates/photos/imges_mod-ar/b2.gif" name="pic4" width="125" height="23" border="0" id="pic4" onmouseover="MM_showMenu(window.mm_menu_0107085744_0,0,23,null,'pic4')" onmouseout="MM_startTimeout();" /></a></td>
<td><a href="realisations.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('pic5','','../Templates/photos/imges_mod-ar/b3-over.gif',1)"><img src="../Templates/photos/imges_mod-ar/b3.gif" name="pic5" width="125" height="23" border="0" id="pic5" /></a></td>
<td><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('pic6','','../Templates/photos/imges_mod-ar/b4-over.gif',1)"><img src="../Templates/photos/imges_mod-ar/b4.gif" name="pic6" width="125" height="23" border="0" id="pic6" onmouseover="MM_showMenu(window.mm_menu_0107090801_0,0,23,null,'pic6')" onmouseout="MM_startTimeout();" /></a></td>
<td><a href="cooperations.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('pic7','','../Templates/photos/imges_mod-ar/b5-over.gif',1)"><img src="../Templates/photos/imges_mod-ar/b5.gif" name="pic7" width="123" height="23" border="0" id="pic7" /></a></td>
</tr>
</table> </td>
</tr>
<tr>
<td height="1332" align="center" valign="top">
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="borduremodele-ar">
<tr>
<td width="20%" rowspan="2" align="left" valign="top" bgcolor="#FFFFFF" class="bordurebas-ar">
<table width="99%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" height="15" align="center" class="borduremodeb-ar"><p><a class="LienRouge-ar" href="../fr/accueil.html">نسخة فرنسية</a></p>
<p><a class="LienRouge-ar" href="../eng/underConstraction.html">نسخة الانجليزية</a></p></td>
</tr>
<tr>
<td class="borduremodfin"><br />
<table width="76%" align="center" class="contour-menu">
<tr><td>
<table width="76%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="124" align="right" valign="top" class="style-menu-arb"><a class="LienBleu-ar" href="accueil.html">صفحة الاستقبال</a></td>
</tr>
<tr>
<td><img src="../Templates/photos/imges_mod-ar/separateur-bl.GIF" width="110" height="3" /></td>
</tr>
<tr>
<td align="right" valign="top" class="style-menu-arb"><a class="LienBleu-ar" href="#">أنباء محلية</a></td>
</tr>
<tr>
<td><img src="../Templates/photos/imges_mod-ar/separateur-bl.GIF" width="110" height="3" /></td>
</tr>
<tr>
<td align="right" valign="top" class="style-menu-arb"><a class="LienBleu-ar" href="festivites.html">مهرجانات</a></td>
</tr>
<tr>
<td><img src="../Templates/photos/imges_mod-ar/separateur-bl.GIF" width="110" height="3" /></td>
</tr>
<tr>
<td align="right" valign="top" class="style-menu-arb"><a class="LienBleu-ar" href="prix.html">الجوائز</a></td>
</tr>
<tr>
<td><img src="../Templates/photos/imges_mod-ar/separateur-bl.GIF" width="110" height="3" /></td>
</tr>
<tr>
<td height="20" align="right" valign="top" class="style-menu-arb"><a class="LienBleu-ar" href="plan%20du%20site.html">خريطة الموقع</a></td>
</tr>
</table>
</td>
</tr>
</table> </td>
</tr>
<tr><td class="bordur-permis-batir"><div align ="center" class="Lien-permis"><a href="consult-permis.php">متابعة رخص البناء</a></div></td></tr>
<tr>
<td align="center" valign="top" class="borduremodfin"><br /><div align="center">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload2.macromedia.com/get/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="146" height="69">
<param name="movie" value="../IMAGE_commun/jeunesse2.swf" />
<param name="quality" value="high" />
<embed src="../IMAGE_commun/jeunesse2.swf" quality="high" pluginspage="https://get.adobe.com/flashplayer/" type="application/x-shockwave-flash" width="144" height="69"></embed>
</object>
<img src="../IMAGE_commun/jeunesse02.jpg" width="146" height="110" border="0" usemap="#Map" /></div></td>
</tr>
<tr>
<td align="center" valign="top" class="borduremodfin"><br />
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload2.macromedia.com/get/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="126" height="129">
<param name="movie" value="../photoSousse.swf" />
<param name="quality" value="high" />
<embed src="../photoSousse.swf" quality="high" pluginspage="https://get.adobe.com/flashplayer/" type="application/x-shockwave-flash" width="126" height="129"></embed>
</object> </td>
</tr>
<tr>
<td align="center" valign="top" class="borduremodfin"><br />
<img src="../Templates/photos/imges_mod-ar/perle1.gif" width="123" height="32" border="0" usemap="#Map5" href="../photoSousse.html" /> <br /></td>
</tr>
<tr>
<tr>
<td align="center" valign="top" class="borduremodfin"><br />
<img src="../Templates/photos/imges_mod-ar/logobawaba.gif" width="135" height="65" border="0" usemap="#Map2" /> <br /></td>
</tr>
<tr>
<td align="center" class="borduremodfin"><br /><img src="../Templates/photos/images_mod-fr/sicad.png" width="82" height="33" border="0" usemap="#Map3" /><br /></td>
</tr>
<tr><td align="center" valign="top" class="borduremodfin"><br />
<img src="../Templates/photos/imges_mod-ar/bab.gif" width="86" height="116" border="0" usemap="#Map4" /></td>
</tr>
<tr>
<td height="57" align="center" valign="top"><br />
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload2.macromedia.com/get/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="84" height="75">
<param name="movie" value="../meteo.swf" />
<param name="quality" value="high" />
<embed src="../meteo.swf" quality="high" pluginspage="https://get.adobe.com/flashplayer/" type="application/x-shockwave-flash" width="84" height="75"></embed>
</object></td>
</tr>
<tr>
<td height="58" align="center" valign="top" ><img src="IMAGE/meteo.png" width="60" height="24" border="0" usemap="#Map6" /> </td>
</tr>
</table> </td>
<td height="1225" colspan="2" align="center" valign="top" bgcolor="#FFFFFF" class="bordure-modif-ar">
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="50%" height="359" align="left" valign="top"><!-- InstanceBeginEditable name="EditRegion3" --><table width="50%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="middle"><br />
<img src="../IMAGE_commun/contact.gif" /></td>
</tr>
<tr>
<td> </td>
</tr>
<tr><td align="center" valign="middle">
<form action="validcontact.php" method="post" name="Dataform" id="Dataform">
<table width="100%" align="center" cellpadding="0" cellspacing="0" class="btn">
<tr>
<td><table align="center">
<tr>
<td width="20%">
<?php
if(@$_REQUEST['pResut'] == 1)
{
?>
<div align="center" style=" background-color:#d9f0f8; padding:20px; min-height:50px ">
<b>لقد تم إرسال رسالتك.<br />
<br />
</b><br />
</div>
<?php
}// fi if
elseif (@$_REQUEST['pResut'] == 2)
{
?>
<div align="center" style=" background-color:#d9f0f8; padding:5px; min-height:50px">
آسف. كانت لدينا مشكلة في إرسال البريد.<br />
<br />
الرجاء تحقق من بريدك الالكتروني وحاول مرة أخرى. </div>
<?php
}// fi if
else
{
?> </td>
</tr>
</table></td>
</tr>
<tr>
<td>
<table width="50%" align="center" cellspacing="0" bordercolor="#CCCCCC">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="34%">* الإسم :</td>
<td width="40%"><input name="nom" type="text" id="nom2" maxlength="50" /></td>
</tr>
<tr>
<td> * اللقب :</td>
<td><input name="prenom" type="text" id="prenom" maxlength="50" /></td>
</tr>
<tr>
<td> * العنوان :</td>
<td><input name="adresse" type="text" id="adresse" maxlength="255" /></td>
</tr>
<tr>
<td> * الهاتف :</td>
<td><input name="tel" type="text" id="tel" maxlength="50" /></td>
</tr>
<tr>
<td><div align="center">البريد الإلكتروني :</div></td>
<td><input name="email" type="text" id="email" maxlength="50" /></td>
</tr>
<tr>
<td colspan="3" align="center" valign="middle"><br />
<div align="center">* رسالتك </div></td>
</tr>
<tr>
<td colspan="3"><div align="center">
<textarea name="message" cols="50" rows="6" id="message"></textarea>
</div></td>
</tr>
</table>
<blockquote>
<p><br />
<center>
<input name="image" type="image" onclick="return Verifsaisie();" src="../ar/IMAGE/btenvoyer-ar.png" alt="Valider" />
</center>
<br />
(*) معلومة إجبارية </p>
</blockquote></td>
</tr>
</table>
</form>
</td>
</tr>
</table><?php } ?>
<!-- InstanceEndEditable --></td>
</tr>
</table></td>
</tr>
<tr>
<td width="61%" bgcolor="#CCCCCC" class="bordure-modif-ar" align="center"><div class="style-affiche"><a href="../festival.html"><img src="../Templates/photos/imges_mod-ar/festival.png" width="432" height="100" border="0" /></a></div>
</td>
<td width="19%" class="bordure-modif-ar1"><div align="center"><img src="../Templates/photos/imges_mod-ar/sponceur.JPG" width="146" height="130" /></div></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" valign="middle"><img src="../Templates/photos/imges_mod-ar/ban-sig-bleu1.png" width="763" height="64" /></td>
</tr>
</table>
<map name="Map2" id="Map2"><area shape="rect" coords="5,4,129,62" href="http://www.bawaba.gov.tn" />
</map>
<map name="Map3" id="Map3">
<area shape="rect" coords="5,1,76,33" href="http://www.sicad.gov.tn/Fr/Accueil_46_6" />
</map>
<map name="Map4" id="Map4"><area shape="rect" coords="-2,0,85,116" href="http://www.bab-el-web.com" />
</map>
<map name="Map5" id="Map5">
<area shape="rect" coords="-2,1,122,35" href="../Sousse.html" />
</map>
<map name="Map6" id="Map6"><area shape="rect" coords="0,4,63,25" href="https://www.tunisiemeteo.com/" />
</map>
<map name="Map" id="Map">
<area shape="rect" coords="2,0,145,112" href="http://www.pactejeunesse.tn/" />
</map></body>
<!-- InstanceEnd --></html><!-- #BeginEditable "(code aprs la balise HTML)" -->
<!-- #EndEditable -->
c la page valid_contact.php
<?php
header ('Content-Type: text/html; charset=utf-8');
require_once("../lib/util.php");
require_once("../lib/db_connect.inc.php");
$connexion=db_connexion();
mysql_query("SET NAMES 'utf8'");
@$nom = prepareChaine($_REQUEST['nom']);
@$prenom = prepareChaine($_REQUEST['prenom']);
@$email = prepareChaine($_REQUEST['email']);
@$adresse = prepareChaine($_REQUEST['adresse']);
@$tel = prepareChaine($_REQUEST['tel']);
@$message = prepareChaine($_REQUEST['message']);
$date_time_creation = prepareChaine(date('d/m/Y'));
//***********************************************/
//Enregistrement dans la base
$champs = "nom,prenom,adresse,tel,email,message";
$valeurs = "$nom,$prenom,$adresse,$tel,$email,$message";
//print "INSERT INTO pagecms ($champs) VALUES ($valeurs)"; die();
$resultat = mysql_query("INSERT INTO contact ($champs) VALUES ($valeurs)");
//***********************************************/
//envoi de mail
if(@$_REQUEST['nom'])
{
$nom = stripslashes($_REQUEST['nom']);
}
if(@$_REQUEST['prenom'])
{
$Prenom = stripslashes($_REQUEST['prenom']);
}
$mailbody = " Mail envoyer le ". $date_time_creation ."
<br>" . $prenom . " " . $nom . " a envoy le message suivant :<br><br> ";
if(@$_REQUEST['message'])
{
$message = retourchariot(stripslashes($_REQUEST['message']));
$mailbody .= "<strong> Message </strong>: $message <br>";
}
$subject = "Un message concernant le site" ;
// verifier en cas de mail
@$from = $_REQUEST['email'] ;
if($from)
$from = $from ;
else
$from = "test@test.com";
$mail = "municipalite.sousse@email.ati.tn";
// $mail = "HHHH@yahoo.fr";
if(sendMail($from, $mail, $subject, $mailbody )){
$Resultat=1;
} else {
$Resultat=2;
}
// mail("HHHH@gmail.com", "sujet", "corp message" ,"HHHH@yahoo.fr");
// redirection
header("location: contact.php?pResut=$Resultat");
?>
c la page contact_list.php (partie administrative)
<?php
header ('Content-Type: text/html; charset=utf-8');
require("../lib/db_connect.inc.php");
require("../lib/util.php");
$connexion=db_connexion();
mysql_query("set names utf8");
$resultat =mysql_query("SELECT * FROM contact ORDER BY id");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="Espace d'administration" />
<link rel="stylesheet" type="text/css" href="css/administration.css" />
<title>[Sousse] - Espace d'administration</title>
</head>
<body >
<div id="main">
<?php include('HautPage.php'); ?>
<h3 class="headerstyle" align="left"> Gestion des contacts</h3>
<p>
<form name="ListeNews" method="post" action="Sommaire.php">
<TABLE WIDTH="650" border="0" align="center" cellpadding="0" cellspacing="0">
<TR>
<TD ALIGN="LEFT" class="Titre16"><br>
<div class="TexteDroite"><a href="Contact_Details.php?Num=-1">Ajouter un
contact</a></div></TD>
</TR>
<TR>
<TD align="left" style=" xpadding:20px">
<?php $ligne = mysql_num_rows($resultat);
if ($ligne != 0) { ?>
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="Tab">
<thead id="thead">
<tr>
<td width="43%">Nom</td>
<td width="20%" align="center" valign="middle">Prénom</td>
<td width="29%" align="center" valign="middle">Adresse</td>
<td width="4%" align="center" valign="middle"> </td>
<td width="4%" align="center" valign="middle"></td>
</tr>
</thead>
<tbody>
<?php
$i = 0 ;
while ($Enreg=mysql_fetch_array($resultat)) {
if ($i % 2 == 0) $bgColor = "";
else $bgColor = "#CCCCCC";
$i++;
?>
<tr onmouseover=" this.bgColor='#ABABAB'" onmouseout="this.bgColor='<?php print $bgColor;?>';" bgcolor="<?php print $bgColor;?>">
<td valign=top><?php print $Enreg["nom"];?></td>
<td align="center" valign=middle><?php print $Enreg["prenom"]; ?></td>
<td align="center" valign=middle><?php print $Enreg["adresse"]; ?></td>
<td align=center valign="middle"><a href="Contact_Details.php?Num=<?php print $Enreg["id"];?>"><img src="img/voir.gif" border=0></a></td>
<td width=4% align=center valign="middle"><a href="Contact_Supprime.php?Num=<?php print $Enreg["id"];?>" onClick="return confirm('Voulez-vous supprimer ce contact ?')"><img src="img/supprimer.gif" border=0></a></td>
</tr><?php
}
?>
</tbody>
</table>
<?php } else { echo "
<b>Il n'y a aucun contact.</b> ";
}?>
</TD>
</TR>
</TABLE>
</form>
</p>
</div>
</body>
</html>
A voir également:
- Fonction utf8_decode()
- Fonction si et - Guide
- Fonction miroir - Guide
- Fonction moyenne excel - Guide
- Fonction remplacer sur word - Guide
- Fonction somme excel - Guide
12 réponses
Bonjour
Si tu es débutante, d'où te vient cette idée d'utiliser utf8_decode ? Et que veux-tu décoder avec ça ?
À la lecture de ton code, je pense que tu as besoin de html_entity_decode sur tous les "alert". Je te donne le premier en exemple :
devient
Si tu es débutante, d'où te vient cette idée d'utiliser utf8_decode ? Et que veux-tu décoder avec ça ?
À la lecture de ton code, je pense que tu as besoin de html_entity_decode sur tous les "alert". Je te donne le premier en exemple :
alert('الرجاء أدخل اسمك !');
devient
alert('<?php echo html_entity_decode('الرجاء أدخل اسمك !',ENT_NOQUOTES,'UTF-8') ?>');
ça y est, j'ai vu d'où tu sortais ton utf8-decode... Je n'avais pas fait le rapprochement avec ton post d'hier.
Mais la réponse que je t'ai faite ne concerne que les alert, tu as visiblement un autre problème. Dans quel page et dans quelle partie de la page as-tu de caractères bizarres ? Car a priori (mais le code est long et je n'ai pas vu tous les détails) ça semble correct
Mais la réponse que je t'ai faite ne concerne que les alert, tu as visiblement un autre problème. Dans quel page et dans quelle partie de la page as-tu de caractères bizarres ? Car a priori (mais le code est long et je n'ai pas vu tous les détails) ça semble correct
bonjour
j'ai une partie de mon site en arabe qui contient 2 page dynamyque contact.php et consultation_permis.php
quand j'insert des donnees dans la page contact .php pour tester ma page et que je consulte ma base phpmyadmin je trouves que les donnees sont: سشÙ
et dans la partie admin dans la page contact _liste.php l'affichage et comme ca éà ç
j'ai touuuuuuus mis le jeux de caractere dans la base et en utf8_general ci, tous les page en php et hteml contiennent le <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> et apres la connexion j'ai mis ceci mysql_query("set names utf8");
malgré ca aucune résultat :(
j'ai voulu essayer d'utiliser cette fonction utf8_decode()???
NB: الرجاء أدخل اسمك !');
normalement dans mes pages sont arabe je sé pkoi sont affiché dans ce forum comme ca ???
j'ai une partie de mon site en arabe qui contient 2 page dynamyque contact.php et consultation_permis.php
quand j'insert des donnees dans la page contact .php pour tester ma page et que je consulte ma base phpmyadmin je trouves que les donnees sont: سشÙ
et dans la partie admin dans la page contact _liste.php l'affichage et comme ca éà ç
j'ai touuuuuuus mis le jeux de caractere dans la base et en utf8_general ci, tous les page en php et hteml contiennent le <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> et apres la connexion j'ai mis ceci mysql_query("set names utf8");
malgré ca aucune résultat :(
j'ai voulu essayer d'utiliser cette fonction utf8_decode()???
NB: الرجاء أدخل اسمك !');
normalement dans mes pages sont arabe je sé pkoi sont affiché dans ce forum comme ca ???
Visiblement, tu as fait tout ce qu'il faut. Il y a peut-être un problème au niveau de la fonction prepareChaine (qui est sans doute dans util.php).
Je vais essayer chez moi voir ce que ça donne
Je vais essayer chez moi voir ce que ça donne
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
util.php
<?php
function sendMail($from, $to, $subject, $message)
{
$result = false;
$corps = "<html><head>
<style type='text/css'>
<!--
body { font-family: Verdana, Arial, Helvetica, sans-serif; text-decoration: none; font-size: 12px}
-->
</style>
</head><body>";
$corps .= $message;
$corps .= "</body></html>";
$entete="Content-type:text/html\nFrom:$from\r\nReply-To:$from";
// envoi du mail
$result = mail($to, $subject, $corps ,$from);
#print("<hr>util.inc>sendMail(FROM: $from, TO: $to, SUBJECT: $subject)");
#print("<br>Message : $message<br>");
if ($result != 1)
$result = -1;
return $result;
}
function prepareChaine($chaine)
{
if (strlen($chaine) <= 0 || $chaine=="NULL")
return "NULL";
else
//return "'".trim(htmlspecialchars($chaine,ENT_COMPAT ))."'";
return "'".addslashes(htmlentities($chaine))."'";
return "''";
}
function retourchariot($laChaine)
{
return str_replace(chr(10),"\n", $laChaine);
return str_replace(chr(13),"\n\r", $laChaine);
}
function Etat($lParam)
{
if ($lParam==1) {
return "<img src=img/encour.png BORDER=0 />";
}
elseif($lParam==2) {
return "<img src=img/accepte.gif BORDER=0 />";
}
elseif($lParam==3) {
return "<img src=img/refuse.png BORDER=0 />";
}
}
function EtatTexte($lParam)
{
if ($lParam==1) {
return "En cour";
}
elseif($lParam==2) {
return "Accept";
}
elseif($lParam==3) {
return "Refus";
}
}
function date2string($laDateSQL)
{
if ($laDateSQL == "")
return "";
list($year, $month, $day) = explode("-", $laDateSQL);
return "$day/$month/$year";
}
function string2date($laDate)
{
if ($laDate == "")
{
return "NULL";
}
else
{
@list($day, $month, $year) = explode("/", $laDate);
@$tab = explode("/", $laDate);
if (count($tab) == 3)
{
if ( !is_numeric($day) || !is_numeric($month) || !is_numeric($year) )
return "-1"; //date invalide (syntaxiquement)
else
{
if ( !checkdate($month, $day, $year) )
return FALSE; //date invalie (smantiquement)
$res = "'".$year."-".$month."-"."$day"."'"; // aaaa-mm-jj
return $res;
}
}
else
return "-1"; //date invalide (syntaxiquement)
}
}
?>
En effet, ta fonction prepareChaine dans util.php fait vraiment n'importe quoi...
Dans cette fonction, remplace
Avec ça chez moi, je vois maintenant des caractères arabes corrects avec phpmyadmin.
Mais il reste sans doute d'autres problèmes (comme celui sur les "alert" que j'avais signalé au début et qui est toujours vrai)
Dans cette fonction, remplace
return "'".addslashes(htmlentities($chaine))."'";par
//return "'".addslashes(htmlentities($chaine))."'"; return "'".mysql_real_escape_string($chaine))."'";
Avec ça chez moi, je vois maintenant des caractères arabes corrects avec phpmyadmin.
Mais il reste sans doute d'autres problèmes (comme celui sur les "alert" que j'avais signalé au début et qui est toujours vrai)
quand je remplace un message erreur apparait : Parse error: parse error in c:\program files\easyphp1-8\www\commune-sousse\lib\util.php on line 36
merciiiiiiiiiiiiiiiiiiiiiiiiiii
sayéééééééééé sé fééééééééé
merci beaucoup je noublirai jamais votre aide millllllle merci :)
sayéééééééééé sé fééééééééé
merci beaucoup je noublirai jamais votre aide millllllle merci :)