Jesse
Active Member
- Messages
- 1,360
- Reaction score
- 0
- Points
- 36
I need help. This code was working but suddenly stopped one day.
The website where script is being used ::
http://www.xtranslate.info/
Anyone knows how to fix this?
This is the contents of translate.php
The website where script is being used ::
http://www.xtranslate.info/
Anyone knows how to fix this?
This is the contents of translate.php
PHP:
<?php
function getstring($a,$b,$c){
$y = explode($b,$a);
$x = explode($c,$y[1]);
return $x[0];
}
// Check if form has been submitted
if($_REQUEST['txt']){
ini_set("max_execution_time", 0); // no time-outs!
ignore_user_abort(true); // Continue downloading even after user closes the browser.
$text = stripslashes($_REQUEST['txt']);
$lang1 = $_REQUEST['lang1'];
$lang2 = $_REQUEST['lang2'];
echo translate($text,$lang1,$lang2);
}
else { echo "<center>You can't access this file directly! redirecting to home page now.</center>";
?><meta http-equiv="REFRESH" content="3;url=index.php"><?
exit;}
function translate($text,$lang1,$lang2){
$query = "js=n&prev=_t&hl=en&ie=UTF-8&sl=$lang1&tl=$lang2&text=$text";
$ch=curl_init();
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_URL, "http://translate.google.com/translate_t?");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0");
curl_setopt($ch, CURLOPT_ENCODING , "UTF-8");
$output = curl_exec($ch);
// echo $output;
curl_close($ch);
if ($lang2=="ar" || $lang2=="iw") {
$body = getstring($output, "<table><tr><td valign=top>noun</td><td>", "</td></tr><tr><td><a");
if ($body==""){
$body = getstring($output, "<div id=result_box dir=\"rtl\">", "</div>");
}
$prefix="<br><br>";
$body=$prefix.$body;
return $body;
}
if ($lang2=="fr") {
$body = getstring($output, "<table><tr><td valign=top>noun</td><td>", "</td></tr><tr><td><a");
if ($body==""){
$body = getstring($output, "<div id=result_box dir=\"ltr\">", "</div>");
}
$prefix="<br><br>";
$body=$prefix.$body;
return str_replace("é", "é", $body); }
else {
$body = getstring($output, "<table><tr><td valign=top>noun</td><td>", "</td></tr><tr><td><a");
if ($body==""){
$body = getstring($output, "<div id=result_box dir=\"ltr\">", "</div>");
}
$prefix="<br><br>";
$body=$prefix.$body;
return str_replace("é", "é", $body); }
}
?>