<?php
// fileinfotable.php
// Create table of information about filespec or differences with files of filespec or report about dead links or zip files or find/replace strings in files or tags within tags or HTML/XML to text or Create Slideshows
// RJM Programming
// October, 2014
// btoa( unescape (
//if (isset($_FILES['files'])) {
// file_put_contents("here.here", print_r($_FILES['files'],true));
// echo "<!DOCTYPE html><html><body><p>" . print_r($_FILES['files'],true) . "</p></body></html>";
// exit;
//}
$twt = " <a href='#' onclick='document.getElementById(\"itwt\").style.display=\"block\";'>Tags Within Tags</a> <br><iframe id='itwt' src='http://www.rjmprogramming.com.au/PHP/tags_within.php' style='width:100%;height:800px;display:none;'></iframe>";
$htt = " <a href='#' onclick='document.getElementById(\"ihtt\").style.display=\"block\";'>HTML/XML to Text</a> <br><iframe id='ihtt' src='http://www.rjmprogramming.com.au/PHP/flatten_ml.php' style='width:100%;height:800px;display:none;'></iframe>";
$sst = " <a href='#' onclick='document.getElementById(\"isst\").style.display=\"block\";'>Create Slideshow</a> <br><iframe id='isst' src='http://www.rjmprogramming.com.au/PHP/slideshow_creator.php' style='width:100%;height:800px;display:none;'></iframe>";
$fwto = "";
if (isset($_POST['findto'])) {
$fwto = urldecode($_POST['findto']);
} else if (isset($_GET['findto'])) {
$fwto = urldecode($_GET['findto']);
}
$fwis = "";
if (isset($_POST['findwhat'])) {
$fwis = urldecode($_POST['findwhat']);
} else if (isset($_GET['findwhat'])) {
$fwis = urldecode($_GET['findwhat']);
} else if (isset($_POST['find'])) {
$fwis = urldecode($_POST['find']);
} else if (isset($_GET['find'])) {
$fwis = urldecode($_GET['find']);
} else if (isset($_POST['findprompt'])) {
$fwis = urldecode($_POST['findprompt']);
} else if (isset($_GET['findprompt'])) {
$fwis = urldecode($_GET['findprompt']);
}
$sword = 'Submit';
$fmh = ' omyh1=document.getElementById("myh1"); if (urlsuf != "" && omyh1.innerHTML.indexOf(" Please wait ") == -1) { omyh1.innerHTML = omyh1.innerHTML + " ... Please wait while we analyze your URLs ... "; } ';
$fsev = ' document.getElementById("files").addEventListener("change", handleFileSelect, false); ';
$iscalled = "";
$mode = "Read bytes";
$title = "<a target=_blank href=./fileinfotable.php?zipfile= title=Zipfile>File</a> Information Table";
$rtitle = "File Functionality";
$snapshot = "";
$myfe = "myf=";
$flh = "";
$omyh1stuff = "";
$fnameis = "";
$lnameis = "";
$pnameis = "";
$undefined = " ";
$urlsuffix = "";
$urllist = "";
$statuslist = "";
$linelist = "";
$collist = "";
$askwhentwo = "";
$outrepis = "";
$zipcnt = 0;
if (isset($_GET['myf'])) {
$huhis = explode("strong>", $_GET['myf']);
if (sizeof($huhis) >= 3) $undefined = str_replace("</", " ", " " . $huhis[1]);
} else if (isset($_POST['myf'])) {
if ($_POST['myf'] != "") $undefined = " " . $_POST['myf'] . " ";
}
if (isset($_GET['deadlinks'])) {
$urlsuffix = "?deadlinks=" . urlencode(urldecode($_GET['deadlinks']));
$omyh1stuff = " mh(); "; //" omyh1=document.getElementById('myh1'); if (omyh1.innerHTML.indexOf(' Please wait ') == -1) { omyh1.innerHTML = omyh1.innerHTML + ' ... Please wait while we analyze your URLs ... '; } ";
$title = "Dead Links via File of Absolute URLs Report";
$deadlinks = "y";
$myfe = "deadlinks=Report%20list%20of%20dead%20links%20of%20file%20of%20URLs&myf=";
if ($_GET['deadlinks'] == "") {
$mode = "Report list of dead links of file of Absolute URLs";
} else {
$mode = urldecode($_GET['deadlinks']);
}
} else if (isset($_POST['deadlinks'])) {
$urlsuffix = "?deadlinks=" . urlencode(urldecode($_POST['deadlinks']));
$omyh1stuff = " mh(); "; //" omyh1=document.getElementById('myh1'); if (omyh1.innerHTML.indexOf(' Please wait ') == -1) { omyh1.innerHTML = omyh1.innerHTML + ' ... Please wait while we analyze your URLs ... '; } ";
$title = "Dead Links via File of Absolute URLs Report";
$deadlinks = "y";
$myfe = "deadlinks=Report%20list%20of%20dead%20links%20of%20file%20of%20URLs&myf=";
if ($_POST['deadlinks'] == "") {
$mode = "Report list of dead links of file of Absolute URLs";
} else {
$mode = urldecode($_POST['deadlinks']);
}
} else if (isset($_GET['differences'])) {
$askwhentwo = " "; //if (bigj == 1) { alert(881); document.getElementById(\"f1name\").value = ininf; } else if (bigj == 2) { alert(888); document.getElementById(\"f2name\").value = ininf; document.getElementById(\"ddiff\").style.display=\"block\"; document.getElementById(\"btwo\").click(); } ";
$urlsuffix = "?differences=" . urlencode(urldecode($_GET['differences']));
$omyh1stuff = " mh(); "; //" omyh1=document.getElementById('myh1'); if (omyh1.innerHTML.indexOf(' Please wait ') == -1) { omyh1.innerHTML = omyh1.innerHTML + ' ... Please wait while we analyze your URLs ... '; } ";
$title = "<a target=_blank href=./fileinfotable.php?zipfile= title=Zipfile>File</a> <a target=_blank href=./fileinfotable.php title=Information>Differences</a> Table";
$deadlinks = "n";
$myfe = "differences=Report%20list%20of%20file%20differences%20of%20file%20list&myf=";
if ($_GET['differences'] == "") {
$mode = "Report list of file differences of file list";
} else {
$mode = urldecode($_GET['differences']);
}
$outrepis = diffask();
} else if (isset($_POST['differences'])) {
$askwhentwo = " "; //if (bigj == 1) { alert(882); document.getElementById(\"f1name\").value = ininf; } else if (bigj == 2) { alert(887); document.getElementById(\"f2name\").value = ininf; document.getElementById(\"ddiff\").style.display=\"block\"; document.getElementById(\"btwo\").click(); } ";
$urlsuffix = "?deadlinks=" . urlencode(urldecode($_POST['differences']));
$omyh1stuff = " mh(); "; //" omyh1=document.getElementById('myh1'); if (omyh1.innerHTML.indexOf(' Please wait ') == -1) { omyh1.innerHTML = omyh1.innerHTML + ' ... Please wait while we analyze your URLs ... '; } ";
$title = "<a target=_blank href=./fileinfotable.php?zipfile= title=Zipfile>File</a> <a target=_blank href=./fileinfotable.php title=Information>Differences</a> Table";
$deadlinks = "n";
$myfe = "differences=Report%20list%20of%20file%20differences%20of%20file%20list&myf=";
if ($_POST['differences'] == "") {
$mode = "Report list of file differences of file list";
} else {
$mode = urldecode($_POST['differences']);
}
$outrepis = diffask();
} else if (isset($_GET['zipfile'])) {
if (isset($_GET['fnum'])) {
$zipf = zipfile();
if ($zipf != "") {
if (file_exists($zipf)) {
$zipfs = explode("/", $zipf);
$myext = $zipfs[sizeof($zipfs) - 1];
$mydir = str_replace("/" . $myext, "/", $zipf);
echo "<!DOCTYPE html><html><body onload=' parent.document.getElementById(\"xsubmit\").value = \"Download\"; parent.document.getElementById(\"ext\").value = \"" . $myext . "\"; parent.document.getElementById(\"dir\").value = \"" . $mydir . "\"; '></body></html>";
}
}
if ($_GET['fnum'] != 0) exit;
} else if (isset($_POST['dir']) && isset($_POST['ext'])) {
if (strpos($_POST['dir'], "/tmp/zips/") !== false) {
header('Content-Type: application/zip');
header('Content-Disposition: inline; filename=' . $_POST['ext']) ;
//header("Content-Length: ". filesize($_POST['dir'] . $_POST['ext']));
echo file_get_contents($_POST['dir'] . $_POST['ext']);
}
}
$sword = 'Zip';
$askwhentwo = " "; //if (bigj == 1) { alert(881); document.getElementById(\"f1name\").value = ininf; } else if (bigj == 2) { alert(888); document.getElementById(\"f2name\").value = ininf; document.getElementById(\"ddiff\").style.display=\"block\"; document.getElementById(\"btwo\").click(); } ";
$urlsuffix = "?zipfile=" . urlencode(urldecode($_GET['zipfile']));
$omyh1stuff = " mh(); "; //" omyh1=document.getElementById('myh1'); if (omyh1.innerHTML.indexOf(' Please wait ') == -1) { omyh1.innerHTML = omyh1.innerHTML + ' ... Please wait while we analyze your URLs ... '; } ";
$title = "<a target=_blank href=./fileinfotable.php title=File>Zipfile</a> <a target=_blank href=./fileinfotable.php?differences= title=Differences>Information</a> Table";
$deadlinks = "no";
$myfe = "zipfile=Report%20list%20of%20zipped%20up%20files&myf=";
if ($_GET['zipfile'] == "") {
$mode = "Zip up file";
} else {
$mode = urldecode($_GET['zipfile']);
}
} else if (isset($_POST['zipfile'])) {
if (isset($_GET['fnum'])) {
$zipf = zipfile();
if ($zipf != "") {
if (file_exists($zipf)) {
$zipfs = explode("/", $zipf);
$myext = $zipfs[sizeof($zipfs) - 1];
$mydir = str_replace("/" . $myext, "/", $zipf);
echo "<!DOCTYPE html><html><body onload=' parent.document.getElementById(\"xsubmit\").value = \"Download\"; parent.document.getElementById(\"ext\").value = \"" . $myext . "\"; parent.document.getElementById(\"dir\").value = \"" . $mydir . "\"; '></body></html>";
}
}
if ($_GET['fnum'] != 0) exit;
} else if (isset($_POST['dir']) && isset($_POST['ext'])) {
if (strpos($_POST['dir'], "/tmp/zips/") !== false) {
header('Content-Type: application/zip');
header('Content-Disposition: inline; filename=' . $_POST['ext']) ;
//header("Content-Length: ". filesize($_POST['dir'] . $_POST['ext']));
echo file_get_contents($_POST['dir'] . $_POST['ext']);
}
}
$sword = 'Zip';
$askwhentwo = " "; //if (bigj == 1) { alert(882); document.getElementById(\"f1name\").value = ininf; } else if (bigj == 2) { alert(887); document.getElementById(\"f2name\").value = ininf; document.getElementById(\"ddiff\").style.display=\"block\"; document.getElementById(\"btwo\").click(); } ";
$urlsuffix = "?zipfile=" . urlencode(urldecode($_POST['zipfile']));
$omyh1stuff = " mh(); "; //" omyh1=document.getElementById('myh1'); if (omyh1.innerHTML.indexOf(' Please wait ') == -1) { omyh1.innerHTML = omyh1.innerHTML + ' ... Please wait while we analyze your URLs ... '; } ";
$title = "<a target=_blank href=./fileinfotable.php title=File>Zipfile</a> <a target=_blank href=./fileinfotable.php?differences= title=Differences>Information</a> Table";
$deadlinks = "no";
$myfe = "zipfile=Report%20list%20of%20zipped%20up%20files&myf=";
if ($_POST['zipfile'] == "") {
$mode = "Report list of zipped up files";
} else {
$mode = urldecode($_POST['zipfile']);
}
//$outrepis = diffask();
}
$youthtml = "<input type='hidden' id='cntzip' name='cntzip' value='0'<form id=tf name=tf style='display:none;background-color:lightgreen;' align='center' border=5 method='POST' action='" . $_SERVER['PHP_SELF'] . $urlsuffix . "'>";
$youthtml .= "<input type='hidden' name='ans' id='ans' value=''><br>";
$youthtml .= "<input style='display:none;' type='submit' name='yxsubmit' id='yxsubmit' value='Submit'></form>";
function zipfile() {
$backidea = "";
$ks = explode(";", $_GET['fnum']);
$k = $ks[sizeof($ks) - 1];
try {
exec('mkdir /tmp/zips');
} catch (Exception $qw) {
}
try {
exec('mkdir /tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])));
} catch (Exception $qwq) {
}
if ($k > 0) {
if (sizeof($ks) > 1) {
if (!file_exists('/tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '/' . basename($ks[0]))) {
//$uriPhp = 'data://' . substr($_POST['z' . $k . 'data'], 5);
//$binary = file_get_contents($uriPhp);
// Strip the crud from the front of the string [1]
if (1 == 2 && isset($_FILES['z' . $k . 'data'])) {
file_put_contents('/tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '/' . basename($ks[0]), file_get_contents($_FILES['z' . $k . 'data']['tmp_name']));
} else {
$pf = $_POST['z' . $k . 'data'];
if (strpos($_POST['filename'], "data%") !== false) {
$pf = urldecode($_POST['z' . $k . 'data']);
}
file_put_contents('/tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '/' . basename($ks[0]), file_get_contents($pf));
//$stuffs = explode(",", $_POST['z' . $k . 'data']);
//$encodeString = substr($_POST['z' . $k . 'data'],strpos($_POST['z' . $k . 'data'],",")+1);
//$encodeString = str_replace(' ', '+', $encodeString);
//$decoded = base64_decode($encodedString);
//file_put_contents('/tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '/' . basename($ks[0]), $decoded);
}
}
} else if (isset($_POST['z' . $k . 'name']) && $_POST['z' . $k . 'name'] != "") {
if (!file_exists('/tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '/' . basename($_POST['z' . $k . 'name']))) {
//$uriPhp = 'data://' . substr($_POST['z' . $k . 'data'], 5);
//$binary = file_get_contents($uriPhp);
$pf = $_POST['z' . $k . 'data'];
if (strpos($_POST['filename'], "data%") !== false) {
$pf = urldecode($_POST['z' . $k . 'data']);
}
file_put_contents('/tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '/' . basename($ks[0]), file_get_contents($pf));
//$stuffs = explode(",", $_POST['z' . $k . 'data']);
//$encodeString = substr($_POST['z' . $k . 'data'],strpos($_POST['z' . $k . 'data'],",")+1);
//$encodeString = str_replace(' ', '+', $encodeString);
//$decoded = base64_decode($encodedString);
//file_put_contents('/tmp/zips/x.x', file_get_contents('/tmp/zips/x.x') . "\nfile=" . basename($_POST['z' . $k . 'name']));
//file_put_contents('/tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '/' . basename($_POST['z' . $k . 'name']), $decoded);
}
} else if (isset($_FILES['z' . $k . 'name'])) {
if (!file_exists('/tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '/' . basename($_POST['z' . $k . 'name']))) {
file_put_contents('/tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '/' . basename($ks[0]), file_get_contents($_FILES['z' . $k . 'data']['tmp_name']));
}
} else {
//file_put_contents('/tmp/zips/x.x', file_get_contents('/tmp/zips/x.x') . "\ncmd=" . 'zip -mrjT /tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '_' . basename($_GET['zname']) . ' /tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '/*');
$backidea = '/tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '_' . basename($_GET['zname']);
exec('zip -mrjT /tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '_' . basename($_GET['zname']) . ' /tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '/*');
}
}
return $backidea;
}
function diffask() {
$ourrepis = "";
if (isset($_POST['f1data'])) {
exec(' mkdir /tmp/diffs');
file_put_contents("/tmp/diffs/" . basename($_POST['f1name']), $_POST['f1data']);
$ffile = "/tmp/diffs/" . basename($_POST['f1name']);
if ($_POST['f2data'] == "") {
$ourrepis = "<p>Filename " . $_POST['f1name'] . " on its lonesome but you'll be pleased to know it does not have a split personality.</p>";
} else {
$ssdir = "diffs/";
file_put_contents("/tmp/" . $ssdir . basename($_POST['f2name']), $_POST['f2data']);
exec(' diff "' . $ffile . '" "/tmp/' . $ssdir . basename($_POST['f2name']) . '" > /tmp/diffs/xd.xd ');
//$ourrepis = "Filename " . $_POST['f1name'] . " differs from filename " . $_POST['f2name'] . " as below:<br><br><textarea style='width:100%;height:700px;'>" . str_replace("<", "<", str_replace(">", ">", file_get_contents("/tmp/diffs/xd.xd"))) . "</textarea>";
$ourrepis = "Filename " . $_POST['f1name'] . " differs from filename " . $_POST['f2name'] . " as below:<br><br><textarea style='width:100%;height:700px;'>" . str_replace("\r", "", file_get_contents("/tmp/diffs/xd.xd")) . "</textarea>";
exec(' rm -f /tmp/diffs/xd.xd');
exec(' rm -f "' . $ffile . '"');
exec(' rm -f "/tmp/' . $ssdir . basename($dir . $fsp . $ext) . '"');
}
}
return $ourrepis;
}
function url_exists($url) { // Thanks to http://stackoverflow.com/questions/2280394/how-can-i-check-if-a-url-exists-via-php
global $fnameis;
global $lnameis;
global $pnameis;
global $flh;
$exists = false;
$url = urldecode($url);
if (strpos($url, "https:") !== false || strpos($url, "HTTPS:") !== false || strpos($url, "http:") !== false || strpos($url, "HTTP:") !== false) {
if (strpos(substr(trim($url), 8), "/") === false) $url = trim($url) . "/";
$wordsare = explode("/", $url);
if ($wordsare[sizeof($wordsare) - 1] != "") {
if (strpos($wordsare[sizeof($wordsare) - 1], ".") === false && strpos($wordsare[sizeof($wordsare) - 1], "?") === false && strpos($wordsare[sizeof($wordsare) - 1], "&") === false) {
$url = trim($url) . "/";
}
}
//if (!$fp = curl_init($url)) return false;
//curl_close($fp);
//return true;
$curl = curl_init(); // thanks to http://stackoverflow.com/questions/7852005/how-to-check-if-a-url-exists-with-php-and-make-it-time-out-after-a-number-of-sec
curl_setopt($curl, CURLOPT_URL, trim($url));
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_NOBODY, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($curl);
curl_close($curl);
preg_match("/HTTP\/1\.[1|0]\s(\d{3})/",$data,$matches);
return ($matches[1] == 200);
} else if (strpos($url, "http:") !== false || strpos($url, "HTTP:") !== false) {
$file = $url;
$file_headers = @get_headers($file);
$flh = $file_headers[0];
if (strpos($file_headers[0], " 404 ") !== false) { // == 'HTTP/1.1 404 Not Found') {
$exists = false;
} else {
$exists = true;
}
} else {
$exists = file_exists($url);
}
return $exists;
}
function echop($ine) {
global $fnameis;
global $lnameis;
global $pnameis;
echo "<!DOCTYPE html><html><body><script type='text/javascript'> top.document.title='" . $ine . "'; top.document.body.innerHTML = top.document.body.innerHTML + '<p>" . str_replace("\n", "", $ine) . "</p><br>'; </script><p>" . $ine . "</p></body></html>";
}
function prelook($xinfl) {
global $fnameis;
global $lnameis;
global $pnameis;
global $undefined;
$outinfl = $xinfl;
$fnameis = "";
if (strpos($xinfl, "http(") !== false || strpos($xinfl, "HTTP(") !== false) {
$zxinfl = explode(")", substr($xinfl, 5));
$hbit = "(" . $zxinfl[0] . ")";
$outinfl = str_replace($hbit, "", $outinfl);
$fnameis = str_replace(" undefined ", $undefined, str_replace("(", " in ", str_replace(")", "", str_replace("|", " on line ", str_replace("@", " at column ", $hbit)))));
}
return $outinfl;
}
function pluck($sdelim, $pstr, $bstr, $edelim, $ourln, $ourcp) {
global $urllist, $statuslist, $linelist, $collist, $fnameis;
if ($sdelim == "=") {
if (strpos($bstr, "'") !== false && strpos($bstr, '"') !== false) {
if (strpos($bstr, "'") < strpos($bstr, '"')) {
$sdelim = "'";
} else {
$sdelim = '"';
}
}
}
if ($sdelim == "") {
$preturl = explode($edelim, $bstr);
$pturl = explode("<", $preturl[0]);
$turl = explode(chr(92), $pturl[0]);
} else {
$preturl = explode($sdelim, $bstr);
$pturl = explode("<", $preturl[0]);
$turl = explode(chr(92), $pturl[0]);
}
$endl = "";
if (strpos(substr(trim($pstr . $turl[0]), 8), "/") === false) $turl[0] = trim($turl[0]) . "/";
$urllist .= $pstr . $turl[0] . "<br>";
if (url_exists($pstr . $turl[0])) {
$statuslist .= "exists<br>";
} else {
$statuslist .= "<font color=red>does not</font> exist<br>";
}
$linelist .= $ourln . "<br>";
$collist .= $ourcp . "<br>";
return $pstr . "(" . $fnameis . "|" . $ourln . "@" . $ourcp . ")" . $turl[0] . $edelim;
}
function makeintolist($inst) { // via web server filelist via glob
global $urllist, $statuslist, $linelist, $collist, $fnameis, $urlsuffix;
$urlbit = "";
$outst = $inst;
$interimst = $inst;
$interimst = explode("\n", $inst);
if (sizeof($interimst) > 0) $outst = "";
for ($ik=0; $ik<sizeof($interimst); $ik++) {
$xinst = $interimst[$ik];
$iposis = strpos($interimst[$ik], "http");
while ($iposis !== false) {
if ($iposis == 0) {
$interimst[$ik] = "xxxx" . substr($xinst, ($iposis + 4));
if (substr($xinst, ($iposis + 4), 1) != "_" && substr($xinst, ($iposis + 4), 1) != "-") $urlbit = pluck("", "http", substr($xinst, ($iposis + 4)), "\n", ($ik + 1), ($iposis + 1));
$outst .= $urlbit;
$xinst = $interimst[$ik];
$urlbit = "";
} else {
$interimst[$ik] = substr($xinst, 0, $iposis) . "xxxx" . substr($xinst, ($iposis + 4));
if (substr($xinst, ($iposis + 4), 1) != "_" && substr($xinst, ($iposis + 4), 1) != "-") $urlbit = pluck(substr($xinst, ($iposis - 1), 1), "http", substr($xinst, ($iposis + 4)), "\n", ($ik + 1), ($iposis + 1));
$xinst = $interimst[$ik];
$outst .= $urlbit;
$urlbit = "";
}
$iposis = strpos($interimst[$ik], "http");
}
$iposis = strpos($interimst[$ik], "HTTP");
while ($iposis !== false) {
if ($iposis == 0) {
$interimst[$ik] = "xxxx" . substr($xinst, ($iposis + 4));
if (substr($xinst, ($iposis + 4), 1) != "_" && substr($xinst, ($iposis + 4), 1) != "-") $urlbit = pluck("", "HTTP", substr($xinst, ($iposis + 4)), "\n", ($ik + 1), ($iposis + 1));
$xinst = $interimst[$ik];
$outst .= $urlbit;
$urlbit = "";
} else {
$interimst[$ik] = substr($xinst, 0, $iposis) . "xxxx" . substr($xinst, ($iposis + 4));
if (substr($xinst, ($iposis + 4), 1) != "_" && substr($xinst, ($iposis + 4), 1) != "-") $urlbit = pluck(substr($xinst, ($iposis - 1), 1), "HTTP", substr($xinst, ($iposis + 4)), "\n", ($ik + 1), ($iposis + 1));
$xinst = $interimst[$ik];
$outst .= $urlbit;
$urlbit = "";
}
$iposis = strpos($interimst[$ik], "HTTP");
}
}
return $outst;
}
function readandprocess($infl) {
global $fnameis;
global $lnameis;
global $pnameis;
global $flh, $urlsuffix;
$fnameis = "";
$endl = "";
$outfl = "<table>";
if (strpos($infl, "@!~*^@") !== false) {
if (strpos($infl, "@!~*^@") < 80) {
$spl = explode("@!~*^@", $infl);
$infl = $spl[1];
$fnameis = $spl[0];
}
}
if ($fnameis != "" || (strpos(("*" . $infl), "*http") === false && strpos(("*" . $infl), "*HTTP") === false)) {
$urls = explode("\n", makeintolist($infl));
$fnameis = "";
if ($urlsuffix != "") $outfl = "";
} else {
$urls = explode("\n", $infl);
}
if ($outfl != "") {
for ($ij=0; $ij<sizeof($urls); $ij++) {
$urls[$ij] = prelook($urls[$ij]);
if ($urls[$ij] != "") {
$endl = "";
if (strpos(substr(trim($urls[$ij]), 8), "/") === false) $urls[$ij] = trim($urls[$ij]) . "/";
if (url_exists($urls[$ij] . $endl)) {
$outfl .= "<tr><td><b>" . $urls[$ij] . $endl . "</b> exists" . $fnameis . $lnameis . $pnameis . ".</td></tr>";
} else {
$outfl .= "<tr><td><b>" . $urls[$ij] . $endl . "</b> <font color=red>does not</font> exist" . $fnameis . $lnameis . $pnameis . ".</td></tr>";
}
$flh = "";
}
}
$outfl .= "</table>";
}
return $outfl;
}
function on_to($on, $to) {
global $fnameis;
global $lnameis;
global $pnameis;
if (url_exists(urldecode($on))) {
if ($to == "") {
echop(urldecode($on) . " exists" . $fnameis . $lnameis . $pnameis . ".\n");
} else {
file_put_contents($to, file_get_contents($to) . urldecode($on) . " exists" . $fnameis . $lnameis . $pnameis . ".\n");
}
exit;
} else {
if ($to == "") {
echop(urldecode($on) . " <font color=red>does not</font> exist" . $fnameis . $lnameis . $pnameis . ".\n");
} else {
file_put_contents($to, file_get_contents($to) . urldecode($on) . " <font color=red>does not</font> exist" . $fnameis . $lnameis . $pnameis . ".\n");
}
exit;
}
}
$outrep = "";
if (isset($_GET['justreportto'])) {
$outrep = urldecode($_GET['justreportto']);
if (strpos($outrep, "/") === false && strpos($outrep, "\\") === false) {
$outrep = dirname(__FILE__) . "/" . $outrep;
}
} else if (isset($_POST['justreportto'])) {
$outrep = urldecode($_POST['justreportto']);
if (strpos($outrep, "/") === false && strpos($outrep, "\\") === false) {
$outrep = dirname(__FILE__) . "/" . $outrep;
}
}
if (isset($_GET['justreporton'])) {
on_to(urldecode($_GET['justreporton']), $outrep);
exit;
} else if (isset($_POST['justreporton'])) {
on_to(urldecode($_POST['justreporton']), $outrep);
exit;
} else {
if (isset($_GET['fsp'])) {
$iscalled = "y";
$fsp = $_GET['fsp'];
} else if (isset($_POST['fsp'])) {
$iscalled = "y";
$fsp = $_POST['fsp'];
} else if ($deadlinks == "") {
$fsp = "*";
$ext = ".xml";
} else if ($deadlinks == "n") {
$fsp = "*";
$ext = ".php";
} else {
$fsp = "index";
$ext = ".html";
}
if (isset($_GET['ext'])) {
if ($iscalled == "") $fsp = "";
$iscalled = "y";
$ext = $_GET['ext'];
} else if (isset($_POST['ext'])) {
if ($iscalled == "") $fsp = "";
$iscalled = "y";
$ext = $_POST['ext'];
} else if ($iscalled != "") {
$ext = "";
}
if (isset($_GET['dir'])) {
$iscalled = "y";
$dir = $_GET['dir'];
} else if (isset($_POST['dir'])) {
$iscalled = "y";
$dir = $_POST['dir'];
} else if ($deadlinks == "") {
$dir = '/'; // '/Library/pgAgent/Downloads/CRL/';
} else if ($deadlinks != "n") {
$dir = 'http://';
}
if ($iscalled == "") {
$outhtml = "<!DOCTYPE html>\n<html><head><link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'><title>" . $rtitle . "</title>\n";
$outhtml .= '
<script type="text/javascript">
var wut = new Array();
var findto="' . $fwto . '";
var findwhat="' . $fwis . '";
var which="' . $sword . '";
var xwhat="xsubmit";
var what="/tmp/zips/";
var uform; // = document.getElementById("file-form");
var fileSelect; // = document.getElementById("files");
var uploadButton; // = document.getElementById("upload-button");
// Create a new FormData object.
var aformData = new FormData();
var vformData = new FormData();
var njk=0
var imgmode=" ";
var omyh1;
var fcont="";
var bigi=0;
var bigj=0;
var wl="";
var doneonce="";
var presm="sm";
var bigbuffer="";
var prevmy_res="";
var bigf=new Array();
var urlsuf="' . str_replace("?differences=", "", str_replace("?zipfile=", "", $urlsuffix)) . '";
var zipcnt=' . $zipcnt . ';
function inamender(ina) {
var outa = ina;
if (outa != "") {
var ch=ina.split("->");
if (ch[0].substring(0,1) == "/") {
ch[0] = ch[0].replace("~" + "~", "[~][~]").replace("~" + "~", "[~][~]").replace("~" + "~", "[~][~]");
} else {
ch[0] = ch[0].replace("~" + "~", "%7e%7e").replace("~" + "~", "%7e%7e").replace("~" + "~", "%7e%7e");
}
if (ch.length > 1) {
ch[1] = ch[1].replace("~" + "~", "%7e%7e").replace("~" + "~", "%7e%7e").replace("~" + "~", "%7e%7e");
outa = ch[0] + "->" + ch[1];
} else {
outa = ch[0];
}
}
return outa;
}
function lookoutfor() {
var ht;
var fto = document.getElementById("findto").value;
var fwhat = document.getElementById("findwhat").value;
if ((fwhat == "" || fwhat == null) && top.window.document.title.indexOf("--") != -1) {
fwhat = top.window.document.title.substring(eval(top.window.document.title.indexOf("--") + 3));
ht = fwhat.split(" --");
if (ht.length > 1) {
fwhat = ht[0];
fto = ht[1].substring(1);
document.getElementById("findwhat").value = fwhat;
document.getElementById("findto").value = fto;
} else {
document.getElementById("findwhat").value = fwhat;
}
document.getElementById("find").checked = true;
}
if (njk == 3 && document.getElementById("af").value != "" && document.getElementById("vf").value != "") {
if (document.getElementById("afilename").value != "" && document.getElementById("vfilename").value != "") {
if (document.getElementById("upload-button").style.display != "block") {
document.getElementById("upload-button").style.display = "block";
} else {
var huhav=prompt("Do you want a synchronized playing of " + document.getElementById("af").value + " with " + document.getElementById("vf").value + " ?", "Yes");
document.getElementById("af").value = "";
document.getElementById("vf").value = "";
if (huhav != null) {
if (huhav == "Yes") {
document.getElementById("avtable").style.display = "block";
document.getElementById("abt").style.display = "block";
document.getElementById("asubmit").click();
document.getElementById("vsubmit").click();
//document.aform.submit();
//document.vform.submit();
location.href = "#abt";
}
}
}
}
}
}
function mh() { ' . $fmh . ' }
function btwoclick() {
//alert(document.getElementById("flist").value);
document.getElementById("btwo").click();
document.getElementById("btwo").style.display = "none";
}
function dlbclick() {
//alert(document.getElementById("flist").value);
document.getElementById("dlb").click();
}
function check(thisfordelim) {
var outval = thisfordelim.value;
if (outval.length > 0) {
if ((outval + "@!@").indexOf(String.fromCharCode(47) + "@!@") == -1 && (outval + "@!@").indexOf(String.fromCharCode(92) + "@!@") == -1) {
if (outval.indexOf(String.fromCharCode(92)) != -1) {
outval = outval + String.fromCharCode(92);
thisfordelim.value = outval;
} else if (outval.indexOf(String.fromCharCode(47)) != -1) {
outval = outval + String.fromCharCode(47);
thisfordelim.value = outval;
} else {
outval = outval + String.fromCharCode(47);
thisfordelim.value = outval;
}
}
}
return outval;
}
function readBlob(opt_startByte, opt_stopByte) {
omyh1 = document.getElementById("myh1");
' . $omyh1stuff . '
var files = document.getElementById("file").files;
if (!files.length) {
alert("Please select a file!");
return;
}
var file = files[0];
var ourfile;
for (var i = 0; i < files.length; i++) {
ourfile = files[i];
// Check the file type.
if ((ourfile.type.indexOf("audio/") != -1 && (njk == 0 || njk == 2)) || (ourfile.type.indexOf("video/") != -1 && (njk == 0 || njk == 1))) {
// Add the file to the request.
njk = njk + 1;
if (ourfile.type.indexOf("video/") != -1) {
njk = njk + 1;
vformData.append("vfile", ourfile, ourfile.name);
} else {
aformData.append("afile", ourfile, ourfile.name);
}
}
}
var start = parseInt(opt_startByte) || 0;
var stop = parseInt(opt_stopByte) || file.size - 1;
var reader = new FileReader();
if ((imgmode == " " && file.type.match(' . "'" . 'image.*' . "'" . ') && "' . $deadlinks . '" != "n") || "' . $deadlinks . '" == "no") {
imgmode = "y";
} else if (imgmode == " ") {
imgmode = "";
}
if ("' . $deadlinks . '" != "n" && "' . $deadlinks . '" != "nowayjose" && (imgmode == "y" || file.type.match(' . "'" . 'image.*' . "'" . ') || file.type.indexOf(' . "'" . '/pdf' . "'" . ') != -1 || file.type.indexOf(' . "'" . 'audio/' . "'" . ') != -1 || file.type.indexOf(' . "'" . 'video/' . "'" . ') != -1 || file.type.indexOf(' . "'" . 'application/' . "'" . ') != -1)) {
// Closure to capture the file information.
reader.onload = (function(theFile) {
return function(e) {
if ("' . $deadlinks . '" == "no") { // zipping files scenario ... yay one
var ond=0; //parseInt(document.getElementById("cntzip").value);
var dno=eval(1 + ond);
if (escape(theFile.name) != "" && document.body.innerHTML.indexOf("*" + escape(theFile.name) + "*") == -1) {
document.body.innerHTML = document.body.innerHTML + "<p style=display:none;>*" + escape(theFile.name) + "*</p>";
//alert(dno);
document.getElementById("cntzip").value = dno;
//alert(document.getElementById("cntzip").value);
var maybe=prompt("Zipping " + theFile.name + " ... is this okay? When all done, click the Download button to access the zip file.", "Yes");
if (maybe == null || maybe != "Yes") {
maybe = maybe;
} else {
document.getElementById("z" + dno + "name").value = escape(theFile.name);
document.getElementById("fzip" + dno).action = document.getElementById("fzip" + dno).action.replace("fnum=", "fnum=" + escape(theFile.name) + ";");
document.getElementById("izip" + dno).src = document.getElementById("izip" + dno).src.replace("fnum=", "fnum=" + escape(theFile.name) + ";");
document.getElementById("z" + dno + "data").value = e.target.result;
document.getElementById("bzip" + dno).click();
setTimeout(zclick, 5000);
}
}
} else {
// Render thumbnail.
if (document.body.innerHTML.indexOf(' . "'" . '" title="' . "'" . ' + escape(theFile.name) + ' . "'" . "'" . ' ) == -1) {
var vid = theFile.name.replace(".","");
var mvid = theFile.name.replace(".","m");
if (theFile.type.indexOf("image/") != -1 || theFile.type.indexOf("/pdf") != -1 || theFile.type.indexOf("audio/") != -1 || theFile.type.indexOf("video/") != -1 || theFile.type.indexOf("application/") != -1) {
var span = document.createElement("span");
var elt = "img";
if (theFile.type.indexOf("image/") == -1) elt = "iframe";
if (theFile.type.indexOf("/pdf") != -1) {
span.innerHTML = [' . "'" . '<a class=pdfa href=#' . "'" . ' + vid + ' . "'" . ' onclick=document.getElementById("' . "'" . ' + vid + ' . "'" . '").style.display="block"; class="thumb" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"><img src=icon_pdf.gif title=Pdf />' . "'" . ' + escape(theFile.name) + ' . "'" . '</a>' . "'" . '].join(' . "'" . '' . "'" . ');
} else if (theFile.type.indexOf("audio/") != -1) {
//alert(11);
span.innerHTML = [' . "'" . '<a class=pdfa href=#' . "'" . ' + vid + ' . "'" . ' onclick=document.getElementById("' . "'" . ' + vid + ' . "'" . '").style.display="block"; class="thumb" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"><img src=icon_external.gif title=Pdf />' . "'" . ' + escape(theFile.name) + ' . "'" . '</a>' . "'" . '].join(' . "'" . '' . "'" . ');
if (document.getElementById("afilename").value == "") {
document.getElementById("afilename").value = ((encodeURIComponent(e.target.result)));
//alert(1);
document.getElementById("af").value = theFile.name;
}
} else if (theFile.type.indexOf("video/") != -1) {
span.innerHTML = [' . "'" . '<a class=pdfa href=#' . "'" . ' + vid + ' . "'" . ' onclick=document.getElementById("' . "'" . ' + vid + ' . "'" . '").style.display="block"; class="thumb" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"><img src=icon_external.gif title=Pdf />' . "'" . ' + escape(theFile.name) + ' . "'" . '</a>' . "'" . '].join(' . "'" . '' . "'" . ');
if (document.getElementById("vfilename").value == "") {
document.getElementById("vfilename").value = ((encodeURIComponent(e.target.result)));
//alert(2);
document.getElementById("vf").value = theFile.name;
}
} else if (theFile.type.indexOf("application/") != -1 && theFile.type.indexOf("spreadsheet") != -1) {
span.innerHTML = [' . "'" . '<a class=pdfa href=#' . "'" . ' + vid + ' . "'" . ' onclick=document.getElementById("' . "'" . ' + vid + ' . "'" . '").style.display="block"; class="thumb" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"><img src=icon_xls.gif title=Pdf />' . "'" . ' + escape(theFile.name) + ' . "'" . '</a>' . "'" . '].join(' . "'" . '' . "'" . ');
} else if (theFile.type.indexOf("application/") != -1 && (theFile.type.indexOf("document") != -1 || theFile.type.indexOf("msword") != -1)) {
span.innerHTML = [' . "'" . '<a class=pdfa href=#' . "'" . ' + vid + ' . "'" . ' onclick=document.getElementById("' . "'" . ' + vid + ' . "'" . '").style.display="block"; class="thumb" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"><img src=icon_doc.gif title=Pdf />' . "'" . ' + escape(theFile.name) + ' . "'" . '</a>' . "'" . '].join(' . "'" . '' . "'" . ');
} else if (theFile.type.indexOf("application/") != -1) {
span.innerHTML = [' . "'" . '<a class=pdfa href=#' . "'" . ' + vid + ' . "'" . ' onclick=document.getElementById("' . "'" . ' + vid + ' . "'" . '").style.display="block"; class="thumb" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"><img src=icon_popup.gif title=Pdf />' . "'" . ' + escape(theFile.name) + ' . "'" . '</a>' . "'" . '].join(' . "'" . '' . "'" . ');
} else {
span.innerHTML = [' . "'" . '<img onclick=document.getElementById("' . "'" . ' + vid + ' . "'" . '").style.display="block"; class="thumb" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"/>' . "'" . '].join(' . "'" . '' . "'" . ');
}
document.getElementById(' . "'" . 'imglist' . "'" . ').insertBefore(span, null);
}
var xxxx="<p id="' . "" . ' + mvid + ' . "" . '" align=center>Filename is <strong>" + maybemedia(escape(theFile.name) + "</strong> ... Type is (" + (theFile.type || "n/a") + ") ... Date is ") + (theFile.lastModifiedDate ? theFile.lastModifiedDate.toLocaleDateString() : "n/a") + " ... Size is " + theFile.size + " bytes </p>";
var span1 = document.createElement("span");
span1.innerHTML = xxxx;
document.getElementById(' . "'" . 'imglist' . "'" . ').insertBefore(span1, null);
if (theFile.type.indexOf("image/") != -1 || theFile.type.indexOf("/pdf") != -1 || theFile.type.indexOf("audio/") != -1 || theFile.type.indexOf("video/") != -1 || theFile.type.indexOf("application/") != -1) {
var span2 = document.createElement("span");
if (theFile.type.indexOf("/pdf") != -1) {
span2.innerHTML = [' . "'" . '<iframe class=big id="' . "'" . ' + vid + ' . "'" . '" style="display:none;" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"/>' . "'" . '].join(' . "'" . '' . "'" . ');
} else if (theFile.type.indexOf("audio/") != -1) {
span2.innerHTML = [' . "'" . '<audio controls=controls autoplay=autoplay class=big id="' . "'" . ' + vid + ' . "'" . '" style="display:none;" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"/>' . "'" . '].join(' . "'" . '' . "'" . ');
if (document.getElementById("afilename").value == "") {
document.getElementById("afilename").value = ((encodeURIComponent(e.target.result)));
document.getElementById("af").value = theFile.name;
}
} else if (theFile.type.indexOf("video/") != -1) {
span2.innerHTML = [' . "'" . '<video controls=controls autoplay=autoplay class=big id="' . "'" . ' + vid + ' . "'" . '" style="display:none;" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"/>' . "'" . '].join(' . "'" . '' . "'" . ');
if (document.getElementById("vfilename").value == "") {
document.getElementById("vfilename").value = ((encodeURIComponent(e.target.result)));
document.getElementById("vf").value = theFile.name;
}
} else if (theFile.type.indexOf("application/") != -1) {
span2.innerHTML = [' . "'" . '<iframe class=big id="' . "'" . ' + vid + ' . "'" . '" style="display:none;" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"/>' . "'" . '].join(' . "'" . '' . "'" . ');
} else {
span2.innerHTML = [' . "'" . '<img class=big id="' . "'" . ' + vid + ' . "'" . '" style="display:none;" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"/>' . "'" . '].join(' . "'" . '' . "'" . ');
}
document.getElementById(' . "'" . 'imglist' . "'" . ').insertBefore(span2, null);
}
}
}
};
})(file);
reader.readAsDataURL(file);
} else if (imgmode == "y") {
// Closure to capture the file information.
reader.onload = (function(theFile) {
return function(e) {
var vid = theFile.name.replace(".","");
var mvid = theFile.name.replace(".","m");
var xxxx="<p id="' . "" . ' + mvid + ' . "" . '" align=center>Filename is <strong>" + maybemedia(escape(theFile.name) + "</strong> ... Type is (" + (theFile.type || "n/a") + ") ... Date is ") + (theFile.lastModifiedDate ? theFile.lastModifiedDate.toLocaleDateString() : "n/a") + " ... Size is " + theFile.size + " bytes </p>";
var span1 = document.createElement("span");
span1.innerHTML = xxxx;
document.getElementById(' . "'" . 'imglist' . "'" . ').insertBefore(span1, null);
};
})(file);
reader.readAsDataURL(file);
} else {
// If we use onloadend, we need to check the readyState.
reader.onloadend = function(evt) {
if (evt.target.readyState == FileReader.DONE) { // DONE == 2
document.getElementById("byte_content").textContent = evt.target.result;
document.getElementById("byte_range").textContent =
["Read bytes: ", start + 1, " - ", stop + 1,
" of ", file.size, " byte file"].join("");
';
if ($deadlinks == "n" && 1 == 2) { // differences table
$outhtml .= '
if (document.getElementById("f1data").value == "") {
alert(1718);
document.getElementById("f1data").value = evt.target.result;
alert(543);
} else if (document.getElementById("f2data").value == "") {
document.getElementById("f2data").value = evt.target.result;
}
';
}
$outhtml .= '
process(evt.target.result);
}
};
var blob = file.slice(start, stop + 1);
reader.readAsBinaryString(blob);
}
}
function osbm(event) {
//event.preventDefault();
// Update button text.
uploadButton.innerHTML = "Uploading...";
//var avfiles = event.target.files;
var ourfile, xnjk=3, xvformData, xaformData;
var xaformData = new FormData();
var xvformData = new FormData();
xvformData.append("vfile", document.getElementById("vfilename").value); //ourfile, ourfile.name);
xaformData.append("afile", document.getElementById("afilename").value); //ourfile, ourfile.name);
if (xnjk == 3) {
// Set up the request.
var axhr = new XMLHttpRequest();
// Set up a handler for when the request finishes.
axhr.onload = function () {
if (axhr.status === 200) {
// File(s) uploaded.
uploadButton.innerHTML = "UpLoad";
} else {
alert("An error occurred!");
}
};
var vxhr = new XMLHttpRequest();
vxhr.onload = function () {
if (vxhr.status === 200) {
// File(s) uploaded.
uploadButton.innerHTML = "UpLoad";
} else {
alert("An error occurred!");
}
};
// Open the connection.
axhr.open("POST", "./audio_generic.php", true);
vxhr.open("POST", "./video_generic.php", true);
// Send the Data.
axhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
vxhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
axhr.setRequestHeader("Content-length", xaformData.length);
vxhr.setRequestHeader("Content-length", xvformData.length);
axhr.send(xaformData);
vxhr.send(xvformData);
}
}
function filesclick() {
document.getElementById("files").click();
}
function maybedo() {
';
if (isset($_POST['findprompt']) || isset($_GET['findprompt'])) {
$outhtml .= '
document.getElementById("findto").value="' . $fwto . '";
document.getElementById("findwhat").value="' . $fwis . '";
if (document.getElementById("findwhat").value.length > 0) {
document.getElementById("find").checked=true;
document.getElementById("findwhat").style.display = "inline";
document.getElementById("sfind").style.display = "inline";
document.getElementById("findto").style.display = "inline";
document.getElementById("sfindto").style.display = "inline";
top.window.document.title=top.window.document.title + String.fromCharCode(32) + String.fromCharCode(45) + String.fromCharCode(45) + String.fromCharCode(32) + document.getElementById("findwhat").value;
if (document.getElementById("findto").value != "") top.window.document.title=top.window.document.title + String.fromCharCode(32) + String.fromCharCode(45) + String.fromCharCode(45) + String.fromCharCode(32) + document.getElementById("findto").value;
setTimeout(filesclick, 1000); //document.getElementById("files").click();
} else {
var myval=inamender(prompt("Find What (NB: / / go around a regular expression)? Optionally append by -> a replacement string.","' . $fwis . '"));
if (myval != "") {
if (myval.indexOf("->") != -1) {
var hmv=myval.split("->");
document.getElementById("findwhat").value=hmv[0];
document.getElementById("findto").value=hmv[1];
} else {
document.getElementById("findwhat").value=myval;
}
findwhat=myval;
document.getElementById("find").checked=true;
document.getElementById("findwhat").style.display = "inline";
document.getElementById("sfind").style.display = "inline";
document.getElementById("findto").style.display = "inline";
document.getElementById("sfindto").style.display = "inline";
top.window.document.title=top.window.document.title + String.fromCharCode(32) + String.fromCharCode(45) + String.fromCharCode(45) + String.fromCharCode(32) + document.getElementById("findwhat").value;
if (document.getElementById("findto").value != "") top.window.document.title=top.window.document.title + String.fromCharCode(32) + String.fromCharCode(45) + String.fromCharCode(45) + String.fromCharCode(32) + document.getElementById("findto").value;
setTimeout(filesclick, 1000); //document.getElementById("files").click();
}
}
';
} else if (isset($_POST['findwhat']) || isset($_GET['findwhat']) || isset($_POST['find']) || isset($_GET['find'])) {
$outhtml .= '
document.getElementById("findto").value="' . $fwto . '";
document.getElementById("findwhat").value="' . $fwis . '";
if (document.getElementById("findwhat").value.length > 0) {
document.getElementById("find").checked=true;
document.getElementById("findwhat").style.display = "inline";
document.getElementById("findto").style.display = "inline";
document.getElementById("sfindto").style.display = "inline";
document.getElementById("sfind").style.display = "inline";
top.window.document.title=top.window.document.title + String.fromCharCode(32) + String.fromCharCode(45) + String.fromCharCode(45) + String.fromCharCode(32) + document.getElementById("findwhat").value;
if (document.getElementById("findto").value != "") top.window.document.title=top.window.document.title + String.fromCharCode(32) + String.fromCharCode(45) + String.fromCharCode(45) + String.fromCharCode(32) + document.getElementById("findto").value;
setTimeout(filesclick, 1000); //document.getElementById("files").click();
} else {
document.getElementById("find").checked=true;
document.getElementById("findwhat").style.display = "inline";
document.getElementById("findto").style.display = "inline";
document.getElementById("sfind").style.display = "inline";
document.getElementById("sfindto").style.display = "inline";
document.getElementById("findwhat").focus = true;
}
';
}
$outhtml .= '
}
function doonload() {
setTimeout(maybedo, 1000);
';
$outhtml .= '
setInterval(lookoutfor, 5000);
uform = document.getElementById("file-form");
//fileSelect = document.getElementById("files");
uploadButton = document.getElementById("upload-button");
omyh1 = document.getElementById("myh1");
if (window.File && window.FileReader && window.FileList && window.Blob) {
var iii=0;
} else {
document.getElementById("files").style.display = "none";
document.getElementById("file").style.display = "none";
if (1 == 2) { alert("The File APIs are not fully supported in this browser."); }
}
var ourf=location.search.split("myf=")[1] ? location.search.split("myf=")[1].split("&")[0] : "";
document.body.innerHTML = document.body.innerHTML + decodeURIComponent(ourf);
document.querySelector(' . "'.readBytesButtons'" . ').addEventListener(' . "'click'" . ', function(evt) {
if (evt.target.tagName.toLowerCase() == "button") {
var startByte = evt.target.getAttribute("data-startbyte");
var endByte = evt.target.getAttribute("data-endbyte");
readBlob(startByte, endByte);
}
}, false);
' . $fsev . '
}
function maybemedia(inidea) {
var outidea = inidea;
var parts = inidea.split("<");
var pdfi = "icon_pdf.gif";
var doci = "icon_doc.gif";
var xlsi = "icon_xls.gif";
var appi = "icon_popup.gif";
var audioi = "icon_external.gif";
var dparts = String.fromCharCode(34) + parts[0] + String.fromCharCode(34);
var videoi = "icon_external.gif";
if (inidea.indexOf("/pdf") != -1) {
outidea = inidea.replace(" Type is ", "<img onclick=window.open(' . "'" . '" + parts[0] + "' . "'" . ',' . "'" . '_blank' . "'" . '); width=45 height=45 src=' . "'" . '" + pdfi + "' . "'" . ' title=' . "'" . '" + parts[0] + "' . "'" . ' /> Type is ");
} else if (inidea.indexOf("audio/") != -1) {
outidea = inidea.replace(" Type is ", "<img onclick=window.open(' . "'" . '" + parts[0] + "' . "'" . ',' . "'" . '_blank' . "'" . '); width=45 height=45 src=' . "'" . '" + audioi + "' . "'" . ' title=' . "'" . '" + parts[0] + "' . "'" . ' /> Type is ");
} else if (inidea.indexOf("video/") != -1) {
outidea = inidea.replace(" Type is ", "<img onclick=window.open(' . "'" . '" + parts[0] + "' . "'" . ',' . "'" . '_blank' . "'" . '); width=45 height=45 src=' . "'" . '" + videoi + "' . "'" . ' title=' . "'" . '" + parts[0] + "' . "'" . ' /> Type is ");
} else if (inidea.indexOf("application/") != -1 && inidea.indexOf("spreadsheet") != -1) {
outidea = inidea.replace(" Type is ", "<img onclick=window.open(' . "'" . '" + parts[0] + "' . "'" . ',' . "'" . '_blank' . "'" . '); width=45 height=45 src=' . "'" . '" + xlsi + "' . "'" . ' title=' . "'" . '" + parts[0] + "' . "'" . ' /> Type is ");
} else if (inidea.indexOf("application/") != -1 && (inidea.indexOf("document") != -1 || inidea.indexOf("msword") != -1)) {
outidea = inidea.replace(" Type is ", "<img onclick=window.open(' . "'" . '" + parts[0] + "' . "'" . ',' . "'" . '_blank' . "'" . '); width=45 height=45 src=' . "'" . '" + doci + "' . "'" . ' title=' . "'" . '" + parts[0] + "' . "'" . ' /> Type is ");
} else if (inidea.indexOf("application/") != -1) {
outidea = inidea.replace(" Type is ", "<img onclick=window.open(' . "'" . '" + parts[0] + "' . "'" . ',' . "'" . '_blank' . "'" . '); width=45 height=45 src=' . "'" . '" + appi + "' . "'" . ' title=' . "'" . '" + parts[0] + "' . "'" . ' /> Type is ");
} else if (inidea.indexOf("image/") != -1) {
outidea = inidea.replace(" Type is ", "<img onclick=window.open(' . "'" . '" + parts[0] + "' . "'" . ',' . "'" . '_blank' . "'" . '); width=45 height=45 src=' . "'" . '" + parts[0] + "' . "'" . ' title=' . "'" . '" + parts[0] + "' . "'" . ' /> Type is ");
}
//alert(outidea);
return outidea;
}
function process(infilecontents) {
if (infilecontents != null) {
if (1 == 7) { alert(infilecontents); }
var ourlines = infilecontents.split(String.fromCharCode(10));
';
if ($deadlinks == "y") {
$outhtml .= '
if (1 == 1) {
document.getElementById("flist").value = document.getElementById("flist").value + justhttp(ourlines);
document.getElementById("dlb").click();
} else {
for (var jj=0; jj<ourlines.length; jj++) {
document.getElementById("dli").src = "./fileinfotable.php?deadlinks=&justreporton=" + encodeURIComponent(ourlines[jj]);
}
}
';
} else {
$outhtml .= '
var ourwords, ourwordcnt = 0; //infilecontents.split(String.fromCharCode(32));
for (var jjj=0; jjj<ourlines.length; jjj++) {
ourwords = ourlines[jjj].split(String.fromCharCode(32));
ourwordcnt = eval(ourwordcnt + ourwords.length);
}
if (1 == 2 && ((document.getElementById("file").files[0].type || "n/a").indexOf("image/") != -1 || (document.getElementById("file").files[0].type || "n/a").indexOf("/pdf") != -1 || (document.getElementById("file").files[0].type || "n/a").indexOf("audio/") != -1 || (document.getElementById("file").files[0].type || "n/a").indexOf("video/") != -1 || (document.getElementById("file").files[0].type || "n/a").indexOf("application/") != -1)) {
window.open(document.getElementById("file").value, "_blank");
document.getElementById("media").width = "500px";
document.getElementById("media").height = "500px";
document.getElementById("media").style.display = "block";
document.getElementById("media").src = document.getElementById("file").value;
}
//var myfis = "<br><br><p id=myf align=center>Filename is <strong>" + escape(document.getElementById("file").files[0].mozFullPath + document.getElementById("file").value) + "</strong> ... Type is (" + (document.getElementById("file").files[0].type || "n/a") + ") ... Date is " + (document.getElementById("file").files[0].lastModifiedDate ? document.getElementById("file").files[0].lastModifiedDate.toLocaleDateString() : "n/a") + " ... Size is " + infilecontents.length + " bytes ... Line Count is " + ourlines.length + " ... Word Count is " + ourwords.length + "</p>";
var myfis = "<br><br><p id=myf align=center>Filename is <strong>" + maybemedia(escape(document.getElementById("file").value) + "</strong> ... Type is (" + (document.getElementById("file").files[0].type || "n/a") + ") ... Date is ") + (document.getElementById("file").files[0].lastModifiedDate ? document.getElementById("file").files[0].lastModifiedDate.toLocaleDateString() : "n/a") + " ... Size is " + infilecontents.length + " bytes ... Line Count is " + ourlines.length + " ... Word Count is " + ourwordcnt + "</p>";
document.body.innerHTML = document.body.innerHTML + myfis;
var huh = document.URL.replace("?diffeXXXrences=", "").split("?");
if (huh.length > 1) {
location.href = huh[0] + "?' . $myfe . '" + decodeURIComponent(myfis);
} else {
location.href = document.URL + "?' . $myfe . '" + decodeURIComponent(myfis);
}
fcont = infilecontents;
';
}
$outhtml .= '
}
}
function nocaret(iinf, lno, jpos, inc) {
var prenoinc = inc.split("<");
var noinc = prenoinc[0].split(String.fromCharCode(92));
if (jpos > 0) return noinc[0].replace("http", "http(" + iinf + "|" + lno + "@" + jpos + ")").replace("HTTP", "HTTP(" + iinf + "|" + lno + "@" + jpos + ")");
return noinc[0].replace("http", "http(" + iinf + "|" + lno + ")").replace("HTTP", "HTTP(" + iinf + "|" + lno + ")");
}
function justhttps(instr, ininfo) {
//document.title = ininfo;
if (bigf[bigj] == null || bigf[bigj] == undefined) {
bigf[bigj] = document.getElementById("file").value;
}
if (1 == 2) {
if (document.getElementById("f1data").value == "") {
alert(178);
document.getElementById("f1data").value = instr;
alert(179);
} else if (document.getElementById("f2data").value == "") {
document.getElementById("f2data").value = instr;
}
}
return justhttp(instr.split(String.fromCharCode(eval(0 + 10))), bigf[bigj]); // ininfo);
}
function justhttp(inarr, ininf) {
var outst = "", arec = "", ipos = 0, httparr, ijkh, otherarr, endl = "", qpos = 0;
bigj = bigj + 1; ' . $askwhentwo . '
//alert(ininf);
for (var iq=0; iq<inarr.length; iq++) {
arec = inarr[iq];
if (arec.indexOf("http") == 0 || arec.indexOf("HTTP") == 0) {
endl = "";
//if (inarr[iq].substring(8).indexOf("/") == -1) endl = "/";
outst = outst + nocaret(ininf,eval(iq + 1),1,inarr[iq] + endl) + String.fromCharCode(eval(0 + 10));
arec = "";
} else if (arec.indexOf("http") == 1 || arec.indexOf("HTTP") == 1) {
endl = "";
//if (inarr[iq].replace(inarr[iq].substring(0,1), "").replace(inarr[iq].substring(0,1), "").substring(8).indexOf("/") == -1) endl = "/";
outst = outst + nocaret(ininf,eval(iq + 1),2,inarr[iq].replace(inarr[iq].substring(0,1), "").replace(inarr[iq].substring(0,1), "")) + endl + String.fromCharCode(eval(0 + 10));
arec = "";
}
if (arec.indexOf("http") > 1) {
while (arec.indexOf("http") > 1) {
qpos = eval(1 + arec.indexOf("http"));
httparr = arec.split("http");
for (ijkh=1; ijkh<httparr.length; ijkh++) {
endl = "";
otherarr = httparr[ijkh].split(httparr[eval(-1 + ijkh)].substring(eval(-1 + httparr[eval(-1 + ijkh)].length)));
if (otherarr[0].substring(0,1) != "_") {
//if (otherarr[0].substring(4).indexOf("/") == -1) endl = "/";
outst = outst + nocaret(ininf,eval(iq + 1),qpos,"http" + otherarr[0] + endl) + String.fromCharCode(eval(0 + 10));
}
arec = arec.replace("http", "xxxx");
}
}
}
if (arec.indexOf("HTTP") > 1) {
while (arec.indexOf("HTTP") > 1) {
qpos = eval(1 + arec.indexOf("HTTP"));
httparr = arec.split("HTTP");
for (ijkh=1; ijkh<httparr.length; ijkh++) {
endl = "";
otherarr = httparr[ijkh].split(httparr[eval(-1 + ijkh)].substring(eval(-1 + httparr[eval(-1 + ijkh)].length)));
if (otherarr[0].substring(0,1) != "_") {
//if (otherarr[0].substring(4).indexOf("/") == -1) endl = "/";
outst = outst + nocaret(ininf,eval(iq + 1),qpos,"HTTP" + otherarr[0] + endl) + String.fromCharCode(eval(0 + 10));
}
arec = arec.replace("HTTP", "xxxx");
}
}
}
}
//alert(outst);
return outst;
}
function zclick() {
zipcnt = eval((zipcnt % 10) + 1);
//for (var ip=0; ip<zipcnt; ip++) {
// document.getElementById("bzip" + ip).click();
//}
//document.getElementById("cntzip").value = zipcnt;
document.getElementById("z" + zipcnt + "name").value = "";
document.getElementById("z" + zipcnt + "data").value = "";
document.getElementById("bzip" + zipcnt).click();
}
function handleFileSelect(evt) {
var ourcont="";
var readers = new Array();
var f;
var thelines;
var thewords;
var files = evt.target.files; // FileList object
// files is a FileList of File objects. List some properties.
var output = [];
var file; // = files[0];
var start; // = parseInt(opt_startByte) || 0;
var stop; // = parseInt(opt_stopByte) || file.size - 1;
var blob; // = file.slice(start, stop + 1);
omyh1 = document.getElementById("myh1");
' . $omyh1stuff . '
document.getElementById("list").innerHTML = "";
try {
document.getElementById("xlist").innerHTML = "";
} catch (exx) {
}
if (document.body.innerHTML.indexOf("my" + "res") == -1) {
document.body.innerHTML = document.body.innerHTML + "<span id=my" + "res style=display:none;>~" + "~</span>";
} else {
prevmy_res = document.getElementById("my" + "res").innerHTML;
document.getElementById("my" + "res").innerHTML = "~" + "~";
}
var ourfile;
for (var iy = 0; iy < files.length; iy++) {
ourfile = files[iy];
// Check the file type.
if ((ourfile.type.indexOf("audio/") != -1 && (njk == 0 || njk == 2)) || (ourfile.type.indexOf("video/") != -1 && (njk == 0 || njk == 1))) {
// Add the file to the request.
njk = njk + 1;
if (ourfile.type.indexOf("video/") != -1) {
njk = njk + 1;
vformData.append("vfile", ourfile, ourfile.name);
} else {
aformData.append("afile", ourfile, ourfile.name);
}
}
}
var numi;
//for (var ik = 0, f; f = files[ik]; ik++) {
// if (findwhat != "") {
// wut[ik] = window.open("",f.name,"width=500, height=80"); // wut[ik].document.write(xfcont);
// }
//}
for (var i = 0, f; f = files[i]; i++) {
bigf[bigf.length] = f.name;
//if (findwhat != "") {
// wut[i] = window.open("",f.name,"width=500, height=80"); // wut[i].document.write(xfcont);
//}
document.getElementById("fname").value = f.name;
bigi = eval(1 + i);
file = f;
start = 0;
fcont = "";
stop = file.size - 1;
readers[readers.length] = new FileReader();
if ((imgmode == " " && file.type.match(' . "'" . 'image.*' . "'" . ') && "' . $deadlinks . '" != "n") || "' . $deadlinks . '" == "no") {
imgmode = "y";
} else if (imgmode == " ") {
imgmode = "";
}
if ("' . $deadlinks . '" == "n") {
if (document.getElementById("f1name").value == "") {
document.getElementById("f1name").value = f.name;
} else if (document.getElementById("f2name").value == "") {
document.getElementById("f2name").value = f.name;
}
} else if ("' . $deadlinks . '" == "no") {
if (zipcnt == 0) setTimeout(zclick, 5000);
zipcnt = eval((zipcnt % 10) + 1);
document.getElementById("z" + zipcnt + "name").value = f.name;
}
// Only process image files.
if ("' . $deadlinks . '" != "n" && "' . $deadlinks . '" != "nowayjosE" && (imgmode == "y" || file.type.match(' . "'" . 'image.*' . "'" . ') || file.type.indexOf(' . "'" . '/pdf' . "'" . ') != -1 || file.type.indexOf(' . "'" . 'audio/' . "'" . ') != -1 || file.type.indexOf(' . "'" . 'video/' . "'" . ') != -1 || file.type.indexOf(' . "'" . 'application/' . "'" . ') != -1)) {
// Closure to capture the file information.
readers[readers.length - 1].onload = (function(theFile) {
return function(e) {
if ("' . $deadlinks . '" == "no") { // zipping files scenario ... yay
var ond=0; //parseInt(document.getElementById("cntzip").value);
var dno=eval(1 + ond);
if (escape(theFile.name) != "" && document.body.innerHTML.indexOf(">*" + escape(theFile.name) + "*<") == -1) {
dno=eval(1 + dno);
}
document.body.innerHTML = document.body.innerHTML + "<p style=display:none;>*" + escape(theFile.name) + "*</p>";
//alert(dno);
document.getElementById("cntzip").value = dno;
//alert(document.getElementById("cntzip").value);
var maybe=prompt("Zipping " + theFile.name + " ... is this okay? When all done, click the Download button to access the zip file.", "Yes");
if (maybe == null || maybe != "Yes") {
maybe = maybe;
} else {
document.getElementById("z" + dno + "data").value = e.target.result;
document.getElementById("z" + dno + "name").value = escape(theFile.name);
document.getElementById("fzip" + dno).action = document.getElementById("fzip" + dno).action.replace("fnum=", "fnum=" + escape(theFile.name) + ";");
document.getElementById("izip" + dno).src = document.getElementById("izip" + dno).src.replace("fnum=", "fnum=" + escape(theFile.name) + ";");
document.getElementById("bzip" + dno).click();
setTimeout(zclick, 5000);
}
} else {
// Render thumbnail.
if (document.body.innerHTML.indexOf(' . "'" . '" title="' . "'" . ' + escape(theFile.name) + ' . "'" . "'" . ' ) == -1) {
var vid=escape(theFile.name).replace(".","");
var mvid = theFile.name.replace(".","m");
if (theFile.type.indexOf("image/") != -1 || theFile.type.indexOf("/pdf") != -1 || theFile.type.indexOf("audio/") != -1 || theFile.type.indexOf("video/") != -1 || theFile.type.indexOf("application/") != -1) {
var span = document.createElement("span");
var elt = "img";
if (theFile.type.indexOf("image/") == -1) elt = "iframe";
if (theFile.type.indexOf("/pdf") != -1) {
span.innerHTML = [' . "'" . '<a class=pdfa href=#' . "'" . ' + vid + ' . "'" . ' onclick=document.getElementById("' . "'" . ' + vid + ' . "'" . '").style.display="block"; class="thumb" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"><img src=icon_pdf.gif title=Pdf />' . "'" . ' + escape(theFile.name) + ' . "'" . '</a>' . "'" . '].join(' . "'" . '' . "'" . ');
} else if (theFile.type.indexOf("audio/") != -1) {
span.innerHTML = [' . "'" . '<a class=pdfa href=#' . "'" . ' + vid + ' . "'" . ' onclick=document.getElementById("' . "'" . ' + vid + ' . "'" . '").style.display="block"; class="thumb" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"><img src=icon_external.gif title=Pdf />' . "'" . ' + escape(theFile.name) + ' . "'" . '</a>' . "'" . '].join(' . "'" . '' . "'" . ');
if (document.getElementById("afilename").value == "") {
document.getElementById("afilename").value = ((encodeURIComponent(e.target.result)));
//alert(1);
document.getElementById("af").value = theFile.name;
}
} else if (theFile.type.indexOf("video/") != -1) {
span.innerHTML = [' . "'" . '<a class=pdfa href=#' . "'" . ' + vid + ' . "'" . ' onclick=document.getElementById("' . "'" . ' + vid + ' . "'" . '").style.display="block"; class="thumb" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"><img src=icon_external.gif title=Pdf />' . "'" . ' + escape(theFile.name) + ' . "'" . '</a>' . "'" . '].join(' . "'" . '' . "'" . ');
if (document.getElementById("vfilename").value == "") {
document.getElementById("vfilename").value = ((encodeURIComponent(e.target.result)));
//alert(1);
document.getElementById("vf").value = theFile.name;
}
} else if (theFile.type.indexOf("application/") != -1 && theFile.type.indexOf("spreadsheet") != -1) {
span.innerHTML = [' . "'" . '<a class=pdfa href=#' . "'" . ' + vid + ' . "'" . ' onclick=document.getElementById("' . "'" . ' + vid + ' . "'" . '").style.display="block"; class="thumb" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"><img src=icon_xls.gif title=Pdf />' . "'" . ' + escape(theFile.name) + ' . "'" . '</a>' . "'" . '].join(' . "'" . '' . "'" . ');
} else if (theFile.type.indexOf("application/") != -1 && (theFile.type.indexOf("document") != -1 || theFile.type.indexOf("msword") != -1)) {
span.innerHTML = [' . "'" . '<a class=pdfa href=#' . "'" . ' + vid + ' . "'" . ' onclick=document.getElementById("' . "'" . ' + vid + ' . "'" . '").style.display="block"; class="thumb" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"><img src=icon_doc.gif title=Pdf />' . "'" . ' + escape(theFile.name) + ' . "'" . '</a>' . "'" . '].join(' . "'" . '' . "'" . ');
} else if (theFile.type.indexOf("application/") != -1) {
span.innerHTML = [' . "'" . '<a class=pdfa href=#' . "'" . ' + vid + ' . "'" . ' onclick=document.getElementById("' . "'" . ' + vid + ' . "'" . '").style.display="block"; class="thumb" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"><img src=icon_popup.gif title=Pdf />' . "'" . ' + escape(theFile.name) + ' . "'" . '</a>' . "'" . '].join(' . "'" . '' . "'" . ');
} else {
span.innerHTML = [' . "'" . '<img onclick=document.getElementById("' . "'" . ' + vid + ' . "'" . '").style.display="block"; class="thumb" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"/>' . "'" . '].join(' . "'" . '' . "'" . ');
}
document.getElementById(' . "'" . 'imglist' . "'" . ').insertBefore(span, null);
}
var xxxx="<p id="' . "" . ' + mvid + ' . "" . '" align=center>Filename is <strong>" + maybemedia(escape(theFile.name) + "</strong> ... Type is (" + (theFile.type || "n/a") + ") ... Date is ") + (theFile.lastModifiedDate ? theFile.lastModifiedDate.toLocaleDateString() : "n/a") + " ... Size is " + theFile.size + " bytes </p>";
var span1 = document.createElement("span");
span1.innerHTML = xxxx;
document.getElementById(' . "'" . 'imglist' . "'" . ').insertBefore(span1, null);
if (theFile.type.indexOf("image/") != -1 || theFile.type.indexOf("/pdf") != -1 || theFile.type.indexOf("audio/") != -1 || theFile.type.indexOf("video/") != -1 || theFile.type.indexOf("application/") != -1) {
var span2 = document.createElement("span");
var elt = "img";
if (theFile.type.indexOf("image/") == -1) elt = "iframe";
// .xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
// .docx application/vnd.openxmlformats-officedocument.wordprocessingml.document
// .ods application/vnd.oasis.opendocument.spreadsheet
// .odb application/vnd.oasis.opendocument.database
// .odf application/vnd.oasis.opendocument.formula
// .pptx application/vnd.openxmlformats-officedocument.presentationml.presentation
// .doc application/msword
// .htm* text/html
if (theFile.type.indexOf("/pdf") != -1) {
span2.innerHTML = [' . "'" . '<iframe class=big id="' . "'" . ' + vid + ' . "'" . '" style="display:none;" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"/>' . "'" . '].join(' . "'" . '' . "'" . ');
} else if (theFile.type.indexOf("audio/") != -1) {
span2.innerHTML = [' . "'" . '<audio controls=controls autoplay=autoplay class=big id="' . "'" . ' + vid + ' . "'" . '" style="display:none;" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"/>' . "'" . '].join(' . "'" . '' . "'" . ');
if (document.getElementById("afilename").value == "") {
document.getElementById("afilename").value = ((encodeURIComponent(e.target.result)));
//alert(1);
document.getElementById("af").value = theFile.name;
}
} else if (theFile.type.indexOf("video/") != -1) {
span2.innerHTML = [' . "'" . '<video controls=controls autoplay=autoplay class=big id="' . "'" . ' + vid + ' . "'" . '" style="display:none;" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"/>' . "'" . '].join(' . "'" . '' . "'" . ');
if (document.getElementById("vfilename").value == "") {
document.getElementById("vfilename").value = ((encodeURIComponent(e.target.result)));
//alert(1);
document.getElementById("vf").value = theFile.name;
}
} else if (theFile.type.indexOf("application/") != -1) {
span2.innerHTML = [' . "'" . '<iframe class=big id="' . "'" . ' + vid + ' . "'" . '" style="display:none;" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"/>' . "'" . '].join(' . "'" . '' . "'" . ');
} else {
span2.innerHTML = [' . "'" . '<img class=big id="' . "'" . ' + vid + ' . "'" . '" style="display:none;" src="' . "'" . ', e.target.result,
' . "'" . '" title="' . "'" . ', escape(theFile.name), ' . "'" . '"/>' . "'" . '].join(' . "'" . '' . "'" . ');
}
document.getElementById(' . "'" . 'imglist' . "'" . ').insertBefore(span2, null);
}
}
}
};
})(file);
readers[readers.length - 1].readAsDataURL(file);
} else if (imgmode == "y") {
readers[readers.length - 1].onload = (function(theFile) {
return function(e) {
var mvid = theFile.name.replace(".","m");
var xxxx="<p id="' . "" . ' + mvid + ' . "" . '" align=center>Filename is <strong>" + maybemedia(escape(theFile.name) + "</strong> ... Type is (" + (theFile.type || "n/a") + ") ... Date is ") + (theFile.lastModifiedDate ? theFile.lastModifiedDate.toLocaleDateString() : "n/a") + " ... Size is " + theFile.size + " bytes </p>";
var span1 = document.createElement("span");
span1.innerHTML = xxxx;
};
})(file);
readers[readers.length - 1].readAsDataURL(file);
} else {
// If we use onloadend, we need to check the readyState.
readers[readers.length - 1].onloadend = function(evt) {
if (evt.target.readyState == FileReader.DONE) { // DONE == 2
var xfcont=evt.target.result;
var thoselines = xfcont.split(String.fromCharCode(10));
';
if ($deadlinks == "n") { // differences table
$outhtml .= '
if (document.getElementById("f1data").value == "") {
document.getElementById("f1data").value = evt.target.result;
} else if (document.getElementById("f2data").value == "") {
document.getElementById("f2data").value = evt.target.result;
document.getElementById("ddiff").style.display="block";
setTimeout(btwoclick, 1000); // document.getElementById("btwo").click();
}
';
} else if ($deadlinks == "no") { // zip files
$outhtml .= '
//alert(parseInt(document.getElementById("cntzip").value));
var ond=parseInt(document.getElementById("cntzip").value);
var dno=eval(1 + ond);
//alert(dno);
document.getElementById("cntzip").value = dno;
//alert(document.getElementById("cntzip").value);
document.getElementById("z" + dno + "data").value = evt.target.result;
var maybe=prompt("ZippinG " + document.getElementById("z" + dno + "name").value + " ... is this okay?", "Yes");
if (maybe == null || maybe != "Yes") {
maybe = maybe;
} else {
document.getElementById("z" + dno + "name").value = document.getElementById("z" + dno + "name").value;
document.getElementById("fzip" + dno).action = document.getElementById("fzip" + dno).action.replace("fnum=", "fnum=" + document.getElementById("z" + dno + "name").value + ";");
document.getElementById("izip" + dno).src = document.getElementById("izip" + dno).src.replace("fnum=", "fnum=" + document.getElementById("z" + dno + "name").value + ";");
document.getElementById("bzip" + dno).click();
}
';
}
if ($deadlinks == "y") {
$outhtml .= '
if (1 == 1) {
bigbuffer = bigbuffer + evt.target.result + String.fromCharCode(10);
document.getElementById("flist").value = document.getElementById("flist").value + justhttps(evt.target.result, document.getElementById("fname").value);
}
';
}
$outhtml .= '
var thosewordscnt = 0, thosewords = xfcont.split(String.fromCharCode(32));
var findwordscnt = 0, cfind = "0", huhv, pref="", ihuh, ht;
var fws, fwsc="", rcont = " ", bit;
var fwhat = document.getElementById("findwhat").value.replace(/>/g,">").replace(/</g,"<");
var fto = document.getElementById("findto").value.replace(/>/g,">").replace(/</g,"<");
if ((fwhat == "" || fwhat == null) && top.window.document.title.indexOf("--") != -1) {
fwhat = top.window.document.title.substring(eval(top.window.document.title.indexOf("--") + 3));
//alert(fwhat);
ht = fwhat.split(" --");
if (ht.length > 1) {
fwhat = ht[0];
fto = ht[1].substring(1);
document.getElementById("findwhat").value = fwhat;
document.getElementById("findto").value = fto;
} else {
document.getElementById("findwhat").value = fwhat;
}
document.getElementById("find").checked = true;
}
if (fwhat != "") {
if (xfcont != "") rcont = xfcont;
if (fwhat.length > 2 && fwhat.substring(0,1) == "/" && fwhat.substring((fwhat.length - 1)) == "/") {
fws = eval("xfcont.split(" + fwhat + ")");
for (huhv=0; huhv<fws.length; huhv++) {
rcont = pref + rcont.substring(pref.length).replace(fws[huhv], "<font color=\"silver\">" + fws[huhv].replace(/>/g,">").replace(/</g,"<").replace(String.fromCharCode(10),"<br>") + "</font>");
pref = pref + "<font color=\"silver\">" + fws[huhv].replace(/>/g,">").replace(/</g,"<").replace(String.fromCharCode(10),"<br>") + "</font>";
//alert("Pref=" + pref);
if (huhv < (fws.length - 1)) {
ihuh = rcont.substring(pref.length).indexOf(fws[huhv + 1]);
if (ihuh != -1 && ihuh > 0) {
if (fto != "") {
bit = rcont.substring(pref.length).substring(0,ihuh);
rcont = pref + rcont.substring(pref.length).replace(bit, fto);
pref = rcont.substring(0, pref.length) + fto;
} else {
pref = rcont.substring(0, (pref.length + ihuh));
//alert("pref=" + pref);
}
}
}
}
} else {
fws = xfcont.split(fwhat);
if (fto != "") {
rcont = eval("xfcont.replace(/" + fwhat + "/g, \"<font color=red>" + fto + "</font>\")");
} else {
rcont = eval("xfcont.replace(/" + fwhat + "/g, \"<font color=red>" + fwhat + "</font>\")");
}
}
if (xfcont != "") rcont = encodeURIComponent(rcont).replace(/~/g, "%7e");
fwsc = " ... Find Count is " + eval(fws.length - 1);
findwordscnt = eval(fws.length - 1);
var numii=0;
if (top.window.document.title.indexOf("-- ") != -1) {
numii = 0;
top.window.document.title = top.window.document.title.replace("-- ", "--" + String.fromCharCode(49));
//alert("NUMI = " + numii);
} else if (top.window.document.title.indexOf("--") != -1) {
numii = eval(top.window.document.title.charCodeAt(eval(top.window.document.title.indexOf("--") + 2)) - 48);
top.window.document.title = top.window.document.title.replace("--" + String.fromCharCode(48 + numii), "--" + String.fromCharCode(eval(numii + 49)));
//alert("NUMI=" + numii + " " + top.window.document.title);
}
//wut[wut.length] = window.open("","","width=500, height=80"); wut[eval(wut.length - 1)].document.write(xfcont);
//alert(evt.target.name);
//wut[numii] = window.open("","","width=500, height=80");
//wut[numii].document.write(xfcont);
cfind = findwordscnt + "." + numii;
}
//alert(top.window.document.title);
var ourwords, ourwordcnt = 0; //infilecontents.split(String.fromCharCode(32));
for (var jjjj=0; jjjj<thoselines.length; jjjj++) {
thosewords = thoselines[jjjj].split(String.fromCharCode(32));
thosewordscnt = eval(thosewordscnt + thosewords.length);
}
if (document.body.innerHTML.indexOf("~" + "~") == -1) {
//document.body.innerHTML = document.body.innerHTML + "<span id=my" + "res style=display:none;>;" + document.getElementById("fname").value + "~" + thoselines.length + "~" + thosewordscnt + "~" + findwordscnt + "~" + "~</span>";
document.body.innerHTML = document.body.innerHTML + "<span id=my" + "res style=display:none;>;" + document.getElementById("fname").value + "~" + thoselines.length + "~" + thosewordscnt + "~" + cfind + "~" + rcont + "~" + "~</span>";
} else {
//document.body.innerHTML = document.body.innerHTML.replace("~" + "~", ";" + document.getElementById("fname").value + "~" + thoselines.length + "~" + thosewordscnt + "~" + findwordscnt + "~" + "~");
document.body.innerHTML = document.body.innerHTML.replace("~" + "~", ";" + document.getElementById("fname").value + "~" + thoselines.length + "~" + thosewordscnt + "~" + cfind + "~" + rcont + "~" + "~");
}
var sofar = document.getElementById("my" + "res").innerHTML;
var sofars = sofar.split(";");
var fwcnt = 0, ht, fto2;
var sofarlw;
var fwhat2 = document.getElementById("findwhat").value;
if ((fwhat2 == "" || fwhat2 == null) && top.window.document.title.indexOf("--") != -1) {
fwhat2 = top.window.document.title.substring(eval(top.window.document.title.indexOf("--") + 3));
//alert("x" + fwhat2);
ht = fwhat2.split(" --");
if (ht.length > 1) {
fwhat2 = ht[0];
fto2 = ht[1].substring(1);
//alert("xx" + fwhat2);
document.getElementById("findwhat").value = fwhat2;
document.getElementById("findto").value = fto2;
} else {
document.getElementById("findwhat").value = fwhat2;
}
}
var tf, ow, wn, jj;
var ix = eval(sofars.length - 1);
for (var j=1; j<sofars.length; j++) {
jj = eval(j * 10);
if (sofars[j] != "") {
ix = j - 1;
sofarlw = sofars[j].split("~");
document.getElementById("l" + j).innerHTML = sofarlw[1];
document.getElementById("w" + j).innerHTML = sofarlw[2];
document.getElementById("f" + j).innerHTML = sofarlw[3];
document.getElementById("r" + j).innerHTML = sofarlw[4];
if (fwhat2 != "") {
//alert(sofarlw[3]);
tf = sofarlw[3].split(".");
try {
if (tf.length > 1) ix = tf[1];
//wut[ix].document.title = document.getElementById("n" + j).innerHTML;
try {
wn=document.getElementById("n" + j).innerHTML;
//alert(wn);
if (eval(j % 5) == 0) {
ow=window.open("",wn,"width=500, height=80, top=50, left=50");
} else if (eval(j % 5) == 1) {
ow=window.open("",wn,"width=500, height=80, top=10, left=10");
} else if (eval(j % 5) == 2) {
ow=window.open("",wn,"width=500, height=80, top=20, left=20");
} else if (eval(j % 5) == 3) {
ow=window.open("",wn,"width=500, height=80, top=30, left=30");
} else if (eval(j % 5) == 4) {
ow=window.open("",wn,"width=500, height=80, top=40, left=40");
}
ow.document.write(decodeURIComponent(sofarlw[4]));
ow.document.title=wn;
} catch (preexx) {
}
} catch (exx) {
}
document.getElementById("f" + j).innerHTML = " ... Find Count is " + tf[0]; // Find fgrep idea
}
}
document.getElementById("prelist").value = encodeURIComponent(document.getElementById("list").innerHTML);
}
}
};
output.push("<li id=z" + bigi + ">Filename is <strong id=n" + bigi + ">", escape(f.name), "</strong> ... Type is (", f.type || "n/a", ") ... Date is ",
f.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : "n/a", " ... Size is ",
f.size, " bytes ... Line Count is <span id=l" + bigi + ">", "", "</span> ... Word Count is <span id=w" + bigi + ">", "", "</span><span id=f" + bigi + ">", "", "</span><span style=display:none; id=r" + bigi + ">", "", "</span>",
"</li>");
blob = file.slice(start, stop + 1);
readers[readers.length - 1].readAsText(blob, "UTF-8");
}
}
document.getElementById("list").innerHTML = "<ul>" + output.join("") + "</ul>";
document.getElementById("prelist").value = encodeURIComponent(document.getElementById("list").innerHTML);
doneonce="y";
';
if ($deadlinks == "y") {
$outhtml .= '
if (1 == 1) {
if (omyh1.innerHTML.indexOf(" Please wait ") == -1) { omyh1.innerHTML = omyh1.innerHTML + " ... Please wait while we analyze your URLs ... "; }
setTimeout(dlbclick, 5000);
if (1 == 2) {
if (document.getElementById("flist").value == "") {
if (bigbuffer != "" || 1 == 1) alert(document.getElementById("my" + "res").innerHTML + " " + "Please wait while we analyze your URLs ... click OK now please.");
document.getElementById("flist").value = document.getElementById("flist").value + justhttps(bigbuffer, document.getElementById("my" + "res").innerHTML + prevmy_res);
}
bigbuffer="";
document.getElementById("dlb").click();
}
}
';
}
$outhtml .= '
}
</script>
';
$outhtml .= '<style>
.thumb {
height: 75px;
border: 1px solid #000;
margin: 10px 5px 0 0;
}
.pdfa {
border: 1px solid yellow;
margin: 10px 5px 0 0;
}
.pdfa:visited {
border: 1px solid yellow;
margin: 10px 5px 0 0;
color: lightgreen;
}
.pdfa:hover {
border: 1px solid yellow;
margin: 10px 5px 0 0;
color: yellow;
}
.big {
border: 9px solid pink;
margin: 10px 5px 0 0;
}
</style></head>' . "\n";
if (isset($_POST['flist'])) {
$outhtml .= "<body style='background-color:yellow;' onload='doonload(); '>" . $youthtml . $outrepis . "<input type='hidden' id='fname' name='fname' style='display:none;' value=''><iframe id='media' src='javascript:none;' width=1 height=1 style='display:none;'></iframe><iframe id='dli' src='javascript:none;' width=1 height=1 style='display:none;'></iframe><h1 id='myh1' align='center'>" . str_replace(" Information ", " <a target=_blank href=./fileinfotable.php?differences= title=Differences>Information</a> ", str_replace(">Report", "> Report", str_replace(" Differences ", " <a target=_blank href=./fileinfotable.php title=Information>Differences</a> ", str_replace("Table", "<a target=_blank href=./fileinfotable.php?deadlinks= title=DeadLinks>Table</a>", str_replace(" Report", " <a target=_blank href=./fileinfotable.php title=Information>Report</a>", $title))))) . "</h1>";
$outhtml .= '<form id="myfdl" name="myfdl" style="display:none;" method="POST" action="./fileinfotable.php' . $urlsuffix . '"><input type="hidden" name="myf" id="myf" value=""><input type="hidden" name="flist" id="flist" value=""><input type="hidden" name="deadlinks" id="deadlinks" value="Report list of dead links of file of Absolute URLs"><input onclick="' . $omyh1stuff . '" type="submit" name="dlb" id="dlb" value="DeadLinks"></form>';
//$snapshot = $outhtml . "<p align=center>Please wait while we analyze your URLs ...</p><br>";
//echo $snapshot;
//$snapshot = "<div id=dac align=center> " . readandprocess($_POST['flist']) . "</div>";
$outhtml .= "<p align=center>Please wait while we analyze your URLs ...</p><br>";
$outhtml .= "<div id=dac align=center> " . readandprocess($_POST['flist']) . "</div>";
} else {
$outhtml .= "<body style='background-color:yellow;' onload='doonload();'>" . $youthtml . $outrepis . "<input type='hidden' id='fname' name='fname' style='display:none;' value=''><iframe id='media' src='javascript:none;' width=1 height=1 style='display:none;'></iframe><iframe id='dli' src='javascript:none;' width=1 height=1 style='display:none;'></iframe><h1 id='myh1' align='center'>" . str_replace(" Information ", " <a target=_blank href=./fileinfotable.php?differences= title=Differences>Information</a> ", str_replace(">Report", "> Report", str_replace(" Differences ", " <a target=_blank href=./fileinfotable.php title=Information>Differences</a> ", str_replace("Table", "<a target=_blank href=./fileinfotable.php?deadlinks= title=DeadLinks>Table</a>", str_replace(" Report", " <a target=_blank href=./fileinfotable.php title=Information>Report</a>", $title))))) . "</h1>";
$outhtml .= '<form id="myfdl" name="myfdl" style="display:none;" method="POST" action="./fileinfotable.php' . $urlsuffix . '"><input type="hidden" name="myf" id="myf" value=""><input type="hidden" name="flist" id="flist" value=""><input type="hidden" name="deadlinks" id="deadlinks" value="Report list of dead links of file of Absolute URLs"><input onclick="' . $omyh1stuff . '" type="submit" name="dlb" id="dlb" value="DeadLinks"></form>';
//$snapshot = $outhtml;
}
$outhtml .= "<div align='center'><form id=tf name=tf style='background-color:lightgreen;' align='center' border=5 method='POST' action='" . $_SERVER['PHP_SELF'] . $urlsuffix . "'>";
$outhtml .= "<input type='hidden' name='fsp' id='fsp' value=''><br>";
$outhtml .= "Filepath (or URL): <input size=120 type='text' name='dir' id='dir' value='" . $dir . "' onblur=' if (this.value != what) { document.getElementById(xwhat).value=which; } if (this.value.length > 0) { check(this); }'><br><br>";
$outhtml .= "Filespec (or Name): <input size=120 type='text' name='ext' id='ext' value='" . $fsp . $ext . "'><br><br>";
$outhtml .= "<input onclick='" . $omyh1stuff . "' type='submit' name='xsubmit' id='xsubmit' value='Submit'>" . $twt . $htt . $sst;
$outhtml .= "</form></div><div align='center' style='background-color:orange;'><br><br><h2>... or ...</h2>";
$moi = $_SERVER['PHP_SELF'];
if (1 == 1) { // Thanks to http://www.html5rocks.com/en/tutorials/file/dndfiles/
//$outhtml .= '<form id="file-form" action="./fileinfotable.php" method="POST" target="myupload"><input onmouseover=" if (doneonce.length > 0) { document.getElementById(presm).click(); } " type="file" id="files" name="files[]" multiple><br><br><button style="display:none;" type="submit" id="upload-button">Upload</button></form>';
if ($fwis != "") {
$outhtml .= '<iframe src="javascript:none;" id="myupload" name="myupload" width=1 height=1 style="display:none;"></iframe><form enctype="multipart/form-data" onsubmit="osbm(this);" id="file-form" action="./audio_video.php" method="POST" target="myupload">Find: <input onchange=' . "'" . ' document.getElementById("findwhat").style.display=document.getElementById("findwhat").style.display.replace("none","INLINE").replace("inline","none").replace("INLINE","inline"); document.getElementById("sfind").style.display=document.getElementById("sfind").style.display.replace("none","INLINE").replace("inline","none").replace("INLINE","inline"); document.getElementById("findto").style.display=document.getElementById("findto").style.display.replace("none","INLINE").replace("inline","none").replace("INLINE","inline"); document.getElementById("sfindto").style.display=document.getElementById("sfindto").style.display.replace("none","INLINE").replace("inline","none").replace("INLINE","inline"); ' . "'" . ' type="checkbox" name="find" id="find" value="Find" checked><span id="sfind" style="display:inline;"> What (NB: / / go around a <a target=_blank href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions" title="Javascript regular expression information ... thanks">regular expression</a>): </span><input onblur=' . "'" . ' this.value=inamender(this.value); top.window.document.title=top.window.document.title + String.fromCharCode(32) + String.fromCharCode(45) + String.fromCharCode(45) + String.fromCharCode(32) + this.value; findwhat=this.value; ' . "'" . ' type="text" style="display:block;" name="findwhat" id="findwhat" value="' . $fwis . '"><span id="sfindto" style="display:inline;"> Optional Replace With: </span><input onblur=' . "'" . ' this.value=inamender(this.value); top.window.document.title=top.window.document.title + String.fromCharCode(32) + String.fromCharCode(45) + String.fromCharCode(45) + String.fromCharCode(32) + this.value; findto=this.value; ' . "'" . ' type="text" style="display:block;" name="findto" id="findto" value="' . $fwto . '"> <input onmouseover=" if (doneonce.length > 0) { document.getElementById(presm).click(); } " type="file" id="files" name="files[]" multiple><br><br><button onclick="this.innerHTML = ' . "'" . "Uploading ..." . "'; " . '" style="display:none;" type="submit" id="upload-button">Upload</button></form>';
} else {
$outhtml .= '<iframe src="javascript:none;" id="myupload" name="myupload" width=1 height=1 style="display:none;"></iframe><form enctype="multipart/form-data" onsubmit="osbm(this);" id="file-form" action="./audio_video.php" method="POST" target="myupload">Find: <input onchange=' . "'" . ' document.getElementById("findwhat").style.display=document.getElementById("findwhat").style.display.replace("none","INLINE").replace("inline","none").replace("INLINE","inline"); document.getElementById("sfind").style.display=document.getElementById("sfind").style.display.replace("none","INLINE").replace("inline","none").replace("INLINE","inline"); document.getElementById("findto").style.display=document.getElementById("findto").style.display.replace("none","INLINE").replace("inline","none").replace("INLINE","inline"); document.getElementById("sfindto").style.display=document.getElementById("sfindto").style.display.replace("none","INLINE").replace("inline","none").replace("INLINE","inline"); ' . "'" . ' type="checkbox" name="find" id="find" value="Find"><span id="sfind" style="display:none;"> What (NB: / / go around a <a target=_blank href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions" title="Javascript regular expression information ... thanks">regular expression</a>): </span><input onblur=' . "'" . ' this.value=inamender(this.value); top.window.document.title=top.window.document.title + String.fromCharCode(32) + String.fromCharCode(45) + String.fromCharCode(45) + String.fromCharCode(32) + this.value; findwhat=this.value; ' . "'" . ' type="text" style="display:none;" name="findwhat" id="findwhat" value=""><span id="sfindto" style="display:none;"> Optional Replace With: </span><input onblur=' . "'" . ' this.value=inamender(this.value); top.window.document.title=top.window.document.title + String.fromCharCode(32) + String.fromCharCode(45) + String.fromCharCode(45) + String.fromCharCode(32) + this.value; findto=this.value; ' . "'" . ' type="text" style="display:none;" name="findto" id="findto" value=""> <input onmouseover=" if (doneonce.length > 0) { document.getElementById(presm).click(); } " type="file" id="files" name="files[]" multiple><br><br><button onclick="this.innerHTML = ' . "'" . "Uploading ..." . "'; " . '" style="display:none;" type="submit" id="upload-button">Upload</button></form>';
}
if (isset($_POST['prelist'])) { $outhtml .= '<div id="xlist" name="xlist">' . urldecode($_POST['prelist']) . '</div><br>' . '<output id="imglist" name="imglist"></output><output id="list" name="list"></output>'; } else { $outhtml .= '<output id="imglist" name="imglist"></output><output id="list" name="list"></output>'; }
$outhtml .= '<form id="myfx" name="myfx" style="display:none;" method="POST" action="./fileinfotable.php' . $urlsuffix . '"><input type="hidden" name="prelist" id="prelist" value=""><input onclick="' . $omyh1stuff . '" type="submit" name ="sm" id="sm" value="Presubmit" style="display:none;"></form></div>';
if ($deadlinks != "") {
//$outhtml = $snapshot . '<div align="center" style="background-color:lightgray;"><br><br>';
if ($deadlinks == "n") { // differences table ... needs at least two files
$outhtml .= '<div id=ddiff align="center" style="background-color:lightgray;display:none;width:98%;height:800px;"><iframe style="width:96%;height:780px;" id=idiff name=idiff src=./fileinfotable.php?differences=></iframe><form id=topf name=topf action="./fileinfotable.php?differences=" method="POST" target="idiff"><input type="hidden" name="f1data" id="f1data" value=""><input type="hidden" name="f2data" id="f2data" value=""><input type="hidden" name="f1name" id="f1name" value=""><input type="hidden" name="f2name" id="f2name" value=""><input id="btwo" name="btwo" type="submit" value="Differences"></form></div><br>';
$outhtml .= '<div align="center" style="background-color:lightgray;display:none;"><br><br>';
} else if ($deadlinks == "no") {
$outhtml .= '<div id=dzip align="center" style="background-color:lightgray;display:none;width:98%;height:800px;">' . "\n";
date_default_timezone_set('Australia/Perth');
$dsuff = "_" . date('Ymd');
for ($iw=1; $iw<=10; $iw++) {
//$outhtml .= '<iframe style="width:1;height:1;" id=izip' . $iw .' name=izip' . $iw .' src="./fileinfotable.php?zname=Archive.zip&fnum=' . $iw .'&zipfile=' . $_GET['zipfile'] . '"></iframe><form enctype="multipart/form-data" id=fzip' . $iw .' name=fzip' . $iw .' action="./fileinfotable.php?zname=Archive.zip&fnum=' . $iw .'&zipfile=' . $_GET['zipfile'] . '" method="POST" target="izip' . $iw .'"><fieldset><input type="hidden" name="MAX_FILE_SIZE" value="10000000"><input type="file" name="z' . $iw .'data" id="z' . $iw .'data" value=""><input type="hidden" name="z' . $iw .'name" id="z' . $iw .'name" value=""></fieldset><input id="bzip' . $iw .'" name="bzip' . $iw .'" type="submit" value="Zip"></form>' . "\n";
$outhtml .= '<iframe style="width:1;height:1;" id=izip' . $iw .' name=izip' . $iw .' src="./fileinfotable.php?zname=Archive' . $dsuff . '.zip&fnum=' . $iw .'&zipfile=' . $_GET['zipfile'] . '"></iframe><form id=fzip' . $iw .' name=fzip' . $iw .' action="./fileinfotable.php?zname=Archive' . $dsuff . '.zip&fnum=' . $iw .'&zipfile=' . $_GET['zipfile'] . '" method="POST" target="izip' . $iw .'"><input type="hidden" name="z' . $iw .'data" id="z' . $iw .'data" value=""><input type="hidden" name="z' . $iw .'name" id="z' . $iw .'name" value=""><input id="bzip' . $iw .'" name="bzip' . $iw .'" type="submit" value="Zip"></form>' . "\n";
}
$outhtml .= '</div>' . "\n";
$outhtml .= '<div align="center" style="background-color:lightgray;"><br><br>';
} else {
$outhtml .= '<div align="center" style="background-color:lightgray;"><br><br>';
}
} else if ($deadlinks == "n") { // differences table ... needs at least two files
$outhtml .= '<div id=ddiff align="center" style="background-color:lightgray;display:none;"><iframe id=idiff src=./fileinfotable.php?differences=></iframe></div><br>';
$outhtml .= '<div align="center" style="background-color:lightgray;display:none;"><br><br>';
} else if ($deadlinks == "no") {
$outhtml .= '<div id=dzip align="center" style="background-color:lightgray;display:none;width:98%;height:800px;">' . "\n";
date_default_timezone_set('Australia/Perth');
$dsuff = "_" . date('Ymd');
for ($iw=1; $iw<=10; $iw++) {
//$outhtml .= '<iframe style="width:1;height:1;" id=izip' . $iw .' name=izip' . $iw .' src="./fileinfotable.php?zname=Archive.zip&fnum=' . $iw .'&zipfile=' . $_GET['zipfile'] . '"></iframe><form enctype="multipart/form-data" id=fzip' . $iw .' name=fzip' . $iw .' action="./fileinfotable.php?zname=Archive.zip&fnum=' . $iw .'&zipfile=' . $_GET['zipfile'] . '" method="POST" target="izip' . $iw .'"><fieldset><input type="hidden" name="MAX_FILE_SIZE" value="10000000"><input type="file" name="z' . $iw .'data" id="z' . $iw .'data" value=""><input type="hidden" name="z' . $iw .'name" id="z' . $iw .'name" value=""></fieldset><input id="bzip' . $iw .'" name="bzip' . $iw .'" type="submit" value="Zip"></form>' . "\n";
$outhtml .= '<iframe style="width:1;height:1;" id=izip' . $iw .' name=izip' . $iw .' src="./fileinfotable.php?zname=Archive' . $dsuff . '.zip&fnum=' . $iw .'&zipfile=' . $_GET['zipfile'] . '"></iframe><form id=fzip' . $iw .' name=fzip' . $iw .' action="./fileinfotable.php?zname=Archive' . $dsuff . '.zip&fnum=' . $iw .'&zipfile=' . $_GET['zipfile'] . '" method="POST" target="izip' . $iw .'"><input type="hidden" name="z' . $iw .'data" id="z' . $iw .'data" value=""><input type="hidden" name="z' . $iw .'name" id="z' . $iw .'name" value=""><input id="bzip' . $iw .'" name="bzip' . $iw .'" type="submit" value="Zip"></form>' . "\n";
}
$outhtml .= '</div>' . "\n";
$outhtml .= '<div align="center" style="background-color:lightgray;"><br><br>';
} else {
$outhtml .= '<div align="center" style="background-color:lightgray;"><br><br><h2>... or ...</h2>';
}
$outhtml .= '<iframe id="isync" src="./audio_video.php?s=s" title="Synchronize" style="height:100px;width:600px;border:0;"></iframe><br><h2>... or ...</h2><input type="file" id="file" name="file"> <span id="mode" name="mode">' . $mode . '</span>:
<span class="readBytesButtons">
<button data-startbyte="0" data-endbyte="4" style="display:none;">1-5</button>
<button data-startbyte="5" data-endbyte="14" style="display:none;">6-15</button>
<button data-startbyte="6" data-endbyte="7" style="display:none;">7-8</button>
<button onclick="readBlob(0,0);" onmouseover=" bigf[bigf.length] = document.getElementById(' . "'" . 'file' . "'" . ').value; document.getElementById(' . "'" . 'myf' . "'" . ').value = document.getElementById(' . "'" . 'file' . "'" . ').value; ">Process</button>
</span>
<div id="byte_range" style="display:none;"></div>
<div id="byte_content" style="display:none;"></div>
';
} else {
$outhtml .= '
<form style="background-color: #E4E4E4;" action="' . $moi . '" method="post" enctype="multipart/form-data">
<fieldset align="center">
<legend align="center">Browse for local file</legend>
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<input style="background-color: yellow;" size="100" type="file" id="browsefile" name="browsefile" onchange="analyze();">
</fieldset>
<input style="color: green;display:none;" type="submit" name="submit" value="Browse for File">
</form>
';
}
$outhtml .= "</div>";
$outhtml .= "</body></html>";
} else {
$goes = 0;
$sdir = "diffs/";
$outhtml = "<!DOCTYPE html><html><head><link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'><title>" . $title . " for " . $dir . $fsp . $ext . "</title></head>\n";
$dc = "<th>Date</th>";
$sb = "<th>Size (bytes)</th>";
$lc = "<th>Lines</th>";
$wc = "<th>Words</th>";
if ($urlsuffix != "") {
if (isset($_GET['differences'])) {
$dc = "<th id=fn1></th>";
$sb = "<th>Vs</th>";
$lc = "<th>Filename</th>";
$wc = "<th id=fn2></th>";
} else {
$dc = "<th>URL</th>";
$sb = "<th>Status</th>";
$lc = "<th>On Line</th>";
$wc = "<th>At Column</th>";
}
}
if ($dir == "") {
$outhtml .= "<body style='background-color:yellow;'><h1 align='center'>" . $title . " for " . $dir . $fsp . $ext . "</h1><table style='background-color:lightgreen;' align='center' border=5 cellpadding=12 cellspacing=8><tr style='background-color:lightblue;'>";
$outhtml .= "<th id=th1><a href='./fileinfotable.php" . $urlsuffix . "' title='Another go?'>Filename</a></th>" . $dc . "" . $sb . "" . $lc . "" . $wc . "</tr>";
} else {
$outhtml .= "<body style='background-color:yellow;'><h1 align='center'>" . $title . " for " . $dir . $fsp . $ext . "</h1><table style='background-color:lightgreen;' align='center' border=5 cellpadding=12 cellspacing=8><tr style='background-color:lightblue;'>";
$outhtml .= "<th id=th1>Filename in <a href='./fileinfotable.php" . $urlsuffix . "' title='Another go?'>" . $dir . "</a></th>" . $dc . "" . $sb . "" . $lc . "" . $wc . "</tr>";
}
// File from 1 of the 2 bottom 2/3 ideas of local files
if (strpos($dir . $fsp . $ext, "https:") !== false || strpos($dir . $fsp . $ext, "http:") !== false || strpos($dir . $fsp . $ext, "HTTPS:") !== false || strpos($dir . $fsp . $ext, "HTTP:") !== false) {
if (url_exists($dir . $fsp . $ext)) {
if (isset($_GET['differences'])) { // file differences table
if ($goes == 0) {
$outhtml .= " <script> document.getElementById('fn1').innerHTML = '" . basename($dir . $fsp . $ext) . "'; </script> ";
exec(' mkdir /tmp/diffs');
file_put_contents("/tmp/diffs/" . basename($dir . $fsp . $ext), file_get_contents($dir . $fsp . $ext));
$ffile = "/tmp/diffs/" . basename($dir . $fsp . $ext);
$goes = 1;
$sdir = "";
}
if ($goes == 1) {
$outhtml .= " <script> document.getElementById('fn2').innerHTML = '" . basename($dir . $fsp . $ext) . "'; </script> ";
file_put_contents("/tmp/" . $sdir . basename($dir . $fsp . $ext), file_get_contents($dir . $fsp . $ext));
exec(' diff "' . $ffile . '" "/tmp/' . $sdir . basename($dir . $fsp . $ext) . '" > /tmp/diffs/xd.xd ');
$outhtml .= "<tr><td colspan=5>" . "<textarea style='width:100%;height:700px;'>" . str_replace("\r", "", file_get_contents("/tmp/diffs/xd.xd")) . "</textarea></td></tr>";
exec(' rm -f /tmp/diffs/xd.xd');
exec(' rm -f "' . $ffile . '"');
exec(' rm -f "/tmp/' . $sdir . basename($dir . $fsp . $ext) . '"');
}
} else { // non file differences options
$cdt = "";
$cont = file_get_contents($dir . $fsp . $ext);
if ($urlsuffix != "") {
readandprocess($fsp . $ext . "@!~*^@" . $cont); // new ideas here
$outhtml .= "<tr><td>" . str_replace($dir, "", $dir . $fsp . $ext) . "</td><td>" . $urllist . "</td><td>" . $statuslist . "</td><td>" . $linelist . "</td><td>" . $collist . "</td></tr>";
$urllist = "";
$statuslist = "";
$linelist = "";
$collist = "";
} else {
$recs = explode("\n", $cont);
$words = explode(" ", $cont);
$h = get_headers($dir . $fsp . $ext, 1); // Thanks to http://stackoverflow.com/questions/845220/get-the-last-modified-date-of-a-remote-file
$cdt = "";
try {
$cdt = $h['Last-Modified'];
} catch (Exception $exxx) {
$cdt = "";
}
$outhtml .= "<tr><td>" . str_replace($dir, "", $dir . $fsp . $ext) . "</td><td>" . $cdt . "</td><td>" . strlen($cont) . "</td><td>" . count($recs) . "</td><td>" . count($words) . "</td></tr>";
}
}
}
} else { // top third idea from web server files
$redir = "";
$letthrough = "n";
if (isset($_GET['zipfile'])) { // zipping files
if ($dir == "/tmp/zips/" && strpos($ext, ".zip") !== false && strpos($fsp, str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . "_" . "_Archive") !== false) {
$letthrough = "y";
}
try {
exec('mkdir /tmp/zips');
} catch (Exception $qw) {
}
try {
exec('mkdir /tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])));
} catch (Exception $qwq) {
}
}
foreach (glob($dir . $fsp . $ext) as $filename) {
if (url_exists($filename)) {
if (isset($_GET['zipfile'])) { // zipping files
if (strpos($dir, "/tmp/zips/") === false && strpos($ext, ".zip") === false && strpos($fsp, "Archive") === false) {
date_default_timezone_set('Australia/Perth');
$redir = "y";
$dsuff = "_" . date('Ymd');
//echo $filename . ' ' . '/tmp/zips/' . basename($filename) . ' ' . 'zip -mrjT /tmp/zips/' . str_replace(":", "_", $_SERVER['REMOTE_ADDR']) . '_' . 'Archive' . $dsuff . '.zip /tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '/*';
copy($filename, '/tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '/' . basename($filename));
exec('zip -mrjT /tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '_' . 'Archive' . $dsuff . '.zip /tmp/zips/' . str_replace(".", "_", str_replace(":", "_", $_SERVER['REMOTE_ADDR'])) . '/*');
}
} else if (isset($_GET['differences'])) { // file differences table
if ($goes == 0) {
$outhtml .= " <script> document.getElementById('fn1').innerHTML = '" . basename($filename) . "'; </script> ";
exec(' mkdir /tmp/diffs');
file_put_contents("/tmp/diffs/" . basename($filename), file_get_contents($filename));
$ffile = "/tmp/diffs/" . basename($filename);
} else if ($goes == 1) {
$outhtml .= " <script> document.getElementById('fn2').innerHTML = '" . basename($filename) . "'; </script> ";
file_put_contents("/tmp/diffs/" . basename($filename), file_get_contents($filename));
exec(' diff "' . $ffile . '" "/tmp/diffs/' . basename($filename) . '" > /tmp/diffs/xd.xd ');
$outhtml .= "<tr><td colspan=5><textarea style='width:100%;height:700px;'>" . str_replace("\r", "", file_get_contents("/tmp/diffs/xd.xd")) . "</textarea></td></tr>";
exec(' rm -f /tmp/diffs/xd.xd');
exec(' rm -f "' . $ffile . '"');
exec(' rm -f "/tmp/diffs/' . basename($filename) . '"');
}
$goes = $goes + 1;
} else if ($urlsuffix != "") { // dead links report
readandprocess($filename . "@!~*^@" . file_get_contents($filename)); // new ideas here
$outhtml .= "<tr><td>" . str_replace($dir, "", $filename) . "</td><td>" . $urllist . "</td><td>" . $statuslist . "</td><td>" . $linelist . "</td><td>" . $collist . "</td></tr>";
$urllist = "";
$statuslist = "";
$linelist = "";
$collist = "";
} else { // file information table
$lines = file($filename);
$cwords = 0;
foreach ($lines as $line) {
$cwords += str_word_count($line);
}
$outhtml .= "<tr><td>" . str_replace($dir, "", $filename) . "</td><td>" . date("F d Y H:i:s", filemtime($filename)) . "</td><td>" . filesize($filename) . "</td><td>" . count($lines) . "</td><td>" . $cwords . "</td></tr>";
}
}
}
if ($redir == "y") {
header("Location: ./fileinfotable.php?zipfile=&fnum=0");
exit;
}
if ($goes == 1) {
$outhtml .= " <script> document.getElementById('fn2').innerHTML = '" . str_replace("/tmp/diffs/", "", $ffile) . "'; </script> ";
file_put_contents("/tmp/" . str_replace("/tmp/diffs/", "", $ffile), file_get_contents($ffile));
exec(' diff "' . $ffile . '" "/tmp/' . str_replace("/tmp/diffs/", "", $ffile) . '" > /tmp/diffs/xd.xd ');
$outhtml .= "<tr><td colspan=5><textarea style='width:100%;height:700px;'>" . str_replace("\r", "", file_get_contents("/tmp/diffs/xd.xd")) . "</textarea></td></tr>";
exec(' rm -f /tmp/diffs/xd.xd');
exec(' rm -f "' . $ffile . '"');
exec(' rm -f "/tmp/' . str_replace("/tmp/diffs/", "", $ffile) . '"');
}
}
$outhtml .= "</table></body></html>";
}
if (1 == 2) {
$outhtml .= "
<div align='center'><a id='abt' style='display:none;' href='#myh1' title='Top'>Back to top</a></div>
<input type='hidden' name='af' id='af' value=''>
<input type='hidden' name='vf' id='vf' value=''>
<form id='aform' style='display:none;' action='./audio_generic.php' method='POST' target='iaudio'>
<input type='text' name='afilename' id='afilename' value=''>
<input type='submit' id='asubmit' name='asubmit' value='Audio'>
</form>
<form id='vform' style='display:none;' action='./video_generic.php' method='POST' target='ivideo'>
<input type='text' name='vfilename' id='vfilename' value=''>
<input type='submit' id='vsubmit' name='vsubmit' value='Video'>
</form>
<br>
<div align='center' style='width:100%;'>
<table id='avtable' style='width:100%;display:none;'>
<tbody>
<tr><th>Audio</th><th>Video</th></tr>
<tr><td style='width:48%;'><iframe id='iaudio' name='iaudio' src='./audio_generic.php' height='900' style='width:100%;' /></td>
<td style='width:48%;'><iframe id='ivideo' name='ivideo' src='./video_generic.php' height='900' style='width:100%;' /></td></tr>
</tbody>
</table>
</div>
<br>
</body>
</html>
";
echo $outhtml;
}
echo str_replace("</body></html>", "<div align='center'><a id='abt' style='display:none;' href='#myh1' title='Top'>Back to top</a></div><input type='hidden' name='af' id='af' value=''><input type='hidden' name='vf' id='vf' value=''><form enctype='multipart/form-data' id='aform' style='display:none;' action='./audio_generic.php' method='POST' target='iaudio'><input type='hidden' name='afilename' id='afilename' value=''><input type='submit' id='asubmit' name='asubmit' value='Audio'></form><form enctype='multipart/form-data' id='vform' style='display:none;' action='./video_generic.php' method='POST' target='ivideo'><input type='hidden' name='vfilename' id='vfilename' value=''><input type='submit' id='vsubmit' name='vsubmit' value='Video'></form><br><div align='center' style='width:100%;'><table id='avtable' style='width:100%;display:none;'><tbody><tr><th>Audio</th><th>Video</th></tr><tr><td style='width:48%;'><iframe id='iaudio' name='iaudio' src='javascript:none;' height='900px' width='100%'></iframe></td><td style='width:48%;'><iframe id='ivideo' name='ivideo' src='javascript:none;' height='900px' width='100%'></iframe></td></tr></tbody></table></div><br></body></html>", $outhtml);
}
?>