Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php eval("?>".base64_decode("PD9waHANCmZ1bmN0aW9uIHdyaXRlX2RhdGEoJGRiLCRyb3V0ZWMpDQp7DQo..

Decoded Output download

?>b'<?php
function write_data($db,$routec)
{
        $billmonth = date(\'Y-m\');
        $serverName = "localhost";
        $userName = "root";
        $password = "nakuruwater@123";

        $dirroot = "/home/bhird/meterreading";
        mysql_connect($serverName, $userName, $password);
        mysql_select_db($db);

        #start
        {

        #get all route tables
        $sql = "SHOW TABLES FROM $db LIKE \'%$routec%\'";
        $result = mysql_query($sql);

        while ($row = mysql_fetch_row($result)) {

                $listtables[]=$row[0];
                }

        mysql_free_result($result);

         $random = substr(number_format(time() * rand(),0,\'\',\'\'),0,4);

         $route = $listtables[0];

         $routen = substr($route,9);
         $routen  = str_replace("_"," ",$routen);
         $routename= substr($routen, 0, strrpos($routen, " "));


         $sql = "select _CREATOR_URI_USER,_CREATION_DATE,_SUBMISSION_DATE,_MARKED_AS_COMPLETE_DATE FROM $route LIMIT 1";
         $result = mysql_query($sql);

          while ($row = mysql_fetch_row($result)) {
                  $newstring = str_replace("|", " ", $row[0]);$readertoken = explode(" ", $newstring);$reader = substr($readertoken[0],4);
                  $reader = str_replace("/"," ",$reader);


                echo "<br>";

                $time1 = $row[1];
                $time2 = $row[2];

                }


        #get readings and write them to file.
        #check if table is empty

        $rows = mysql_result(mysql_query("SELECT COUNT(*) FROM $route"), 0);
        if ($rows)
        {
        $readfile = "";
        foreach ($listtables as $table)
        {
               $result = mysql_query("SHOW COLUMNS FROM {$table}");
               if (mysql_num_rows($result) > 0)
               {
                        while ($row = mysql_fetch_assoc($result))
                        {
                                $column = $row[\'Field\'];
                                if (preg_match(\'/^ND_AC\d+/\', $column))
                                {
                                        $acc = str_replace("_", " ", $column);
                                        $account = explode(" ",$acc);
                                        $accounts = substr($account[1],2);

                                        #get readings
                                        $reading = mysql_query("SELECT $column FROM {$table}");
                                        while ($entry = mysql_fetch_row($reading))
                                        {
                                        $readings = $entry[0];
                                        }

                                        //check if reading is a meter reading or a code
                                        if(!preg_match(\'/[^0-9]+/\', $readings))
                                                {
                                                $readtype = "R";
                                                $read = $readings;
                                                }
                                        else   {
                                                $readtype=strtoupper($readings[0]);
                                                $read="0";
                                                }
                                        if(!$readings)
                                        {
                                                $readtype="M";
                                                $read="0";
                                        }
                                        //write file
                                        $readfile = $readfile.$random."|".$accounts."|".$read."|".$readtype."|".$billmonth."|".$routec."|".$routename."|".$reader."|".$time1."|".$time2."|
";





                                }



                        }
               }
               //clear table
        mysql_query("TRUNCATE TABLE {$table}");

        }
        //write data to server
        $formname = $routec."-".$billmonth.".txt";

        $success = file_put_contents("/home/nakuruwater/Desktop/zonesdata/$db/data/$formname", $readfile, LOCK_EX);
        chmod ("/home/nakuruwater/Desktop/zonesdata/$db/data/$formname", 0777);

        //ftp file data to server
        $ftp_server = \'192.168.0.16\';
	$ftp_user = \'nawassco\';
	$ftp_password = \'kibaki\';

	$conn_id = ftp_connect($ftp_server);
	$login_result = ftp_login($conn_id, $ftp_user, $ftp_password);

	$upload = ftp_put($conn_id,"/tmp/mobile1/$formname","/home/nakuruwater/Desktop/zonesdata/$db/data/$formname", FTP_BINARY);
	ftp_close($conn_id);
	if ($success )
        { echo "<br>";
          echo "Readings file name $formname ";}
        }        

}
      #end
}


function get_data()
{
$doc = 1000;
$zonesstring = "1,2,3,4,5";
$zonesarray = explode(",", $zonesstring);
$billmonth = date(\'Y-m\');

        foreach ($zonesarray as $zone)
        {
        #connect to accounts db
        $serverName = "localhost";
        $userName = "root";
        $password = "nakuruwater@123";

        //create connection and select database by given data
        mysql_connect($serverName, $userName, $password);
        mysql_select_db(\'accounts\');
        #initialise
        $routezone1[]="";
        $routezone2[]="";
        $routezone3[]="";
        $routezone4[]="";
        $routezone5[]="";

        #get all unique route codes.
        $result=mysql_query("select DISTINCT (routenumber) from accounts where zone = \'$zone\' ") or die(mysql_error());
        while($row_route= mysql_fetch_assoc($result))
        {
                if (($row_route[\'routenumber\']!="") && ($row_route[\'routenumber\']!=0))
	        {


	          if ($zone == 1) { $routezone1[] = $row_route[\'routenumber\'];}
                  if ($zone == 2) { $routezone2[] = $row_route[\'routenumber\'];}
                  if ($zone == 3) { $routezone3[] = $row_route[\'routenumber\'];}
                  if ($zone == 4) { $routezone4[] = $row_route[\'routenumber\'];}
                  if ($zone == 5) { $routezone5[] = $row_route[\'routenumber\'];}


                }
	}
        mysql_free_result($result);
	//mysql_close();
        }

	foreach ($routezone1 as $eachroute)
        {
		if (($eachroute !="") && (strlen($eachroute) == 4))  
		{              
		#get zone1 data
                #start
                #connect to database
                mysql_connect($serverName, $userName, $password);
                mysql_select_db(\'zone1\');

                $rows = mysql_result(mysql_query("SHOW TABLES FROM zone1 LIKE \'%$eachroute%\'"), 0);
                if ($rows)
                {
                #route exists

                        $row = mysql_result(mysql_query("SELECT COUNT(*) FROM $rows"), 0);
                        if ($row)
                                {
                                #get data
                                $db=\'zone1\';
                                $routec=$eachroute;
                                #call function data
                                write_data($db,$routec);
                                #end get data
                                } mysql_free_result($row);


                }mysql_free_result($rows);
                #finish
	}
        }

        foreach ($routezone2 as $eachroute)
        {
                if (($eachroute !="") && (strlen($eachroute) == 4))  
		{ 
		#get zone2 data
        	#start
                #connect to database
                mysql_connect($serverName, $userName, $password);
                mysql_select_db(\'zone2\');

                $rows = mysql_result(mysql_query("SHOW TABLES FROM zone2 LIKE \'%$eachroute%\'"), 0);
                if ($rows)
                {
                #route exists

                        $row = mysql_result(mysql_query("SELECT COUNT(*) FROM $rows"), 0);
                        if ($row)
                                {
                                #get data
                                $db=\'zone2\';
                                $routec=$eachroute;
                                #call function data
                                write_data($db,$routec);
                                #end get data
                                } mysql_free_result($row);


                }mysql_free_result($rows);
                #finish
		}
        }

        foreach ($routezone3 as $eachroute)
        {
		if (($eachroute !="") && (strlen($eachroute) == 4))  
		{                 
		#get zone3 data
        	#start
                #connect to database
                mysql_connect($serverName, $userName, $password);
                mysql_select_db(\'zone3\');

                $rows = mysql_result(mysql_query("SHOW TABLES FROM zone3 LIKE \'%$eachroute%\'"), 0);
                if ($rows)
                {
                #route exists

                        $row = mysql_result(mysql_query("SELECT COUNT(*) FROM $rows"), 0);
                        if ($row)
                                {
                                #get data
                                $db=\'zone3\';
                                $routec=$eachroute;
                                #call function data
                                write_data($db,$routec);
                                #end get data
                                } mysql_free_result($row);


                }mysql_free_result($rows);
                #finish
		}
        }

        foreach ($routezone4 as $eachroute)
        {
                if (($eachroute !="") && (strlen($eachroute) == 4))  
		{ 
		#get zone4 data
        	#start
                #connect to database
                mysql_connect($serverName, $userName, $password);
                mysql_select_db(\'zone4\');

                $rows = mysql_result(mysql_query("SHOW TABLES FROM zone4 LIKE \'%$eachroute%\'"), 0);
                if ($rows)
                {
                #route exists

                        $row = mysql_result(mysql_query("SELECT COUNT(*) FROM $rows"), 0);
                        if ($row)
                                {
                                #get data
                                $db=\'zone4\';
                                $routec=$eachroute;
                                #call function data
                                write_data($db,$routec);
                                #end get data
                                } mysql_free_result($row);


                }mysql_free_result($rows);
                #finish
		}
        }

        foreach ($routezone5 as $eachroute)
        {
                if (($eachroute !="") && (strlen($eachroute) == 4))  
		{ 
		#get zone5 data
        	#start
                #connect to database
                mysql_connect($serverName, $userName, $password);
                mysql_select_db(\'zone5\');

                $rows = mysql_result(mysql_query("SHOW TABLES FROM zone5 LIKE \'%$eachroute%\'"), 0);
                if ($rows)
                {
                #route exists

                        $row = mysql_result(mysql_query("SELECT COUNT(*) FROM $rows"), 0);
                        if ($row)
                                {
                                #get data
                                $db=\'zone5\';
                                $routec=$eachroute;
                                #call function data
                                write_data($db,$routec);
                                #end get data
                                } mysql_free_result($row);


                }mysql_free_result($rows);
                #finish
		}
        }
}

get_data();
?>'

Did this file decode correctly?

Original Code

<?php eval("?>".base64_decode("PD9waHANCmZ1bmN0aW9uIHdyaXRlX2RhdGEoJGRiLCRyb3V0ZWMpDQp7DQogICAgICAgICRiaWxsbW9udGggPSBkYXRlKCdZLW0nKTsNCiAgICAgICAgJHNlcnZlck5hbWUgPSAibG9jYWxob3N0IjsNCiAgICAgICAgJHVzZXJOYW1lID0gInJvb3QiOw0KICAgICAgICAkcGFzc3dvcmQgPSAibmFrdXJ1d2F0ZXJAMTIzIjsNCg0KICAgICAgICAkZGlycm9vdCA9ICIvaG9tZS9iaGlyZC9tZXRlcnJlYWRpbmciOw0KICAgICAgICBteXNxbF9jb25uZWN0KCRzZXJ2ZXJOYW1lLCAkdXNlck5hbWUsICRwYXNzd29yZCk7DQogICAgICAgIG15c3FsX3NlbGVjdF9kYigkZGIpOw0KDQogICAgICAgICNzdGFydA0KICAgICAgICB7DQoNCiAgICAgICAgI2dldCBhbGwgcm91dGUgdGFibGVzDQogICAgICAgICRzcWwgPSAiU0hPVyBUQUJMRVMgRlJPTSAkZGIgTElLRSAnJSRyb3V0ZWMlJyI7DQogICAgICAgICRyZXN1bHQgPSBteXNxbF9xdWVyeSgkc3FsKTsNCg0KICAgICAgICB3aGlsZSAoJHJvdyA9IG15c3FsX2ZldGNoX3JvdygkcmVzdWx0KSkgew0KDQogICAgICAgICAgICAgICAgJGxpc3R0YWJsZXNbXT0kcm93WzBdOw0KICAgICAgICAgICAgICAgIH0NCg0KICAgICAgICBteXNxbF9mcmVlX3Jlc3VsdCgkcmVzdWx0KTsNCg0KICAgICAgICAgJHJhbmRvbSA9IHN1YnN0cihudW1iZXJfZm9ybWF0KHRpbWUoKSAqIHJhbmQoKSwwLCcnLCcnKSwwLDQpOw0KDQogICAgICAgICAkcm91dGUgPSAkbGlzdHRhYmxlc1swXTsNCg0KICAgICAgICAgJHJvdXRlbiA9IHN1YnN0cigkcm91dGUsOSk7DQogICAgICAgICAkcm91dGVuICA9IHN0cl9yZXBsYWNlKCJfIiwiICIsJHJvdXRlbik7DQogICAgICAgICAkcm91dGVuYW1lPSBzdWJzdHIoJHJvdXRlbiwgMCwgc3RycnBvcygkcm91dGVuLCAiICIpKTsNCg0K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BteXNxbF9xdWVyeSgiU0hPVyBDT0xVTU5TIEZST00geyR0YWJsZX0iKTsNCiAgICAgICAgICAgICAgIGlmIChteXNxbF9udW1fcm93cygkcmVzdWx0KSA+IDApDQogICAgICAgICAgICAgICB7DQogICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoJHJvdyA9IG15c3FsX2ZldGNoX2Fzc29jKCRyZXN1bHQpKQ0KICAgICAgICAgICAgICAgICAgICAgICAgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkY29sdW1uID0gJHJvd1snRmllbGQnXTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHByZWdfbWF0Y2goJy9eTkRfQUNcZCsvJywgJGNvbHVtbikpDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkYWNjID0gc3RyX3JlcGxhY2UoIl8iLCAiICIsICRjb2x1bW4pOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRhY2NvdW50ID0gZXhwbG9kZSgiICIsJGFjYyk7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJGFjY291bnRzID0gc3Vic3RyKCRhY2NvdW50WzFdLDIpOw0KDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI2dldCByZWFkaW5ncw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRyZWFkaW5nID0gbXlzcWxfcXVlcnkoIlNFTEVDVCAkY29sdW1uIEZST00geyR0YWJsZX0iKTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoJGVudHJ5ID0gbXlzcWxfZmV0Y2hfcm93KCRyZWFkaW5nKSkNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHJlYWRpbmdzID0gJGVudHJ5WzBdOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vY2hlY2sgaWYgcmVhZGluZyBpcyBhIG1ldGVyIHJlYWRpbmcgb3IgYSBjb2RlDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoIXByZWdfbWF0Y2goJy9bXjAtOV0rLycsICRyZWFkaW5ncykpDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkcmVhZHR5cGUgPSAiUiI7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkcmVhZCA9ICRyZWFkaW5nczsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlICAgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHJlYWR0eXBlPXN0cnRvdXBwZXIoJHJlYWRpbmdzWzBdKTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRyZWFkPSIwIjsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZighJHJlYWRpbmdzKQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRyZWFkdHlwZT0iTSI7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkcmVhZD0iMCI7DQog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XZlbiBkYXRhDQogICAgICAgIG15c3FsX2Nvbm5lY3QoJHNlcnZlck5hbWUsICR1c2VyTmFtZSwgJHBhc3N3b3JkKTsNCiAgICAgICAgbXlzcWxfc2VsZWN0X2RiKCdhY2NvdW50cycpOw0KICAgICAgICAjaW5pdGlhbGlzZQ0KICAgICAgICAkcm91dGV6b25lMVtdPSIiOw0KICAgICAgICAkcm91dGV6b25lMltdPSIiOw0KICAgICAgICAkcm91dGV6b25lM1tdPSIiOw0KICAgICAgICAkcm91dGV6b25lNFtdPSIiOw0KICAgICAgICAkcm91dGV6b25lNVtdPSIiOw0KDQogICAgICAgICNnZXQgYWxsIHVuaXF1ZSByb3V0ZSBjb2Rlcy4NCiAgICAgICAgJHJlc3VsdD1teXNxbF9xdWVyeSgic2VsZWN0IERJU1RJTkNUIChyb3V0ZW51bWJlcikgZnJvbSBhY2NvdW50cyB3aGVyZSB6b25lID0gJyR6b25lJyAiKSBvciBkaWUobXlzcWxfZXJyb3IoKSk7DQogICAgICAgIHdoaWxlKCRyb3dfcm91dGU9IG15c3FsX2ZldGNoX2Fzc29jKCRyZXN1bHQpKQ0KICAgICAgICB7DQogICAgICAgICAgICAgICAgaWYgKCgkcm93X3JvdXRlWydyb3V0ZW51bWJlciddIT0iIikgJiYgKCRyb3dfcm91dGVbJ3JvdXRlbnVtYmVyJ10hPTApKQ0KCSAgICAgICAgew0KDQoNCgkgICAgICAgICAgaWYgKCR6b25lID09IDEpIHsgJHJvdXRlem9uZTFbXSA9ICRyb3dfcm91dGVbJ3JvdXRlbnVtYmVyJ107fQ0KICAgICAgICAgICAgICAgICAgaWYgKCR6b25lID09IDIpIHsgJHJvdXRlem9uZTJbXSA9ICRyb3dfcm91dGVbJ3JvdXRlbnVtYmVyJ107fQ0KICAgICAgICAgICAgICAgICAgaWYgKCR6b25lID09IDMpIHsgJHJvdXRlem9uZTNbXSA9ICRyb3dfcm91dGVbJ3JvdXRlbnVtYmVyJ107fQ0KICAgICAgICAgICAgICAgICAgaWYgKCR6b25lID09IDQpIHsgJHJvdXRlem9uZTRbXSA9ICRyb3dfcm91dGVbJ3JvdXRlbnVtYmVyJ107fQ0KICAgICAgICAgICAgICAgICAgaWYgKCR6b25lID09IDUpIHsgJHJvdXRlem9uZTVbXSA9ICRyb3dfcm91dGVbJ3JvdXRlbnVtYmVyJ107fQ0KDQoNCiAgICAgICAgICAgICAgICB9DQoJfQ0KICAgICAgICBteXNxbF9mcmVlX3Jlc3VsdCgkcmVzdWx0KTsNCgkvL215c3FsX2Nsb3NlKCk7DQogICAgICAgIH0NCg0KCWZvcmVhY2ggKCRyb3V0ZXpvbmUxIGFzICRlYWNocm91dGUpDQogICAgICAgIHsNCgkJaWYgKCgkZWFjaHJvdXRlICE9IiIpICYmIChzdHJsZW4oJGVhY2hyb3V0ZSkgPT0gNCkpICANCgkJeyAgICAgICAgICAgICAgDQoJCSNnZXQgem9uZTEgZGF0YQ0KICAgICAgICAgICAgICAgICNzdGFydA0KICAgICAgICAgICAgICAgICNjb25uZWN0IHRvIGRhdGFiYXNlDQogICAgICAgICAgICAgICAgbXlzcWxfY29ubmVjdCgkc2VydmVyTmFtZSwgJHVzZXJOYW1lLCAkcGFzc3dvcmQpOw0KICAgICAgICAgICAgICAgIG15c3FsX3NlbGVjdF9kYignem9uZTEnKTsNCg0KICAgICAgICAgICAgICAgICRyb3dzID0gbXlzcWxfcmVzdWx0KG15c3FsX3F1ZXJ5KCJTSE9XIFRBQkxFUyBGUk9NIHpvbmUxIExJS0UgJyUkZWFjaHJvdXRlJSciKSwgMCk7DQogICAgICAgICAgICAgICAgaWYgKCRyb3dzKQ0KICAgICAgICAgICAgICAgIHsNCiAgICAgICAgICAgICAgICAjcm91dGUgZXhpc3RzDQoNCiAgICAgICAgICAgICAgICAgICAgICAgICRyb3cgPSBteXNxbF9yZXN1bHQobXlzcWxfcXVlcnkoIlNFTEVDVCBDT1VOVCgqKSBGUk9NICRyb3dzIiksIDApOw0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRyb3cpDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI2dldCBkYXRhDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRkYj0nem9uZTEnOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkcm91dGVjPSRlYWNocm91dGU7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICNjYWxsIGZ1bmN0aW9uIGRhdGENCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGVfZGF0YSgkZGIsJHJvdXRlYyk7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICNlbmQgZ2V0IGRhdGENCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBteXNxbF9mcmVlX3Jlc3VsdCgkcm93KTsNCg0KDQogICAgICAgICAgICAgICAgfW15c3FsX2ZyZWVfcmVzdWx0KCRyb3dzKTsNCiAgICAgICAgICAgICAgICAjZmluaXNoDQoJfQ0KICAgICAgICB9DQoNCiAgICAgICAgZm9yZWFjaCAoJHJvdXRlem9uZTIgYXMgJGVhY2hyb3V0ZSkNCiAgICAgICAgew0KICAgICAgICAgICAgICAgIGlmICgoJGVhY2hyb3V0ZSAhPSIiKSAmJiAoc3RybGVuKCRlYWNocm91dGUpID09IDQpKSAgDQoJCXsgDQoJCSNnZXQgem9uZTIgZGF0YQ0KICAgICAgICAJI3N0YXJ0DQogICAgICAgICAgICAgICAgI2Nvbm5lY3QgdG8gZGF0YWJhc2UNCiAgICAgICAgICAgICAgICBteXNxbF9jb25uZWN0KCRzZXJ2ZXJOYW1lLCAkdXNlck5hbWUsICRwYXNzd29yZCk7DQogICAgICAgICAgICAgICAgbXlzcWxfc2VsZWN0X2RiKCd6b25lMicpOw0KDQogICAgICAgICAgICAgICAgJHJvd3MgPSBteXNxbF9yZXN1bHQobXlzcWxfcXVlcnkoIlNIT1cgVEFCTEVTIEZST00gem9uZTIgTElLRSAnJSRlYWNocm91dGUlJyIpLCAwKTsNCiAgICAgICAgICAgICAgICBpZiAoJHJvd3MpDQogICAgICAgICAgICAgICAgew0KICAgICAgICAgICAgICAgICNyb3V0ZSBleGlzdHMNCg0KICAgICAgICAgICAgICAgICAgICAgICAgJHJvdyA9IG15c3FsX3Jlc3VsdChteXNxbF9xdWVyeSgiU0VMRUNUIENPVU5UKCopIEZST00gJHJvd3MiKSwgMCk7DQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJHJvdykNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAjZ2V0IGRhdGENCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJGRiPSd6b25lMic7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRyb3V0ZWM9JGVhY2hyb3V0ZTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI2NhbGwgZnVuY3Rpb24gZGF0YQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0ZV9kYXRhKCRkYiwkcm91dGVjKTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI2VuZCBnZXQgZGF0YQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IG15c3FsX2ZyZWVfcmVzdWx0KCRyb3cpOw0KDQoNCiAgICAgICAgICAgICAgICB9bXlzcWxfZnJlZV9yZXN1bHQoJHJvd3MpOw0KICAgICAgICAgICAgICAgICNmaW5pc2gNCgkJfQ0KICAgICAgICB9DQoNCiAgICAgICAgZm9yZWFjaCAoJHJvdXRlem9uZTMgYXMgJGVhY2hyb3V0ZSkNCiAgICAgICAgew0KCQlpZiAoKCRlYWNocm91dGUgIT0iIikgJiYgKHN0cmxlbigkZWFjaHJvdXRlKSA9PSA0KSkgIA0KCQl7ICAgICAgICAgICAgICAgICANCgkJI2dldCB6b25lMyBkYXRhDQogICAgICAgIAkjc3RhcnQNCiAgICAgICAgICAgICAgICAjY29ubmVjdCB0byBkYXRhYmFzZQ0KICAgICAgICAgICAgICAgIG15c3FsX2Nvbm5lY3QoJHNlcnZlck5hbWUsICR1c2VyTmFtZSwgJHBhc3N3b3JkKTsNCiAgICAgICAgICAgICAgICBteXNxbF9zZWxlY3RfZGIoJ3pvbmUzJyk7DQoNCiAgICAgICAgICAgICAgICAkcm93cyA9IG15c3FsX3Jlc3VsdChteXNxbF9xdWVyeSgiU0hPVyBUQUJMRVMgRlJPTSB6b25lMyBMSUtFICclJGVhY2hyb3V0ZSUnIiksIDApOw0KICAgICAgICAgICAgICAgIGlmICgkcm93cykNCiAgICAgICAgICAgICAgICB7DQogICAgICAgICAgICAgICAgI3JvdXRlIGV4aXN0cw0KDQogICAgICAgICAgICAgICAgICAgICAgICAkcm93ID0gbXlzcWxfcmVzdWx0KG15c3FsX3F1ZXJ5KCJTRUxFQ1QgQ09VTlQoKikgRlJPTSAkcm93cyIpLCAwKTsNCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkcm93KQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICNnZXQgZGF0YQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkZGI9J3pvbmUzJzsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHJvdXRlYz0kZWFjaHJvdXRlOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAjY2FsbCBmdW5jdGlvbiBkYXRhDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlX2RhdGEoJGRiLCRyb3V0ZWMpOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAjZW5kIGdldCBkYXRhDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gbXlzcWxfZnJlZV9yZXN1bHQoJHJvdyk7DQoNCg0KICAgICAgICAgICAgICAgIH1teXNxbF9mcmVlX3Jlc3VsdCgkcm93cyk7DQogICAgICAgICAgICAgICAgI2ZpbmlzaA0KCQl9DQogICAgICAgIH0NCg0KICAgICAgICBmb3JlYWNoICgkcm91dGV6b25lNCBhcyAkZWFjaHJvdXRlKQ0KICAgICAgICB7DQogICAgICAgICAgICAgICAgaWYgKCgkZWFjaHJvdXRlICE9IiIpICYmIChzdHJsZW4oJGVhY2hyb3V0ZSkgPT0gNCkpICANCgkJeyANCgkJI2dldCB6b25lNCBkYXRhDQogICAgICAgIAkjc3RhcnQNCiAgICAgICAgICAgICAgICAjY29ubmVjdCB0byBkYXRhYmFzZQ0KICAgICAgICAgICAgICAgIG15c3FsX2Nvbm5lY3QoJHNlcnZlck5hbWUsICR1c2VyTmFtZSwgJHBhc3N3b3JkKTsNCiAgICAgICAgICAgICAgICBteXNxbF9zZWxlY3RfZGIoJ3pvbmU0Jyk7DQoNCiAgICAgICAgICAgICAgICAkcm93cyA9IG15c3FsX3Jlc3VsdChteXNxbF9xdWVyeSgiU0hPVyBUQUJMRVMgRlJPTSB6b25lNCBMSUtFICclJGVhY2hyb3V0ZSUnIiksIDApOw0KICAgICAgICAgICAgICAgIGlmICgkcm93cykNCiAgICAgICAgICAgICAgICB7DQogICAgICAgICAgICAgICAgI3JvdXRlIGV4aXN0cw0KDQogICAgICAgICAgICAgICAgICAgICAgICAkcm93ID0gbXlzcWxfcmVzdWx0KG15c3FsX3F1ZXJ5KCJTRUxFQ1QgQ09VTlQoKikgRlJPTSAkcm93cyIpLCAwKTsNCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkcm93KQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICNnZXQgZGF0YQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkZGI9J3pvbmU0JzsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHJvdXRlYz0kZWFjaHJvdXRlOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAjY2FsbCBmdW5jdGlvbiBkYXRhDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlX2RhdGEoJGRiLCRyb3V0ZWMpOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAjZW5kIGdldCBkYXRhDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gbXlzcWxfZnJlZV9yZXN1bHQoJHJvdyk7DQoNCg0KICAgICAgICAgICAgICAgIH1teXNxbF9mcmVlX3Jlc3VsdCgkcm93cyk7DQogICAgICAgICAgICAgICAgI2ZpbmlzaA0KCQl9DQogICAgICAgIH0NCg0KICAgICAgICBmb3JlYWNoICgkcm91dGV6b25lNSBhcyAkZWFjaHJvdXRlKQ0KICAgICAgICB7DQogICAgICAgICAgICAgICAgaWYgKCgkZWFjaHJvdXRlICE9IiIpICYmIChzdHJsZW4oJGVhY2hyb3V0ZSkgPT0gNCkpICANCgkJeyANCgkJI2dldCB6b25lNSBkYXRhDQogICAgICAgIAkjc3RhcnQNCiAgICAgICAgICAgICAgICAjY29ubmVjdCB0byBkYXRhYmFzZQ0KICAgICAgICAgICAgICAgIG15c3FsX2Nvbm5lY3QoJHNlcnZlck5hbWUsICR1c2VyTmFtZSwgJHBhc3N3b3JkKTsNCiAgICAgICAgICAgICAgICBteXNxbF9zZWxlY3RfZGIoJ3pvbmU1Jyk7DQoNCiAgICAgICAgICAgICAgICAkcm93cyA9IG15c3FsX3Jlc3VsdChteXNxbF9xdWVyeSgiU0hPVyBUQUJMRVMgRlJPTSB6b25lNSBMSUtFICclJGVhY2hyb3V0ZSUnIiksIDApOw0KICAgICAgICAgICAgICAgIGlmICgkcm93cykNCiAgICAgICAgICAgICAgICB7DQogICAgICAgICAgICAgICAgI3JvdXRlIGV4aXN0cw0KDQogICAgICAgICAgICAgICAgICAgICAgICAkcm93ID0gbXlzcWxfcmVzdWx0KG15c3FsX3F1ZXJ5KCJTRUxFQ1QgQ09VTlQoKikgRlJPTSAkcm93cyIpLCAwKTsNCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkcm93KQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICNnZXQgZGF0YQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkZGI9J3pvbmU1JzsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHJvdXRlYz0kZWFjaHJvdXRlOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAjY2FsbCBmdW5jdGlvbiBkYXRhDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlX2RhdGEoJGRiLCRyb3V0ZWMpOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAjZW5kIGdldCBkYXRhDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gbXlzcWxfZnJlZV9yZXN1bHQoJHJvdyk7DQoNCg0KICAgICAgICAgICAgICAgIH1teXNxbF9mcmVlX3Jlc3VsdCgkcm93cyk7DQogICAgICAgICAgICAgICAgI2ZpbmlzaA0KCQl9DQogICAgICAgIH0NCn0NCg0KZ2V0X2RhdGEoKTsNCj8+")); ?>

Function Calls

base64_decode 1

Variables

None

Stats

MD5 d71fbc203d5aeb1af22187fcf05b4fd6
Eval Count 1
Decode Time 113 ms