Can anyone please help with some translation?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
breWtal
Forum Newbie
Posts: 8
Joined: Tue Jun 16, 2009 2:55 am

Can anyone please help with some translation?

Post by breWtal »

I have 2 php files i need translated to english, but havent been able to find a translator that can do it. The language seems to be russian, but i cant be 100% sure. If anyone could help, it would be greatly appreciated as im still learning.



1st File

<?

function db_connect()
{
$result = mysql_connect("localhost", "root", "pass"); // Õîñò, þçåð, ïàðîëü
if(!$result)
return false;
if(!mysql_select_db("sms")) // Èìÿ ÁÄ
return false;

return $result;
}

db_connect();

$alloweduses = 5; // Êîëè÷åñòâî ñîîáùåíèé, êîòîðûå ìîãóò îòïðàâèòü ïîëüçîâàòåëè çà îäèí äåíü (ïî IP àäðåñó)

// Çàãîëîâêè äëÿ ñîîáùåíèÿ -- íåêîòîðûì îíè íóæíû, à íåêîòîðûå èõ çàïðåùàþò.
$headerstouse = "MIME-Version: 1.0\r\n". //ïî æåëàíèþ
"Content-type: text/html; charset=windows-1251\r\n". //ïî æåëàíèþ
"From: \"".$from."\"\r\n". //îáÿçàòåëüíî
"To: \"Client\" <".$to.">\r\n".//îáÿçàòåëüíî
"Date: ".date("r")."\r\n".//ïî æåëàíèþ
"Subject: ".$subject."\r\n";//ïî æåëàíèþ
?>



2nd file

<?
session_start();
session_register('sessioncode');
?>

<?
include("config.php");
?>

<?
if (strtoupper($code) == substr(strtoupper(md5("Mytext".$sessioncode)), 0,6)) {
} else {
?>
CAPTCHA íåâåðíà!<br>
Êëèêíèòå <a href="sms.php">ñþäà</a> äëÿ âîçâðàòà.

<?
$day = date("mdy");
$ip = GetHostByName($REMOTE_ADDR);
$checkuses=mysql_num_rows(mysql_query("select * from users where ip='$ip' and day='$day'"));
if($checkuses >= $alloweduses) {
echo "Âàø ëèìèò èñ÷åðïàí.";
exit;
} else {
$query = "INSERT INTO users VALUES ('$ip','$number','$day')";
$result = mysql_query($query) or die("Íåâîçìîæíî äîáàâèòü IP àäðåññ");
}
?>

<?
$sql = "SELECT * FROM carriers WHERE id = '$carrier'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$email = $row["email"];
$to = $number . $email;
$headers = $headerstouse;
$message = $headeradvertisement.$message.$footeradvertisement;
mail ($to, $subject, $message, $headers);
?>

<? echo "Ñîîáùåíèå îòïðàâëåíî!<br><br>";
echo "Êîìó: ".$to."<br>";
echo "Îò êîãî: ".$from."<br>";
echo "Òåìà: ".$subject."<br>";
echo "Ñîîáùåíèå: ".$message."<br><br>";
echo "Çàãîëîâêè: ".$headers."<br><br>";
echo "Íàæìèòå <a href=\"".$_SERVER['HTTP_REFERER']."\">ñþäà</a>, ÷òîáû îòïðàâèòü ñîáùåíèå."?>

i understand this may be a lot of help, but i would be very thankful for any assistance anyone can give.
fannnn
Forum Newbie
Posts: 6
Joined: Tue Jun 16, 2009 10:55 am

Re: Can anyone please help with some translation?

Post by fannnn »

i dont think this is a language at all. its definetely not russian. russian looks like this: http://www.omniglot.com/writing/russian.htm
i think you have some encoding errors there, displaying wild characters...
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: Can anyone please help with some translation?

Post by Eric! »

That's not a language, it is an encoding problem. The basic function of the script is simple. Do you need help with that?
dml
Forum Contributor
Posts: 133
Joined: Sat Jan 26, 2008 2:20 pm

Re: Can anyone please help with some translation?

Post by dml »

What you seem to have there is a php file from a Russian programmer that's been encoded in cp1251. Whatever you've opened the file in is trying to read it as something like cp1252. The best thing to do is to get it into an encoding like utf8 as quickly as possible. There are various tools for doing conversions of that kind; the easiest thing might be to look at the encoding options of your text editor - if it's a decent one it should let you specify that the file is cp1251, at which point the Cyrillic letters will pop into place, and then you can tell the text editor to save as utf8.

If you're completely stuck, here's a rough conversion to Cyrillic, which you can feed into an online translator to get the gist. There doesn't seem to be much extra information in the Russian - the programmer has taken an English-language script from somewhere, translated the messages, and maybe added some comments to explain the English-language variable names. As Eric said, it's fairly obvious just from the code what's going on.

Code: Select all

 
<?php
/*
 * This is a script for doing the conversion.
 */ 
 
// 1. This string literal is utf8-encoded in my system. 
// It might be cp1252 or iso8859-1 in another system.
$one = file_get_contents("infile");
 
// 2. Convert them to cp1252, which is [probably] the encoding the script is being read as.
$two = iconv("utf8", "cp1252", $one);
 
// 3. Read this cp1252 as cp1251, reversing the mojibake
$three = iconv("cp1251", "utf8", $two);
 
echo $three, "\n";
 
 

Code: Select all

 
 
1st File
 
<?
 
function db_connect()
{
$result = mysql_connect("localhost", "root", "pass"); // ????, ????, ??????
if(!$result)
return false;
if(!mysql_select_db("sms")) // ??? ??
return false;
 
return $result;
}
 
db_connect();
 
$alloweduses = 5; // ?????????? ?????????, ??????? ????? ????????? ???????????? ?? ???? ???? (?? IP ??????)
 
// ????????? ??? ????????? -- ????????? ??? ?????, ? ????????? ?? ?????????.
$headerstouse = "MIME-Version: 1.0\r\n". //?? ???????
"Content-type: text/html; charset=windows-1251\r\n". //?? ???????
"From: \"".$from."\"\r\n". //???????????
"To: \"Client\" <".$to.">\r\n".//???????????
"Date: ".date("r")."\r\n".//?? ???????
"Subject: ".$subject."\r\n";//?? ???????
?>
 
 
 
2nd file
 
<?
session_start();
session_register('sessioncode');
?>
 
<?
include("config.php");
?>
 
<?
if (strtoupper($code) == substr(strtoupper(md5("Mytext".$sessioncode)), 0,6)) {
} else {
?>
CAPTCHA ???????!<br>
???????? <a href="sms.php">????</a> ??? ????????.
 
<?
$day = date("mdy");
$ip = GetHostByName($REMOTE_ADDR);
$checkuses=mysql_num_rows(mysql_query("select * from users where ip='$ip' and day='$day'"));
if($checkuses >= $alloweduses) {
echo "??? ????? ????????.";
exit;
} else {
$query = "INSERT INTO users VALUES ('$ip','$number','$day')";
$result = mysql_query($query) or die("?????????? ???????? IP ??????");
}
?>
 
<?
$sql = "SELECT * FROM carriers WHERE id = '$carrier'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$email = $row["email"];
$to = $number . $email;
$headers = $headerstouse;
$message = $headeradvertisement.$message.$footeradvertisement;
mail ($to, $subject, $message, $headers);
?>
 
<? echo "????????? ??????????!<br><br>";
echo "????: ".$to."<br>";
echo "?? ????: ".$from."<br>";
echo "????: ".$subject."<br>";
echo "?????????: ".$message."<br><br>";
echo "?????????: ".$headers."<br><br>";
echo "??????? <a href=\"".$_SERVER['HTTP_REFERER']."\">????</a>, ????? ????????? ????????."?>
 
 
 
breWtal
Forum Newbie
Posts: 8
Joined: Tue Jun 16, 2009 2:55 am

Re: Can anyone please help with some translation?

Post by breWtal »

to fannnn, eric! and dml, thankyou very much for ur help

eric, yes if u are able to help it would be appreciated

and dml thanx so much for ur advice about the text editor, im downloading one as i type this

thankyou so much
Post Reply