summaryrefslogtreecommitdiff
path: root/blog/sbs_1/dblogreader.php
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2019-02-10 11:16:07 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2019-02-10 11:16:07 +0800
commit9d3c8c0e6e1a7ba43bf3dc19350d1dca68b657a3 (patch)
tree339de0698c13e1763d3361d70fb1266621025c91 /blog/sbs_1/dblogreader.php
downloadweb-9d3c8c0e6e1a7ba43bf3dc19350d1dca68b657a3.tar.xz
Initial commit.
Diffstat (limited to 'blog/sbs_1/dblogreader.php')
-rw-r--r--blog/sbs_1/dblogreader.php90
1 files changed, 90 insertions, 0 deletions
diff --git a/blog/sbs_1/dblogreader.php b/blog/sbs_1/dblogreader.php
new file mode 100644
index 0000000..d252c19
--- /dev/null
+++ b/blog/sbs_1/dblogreader.php
@@ -0,0 +1,90 @@
+<!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>