PageRenderTime 43ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/del.php

http://rapidleech36b.googlecode.com/
PHP | 179 lines | 148 code | 16 blank | 15 comment | 19 complexity | 4ecce5d56c5d8979a1e95db4e28ef443 MD5 | raw file
  1. <?php
  2. /*****************************************************
  3. * Rapidleech 36B Rv.8
  4. *
  5. * $Id: del.php - 06apr2010-Idx $
  6. *****************************************************/
  7. define('RAPIDLEECH', 'yes');
  8. require_once "./global.php";
  9. $msg = "Powered by OLC";
  10. $VERSION = '<small style="color:#239FD9"><b>[ <a href="http://ocean-leecher.net/forum/index.php" target="_blank">olc</a> :: <a href="javascript:;" title="room #14">ccpb</a> :: <a href="http://kaskus.us/" target="_blank">kaskus</a> ]</b></small>';
  11. function notexist() {
  12. global $msg, $VERSION, $RL_VER, $options, $L;
  13. echo "<html><head><title>:: ".$RL_VER." ::</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=".($charSet!="" ? $charSet : "utf-8")."\"><style type=\"text/css\"><!--@import url(\"".IMAGE_DIR."style_sujancok".$options["csstype"].".css\");--></style></head><body><br /><h1>".$RL_VER.": NoP</h1><center><b class='r'>".$L->say['_inexist']."</b><br /><br /><hr style='width:500;' />".$msg."<br />".$VERSION."</center></body></html>";
  14. exit ();
  15. }
  16. function deleteIt($fileName, $fileID, $list){
  17. @unlink ( $fileName );
  18. unset($list[$fileID]);
  19. updateListInFile ( $list );
  20. }
  21. //************************
  22. // MAIN ...
  23. //************************
  24. header("Content-type: text/html; charset=".($charSet!="" ? $charSet : "utf-8"));
  25. $wajax = false;
  26. if(isset($_GET['met'])) {
  27. if($_GET['met']=='ajax') $wajax = true;
  28. }
  29. if(!isset($_GET['d'])) {
  30. notexist();
  31. }else{
  32. $dkey = $_GET['d'];
  33. $ck_showall = (isset($_COOKIE["showAll"]) ? $_COOKIE["showAll"]:false);
  34. if(!preg_match('/^[a-zA-Z0-9]{20}-[0-9]{2}$/', $dkey, $match)){
  35. notexist();
  36. }else{
  37. $rotKey = stristr($dkey, "-");
  38. $rotKey = (int)substr($rotKey, 1, strlen($rotKey));
  39. $hashdel = explode(":", trim(base64_decode(rotN($_GET ['d'],-($rotKey)))));
  40. $fileDate = (int) $hashdel[0];
  41. $backupshow_all = $options["show_all"];
  42. $options["show_all"] = true;
  43. _create_list(true, false, 1);
  44. }
  45. if(!$list) {
  46. notexist();
  47. }else{
  48. $fileName = $list[$fileDate]["name"];
  49. // we load $list from show download mode
  50. unset($list);
  51. $options["show_all"] = $backupshow_all;
  52. _create_list(true, false, 2);
  53. }
  54. if(!file_exists($fileName) || strlen($fileName)==0) notexist();
  55. }
  56. if(!$wajax){
  57. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  58. <html xmlns="http://www.w3.org/1999/xhtml">
  59. <head>
  60. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charSet;?>" />
  61. <meta name="robots" content="noindex, nofollow" />
  62. <link type="text/css" href="<?php print ROOT_URL.IMAGE_DIR;?>style_sujancok<?php print $options["csstype"];?>.css?<?php echo rand(1,9999);?>" rel="stylesheet" media="screen" />
  63. <title>:: Rx08.ii<?php echo $rev_num;?> ::</title>
  64. <script type="text/javascript"> d = document;</script>
  65. </head>
  66. <body>
  67. <iframe src="about:blank" name="ifrmAct" id="ifrmAct" width="0" height="0" style="display:none;"></iframe>
  68. <div class="head_container" id="head_container"><center>
  69. <a href="javascript:;" class="tdheadolgo" title="Rapidleech"><span>Rapidleech36B</span></a>
  70. </center></div>
  71. <center>
  72. <?php
  73. if(!isset($_REQUEST['submit'])) {
  74. ?>
  75. <div id="del_container">
  76. <form name="frm_delete" action="<?php echo ROOT_URL.basename($PHP_SELF)."?d=".$_GET['d']; ?>" method="post">
  77. <input type="hidden" name="task" value="doDel" />
  78. <p><?php echo $L->say['_rsure'];?> <b class="b"><?php echo $L->say['_todelete'];?></b>: </p>
  79. <b class="g"><?php echo basename($fileName)?></b><div id="separator" style="height:10px;"></div>
  80. <input id="submiter" type="submit" name="submit" value="Delete" />
  81. <input id="jssubmiter" type="button" class="blueButton" name="submit" value="Delete" onclick="del();" />
  82. </form>
  83. </div>
  84. <script type="text/javascript">
  85. /* <![CDATA[ */
  86. thisdelfile = '<?php echo $PHP_SELF;?>';
  87. paramdel = '?d=<?php echo $_GET["d"];?>';
  88. lineid = '<?php echo (isset($_GET["lineid"])?$_GET["lineid"]:"");?>';
  89. cl = d.location.pathname;
  90. if(cl!=thisdelfile){
  91. tgt = 'submiter';
  92. d.getElementById('head_container').style.display='none';
  93. }else{
  94. tgt = 'jssubmiter';
  95. d.getElementById('ifrmAct').style.display='none';
  96. }
  97. d.getElementById(tgt).style.display='none';
  98. function del(){
  99. iframeUri = thisdelfile + paramdel + '&met=ajax&task=doDel&=submit=Delete';
  100. d.getElementById('ifrmAct').src = iframeUri;
  101. }
  102. function wipeLine(){
  103. d.getElementById('brs'+lineid).style.display = 'none';
  104. try{d.getElementById('chkfL-'+lineid).checked = false;}catch(e){}
  105. }
  106. function upd_parent(retxt){
  107. d.getElementById('del_container').innerHTML = retxt;
  108. setTimeout("wipeLine()", 1300);
  109. setTimeout("$.facebox.close()", 1000);
  110. }
  111. /* ]]> */
  112. </script>
  113. <?php
  114. }else{
  115. $task= (isset($_POST['task']) ? $_POST['task'] : "");
  116. if(($task='doDel')){
  117. if (file_exists($fileName) && strlen($fileName)>0) {
  118. deleteIt($fileName, $fileDate, $list);
  119. $fn = htmlspecialchars(basename($fileName));
  120. echo "<p><b class=\"g\">{$fn}</b><br /><span class=\"g\">{$L->say['_sucesdelete']}</span></p><p>{$L->say["_thx"]}</p>";
  121. ?>
  122. <p id="closebtn"></p>
  123. <script type="text/javascript">
  124. /* <![CDATA[ */
  125. function reloadparent(){
  126. window.opener.location.reload();
  127. window.close(self);
  128. }
  129. if(window.opener!=null){
  130. document.getElementById('closebtn').innerHTML="<button onclick='reloadparent();'>CloseZ</button>";
  131. }
  132. /* ]]> */
  133. </script>
  134. <?php
  135. }
  136. }
  137. }
  138. ?><br /><hr style='width:500px; border-top:1px solid #ACACAC;' />
  139. <div class="footer_container"> <?php echo $msg."<br />".$VERSION;?></div>
  140. </center>
  141. </body></html><?php
  142. } else { // with ajax, do delete then call the parent function, upd_parent()
  143. $task= (isset($_REQUEST['task']) ? $_REQUEST['task'] : "");
  144. if(($task='doDel')){
  145. if(file_exists($fileName) && strlen($fileName)>0) {
  146. deleteIt($fileName, $fileDate, $list);
  147. $fn = htmlspecialchars(basename($fileName));
  148. $ret = "<p><b class=\"g\">{$fn}</b><br /><span class=\"g\">{$L->say['_sucesdelete']}</span></p><p>{$L->say["_thx"]}</p>";
  149. ?>
  150. <html><body>
  151. <script type="text/javascript">
  152. /* <![CDATA[ */
  153. if(window.parent){
  154. retxt = '<?php echo $ret;?>';
  155. window.parent.upd_parent(retxt);
  156. }
  157. /* ]]> */
  158. </script>
  159. </body></html><?php
  160. }
  161. }
  162. }
  163. ?>