summaryrefslogblamecommitdiff
path: root/blog/sbs_1/dblogreader.php
blob: d252c19f1b65baa5e36b1e99eeddc32e27feeec0 (plain) (tree)

























































































                                                                                                                                                                                                 
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="expires" content="Friday 24 October 1997 09:30 GMT">
<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Chrisoft::Development Blog</title>
	<link rel=stylesheet href='../common.css' type='text/css'>
	<link rel=stylesheet href='extras.css' type='text/css'>
	<script type="text/javascript" src="footnoter.js"></script>
	<script type="text/javascript" src="decryptor.js"></script>
	<script type="text/javascript">
function ol()
{
if( navigator.userAgent.match(/Android/i)
 || navigator.userAgent.match(/webOS/i)
 || navigator.userAgent.match(/iPhone/i)
 || navigator.userAgent.match(/iPad/i)
 || navigator.userAgent.match(/iPod/i)
 || navigator.userAgent.match(/BlackBerry/i)
 || navigator.userAgent.match(/Windows Phone/i)
 )
	document.getElementById("tab").style.width="96%";
	footnoter();
}
	</script>
</head>
<body onload="ol()">
	<table id="tab" border="0" style="width:70%;margin:auto;">
		<tr>
			<td class="CTitle" style="font-size:2em;">
				<a href="../">Chrisoft</a>::<a href="./dbloglist.php">Development Blog</a>
			</td>
		</tr>
		<tr>
			<td class="TText">
			<?php
				require_once("simple_html_dom.php");
				$path=sprintf("/var/www/html/blog/content/%s.txt",$_GET["p"]);
				$file=fopen($path,"r");
				if(!$file)
				{echo "Invalid parameter...";exit;}
				$str=fgets($file,4096);
				echo "<div style=\"text-align:center;font-size:1.7em\">".$str."</div><br>";
				$str=fgets($file,4096);
				echo "<div style=\"text-align:center;\">".$str."</div><br>";
				$str=fgets($file,4096);
				$str=fread($file,262144);
				$html=str_get_html($str);
				$encrypted=$html->find("encrypted");
				for($i=0;$i<count($encrypted);++$i)
				{
					$key=$html->find("encrypted",$i)->key;
					$html->find("encrypted",$i)->key=null;
					$cont=$html->find("encrypted",$i)->innertext;
					$html->find("encrypted",$i)->innertext="Encrypted content here. Click <a href=\"javascript:void(0)\" onclick=\"decryptui(".$i.")\">here</a> to decrypt.";
					$contarr=str_split($cont);
					$lcont=count($contarr);
					$keyarr=str_split($key);
					$lkey=count($keyarr);
					$hash=5381;
					for($j=0;$j<$lcont;++$j)
					{
						$hash=(($hash<<5)+$hash)+ord($contarr[$j]);
						$hash&=0xFFFFFFFF;
						$contarr[$j]^=$keyarr[$j%$lkey];
					}
					$retstr='';
					array_walk($contarr,function($value)use(&$retstr){$retstr.=chr(ord($value));});
					$html->find("encrypted",$i)->encont=base64_encode($retstr);
					$html->find("encrypted",$i)->hash=$hash;
					$html->find("encrypted",$i)->id="encrypted".$i;
				}
				echo $html;
				fclose($file);
			?>
			</td>
		</tr>
		<tr><td><hr><reduced id="notediv"></reduced></td></tr>
	</table>
	<div id="decryptui" style="display:none;opacity:0;color:white;z-index:10;position:fixed;left:0;top:0;width:100%;height:100%;background-color:rgba(0,0,0,0.4);transition:opacity 0.5s;">
		<div class="TText" style="padding:20px;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);background-color:rgba(0,0,0,0.6);">
			<span id="keyhint"></span><br><br>
			Key: <input id="keyinp" type="text"><br><br>
			<button id="btndecrypt" onclick="decryptor(decid,document.getElementById('keyinp').value);" style="position:absolute;left:20px;">Decrypt</button>
			<button onclick="hidedecryptui();">Cancel</button>
		</form>
	</div>
  </body>
</html>