海外のとあるオープンソースのphpコードに関する質問です。


海外のとあるオープンソースを使ってみているのですが、摩訶不思議なコードがあり、色々と手を尽くしてみたのですが、解読できません。理解できる方いらっしゃいますでしょうか?
chr関数やord関数などで文字コード変換を指定るっぽいのは分かるのですが。それ以上が解読できなくて。
よろしくお願いいたします。

コードが少し長いので以下のURLに掲載しております。
https://docs.google.com/document/d/1EUnsb4T1RtK55bvwpBl_llvOb3zzp5aYkXKZATO2uVk/edit

回答の条件
  • 1人5回まで
  • 登録:
  • 終了:2011/11/02 18:06:14

ベストアンサー

id:m-ohshita No.1

回答回数3ベストアンサー獲得回数1

この難読化されているコードを可読化した結果がこれです。

<?php
require 'include/databaseinfo.php';
$sql=mysql_connect($dbhost,$dbuser,$dbpass);
if(!$sql) {
    echo "<h1>Unable to Establish Connection to the Server</h1><hr noshade size=2 color=#000000>";
    exit();
}
$db_sel=mysql_select_db($dbname,$sql);
if(!$db_sel) {
    echo "<h1>Unable to Connect to the Database</h1><hr noshade size=2 color=#000000>";
    exit();
};
print('<body topmargin="0" leftmargin="0" rightmargin="0">');
$queryaa="select * from home_announcements where id=1";
$tabaa=mysql_query($queryaa);
if($rowaa=mysql_fetch_array($tabaa)) {
    $font_color=$rowaa['font_color'];
    $back_color=$rowaa['back_color'];
    $border_color=$rowaa['border_color'];
    $registrationaa=$rowaa['site_announcements'];
    if($registrationaa!=""){
	echo "<table border='0' cellpadding='0' cellspacing='0' style='border-bottom: 1px solid'; width='100%' bgcolor= height='30'>
  <tr>
    <td width='100%' height='20'>
    <p align='center'><font face='Verdana' size='2' color=></font></td>
  </tr>
</table>
";
    }
}
$lang_query="select * from language where auto=1";
$lang_result=mysql_query($lang_query);
$lang_row=mysql_fetch_array($lang_result);
$defaultlang =$lang_row['filename'];
$temid=$_SESSION['temid'];
$temp_query="select * from templates where template='yes'";
$temp_result=mysql_query($temp_query);
$temp_row=mysql_fetch_array($temp_result);
$tfold =$temp_row['folder'];
$logo =$temp_row['logo'];
require "language/$defaultlang";
require "language/emails/$defaultlang"; 
他1件のコメントを見る
id:m-ohshita

1."eval"を"echo"に置換してから実行し、出力結果と置換

2.文字エスケープ("\xxx")はechoしてみて出力結果と置換

これを繰り返し適用しただけです。

2011/11/02 17:01:20
id:tshohei

おおお!出来ました!ご教授ありがとうございます!文字エスケープが少し手間かかりましたが。

2011/11/02 18:06:06

この質問への反応(ブックマークコメント)

「あの人に答えてほしい」「この質問はあの人が答えられそう」というときに、回答リクエストを送ってみてましょう。

これ以上回答リクエストを送信することはできません。制限について

回答リクエストを送信したユーザーはいません