PDA

View Full Version : مبتدی: پيش فرض مشکل جستجو نشدن کلمات فارسی



AliFs71
شنبه 01 آبان 1395, 16:46 عصر
با سلام دوستان عزیز من سورس دیکشنری PHP رو گرفتم که انگلیسی به فارسی هست و فقط انگلیسی به فارسی رو معنی میکنه و من میخوام این رو به دیکشنری فارسی به فارسی تبدیلش کنم. فایل txt که معانی و کلمات هست تغییر میدم کلمه و معنی فارسی میزارم اما کلمه فارسی رو تبدیل نمیکنه فقط انگلیسی به فارسی. کسی میتونه کمک کنه؟؟؟
اینم کد PHP:

<?
// {65_122 }-92_96
$word='';
if(!isset($_REQUEST['word'])){

//<form method="post" action="" ><input name=word value="'.$word .'"><input type=submit value=translate ><p>
echo '

<html>
<head>
<script type="text/javascript">
var xmlhttp

function loadXMLDoc(url)
{
xmlhttp=null
// code for Mozilla, etc.
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest()
}
// code for IE
else if (window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
}
if (xmlhttp!=null)
{
document.getElementById("T1").innerHTML=" <b>لطفا صبر کنید ...</b>"
xmlhttp.onreadystatechange=state_Change
xmlhttp.open("GET",url,true)
xmlhttp.send(null)
}
else
{
alert("Your browser does not support XMLHTTP.")
}
}

function state_Change()
{
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4)
{
// if "OK"
if (xmlhttp.status==200)
{
document.getElementById("T1").innerHTML=xmlhttp.re sponseText
}
else
{
// alert("Problem retrieving data:" + xmlhttp.statusText)
}
}
}

</script>







<input name="word" onkeyup="loadXMLDoc(\'?&word=\'+this.value)">


<div id="T1" style="border:1px solid black;height:40;width:300"></div><br />
</head>



</body>

</html>
';
}

if(isset($_REQUEST['word'])){
$word=$_REQUEST['word'];
if ($word==''){$word="1";}
if (
ord($word[0])>64 and
ord($word[0])<123 and
ord($word[0])!=92 and
ord($word[0])!=93 and
ord($word[0])!=94 and
ord($word[0])!=95 and
ord($word[0])!=96){
$data=implode('',file($word[0].'.txt'));
$se1=strpos($data,$word,1);
$se3=strpos($data,"\n",$se1+1);
$len=$se3-$se1;
if ($len<=0 or $se1<=0){
$word=substr($word,0,strlen($word)-1) ;
echo '<p>پیدا نشد.';



if (strpos($di1,"Did you mean:",1)){

$beh1= strpos($di1,"Did you mean:",1);
$beh2= strpos($di1,"<b><i>",$beh1)+6 ;
$beh3= strpos($di1,"</i></b>",$beh2);
$beh3=$beh3-$beh2;
$d12= $beh2;
echo '<br>Did you mean: <font color=blue><b><a style="CURSOR: hand" onclick="word.value=\''.substr($di1,$d12,$beh3).'\ ';loadXMLDoc(\'?&word=\'+\''.substr($di1,$d12,$beh 3).'\')" >'.substr($di1,$d12,$beh3)."</a>" ;
}





}else{

$bace_data= substr($data,$se1,$len);

$bace_data= str_replace('|',
': <font color=#00c100 size=5>',
$bace_data) ;


$part1=substr($bace_data,strlen($word));
echo '<b>'.$word.'</b>'.$part1;

//echo $bace_data;
}
}else{
echo '!';
}
}


?>

AliFs71
سه شنبه 04 آبان 1395, 19:33 عصر
هیچ کس جواب نداره؟؟؟؟؟؟؟؟؟///