<?php
// flowchart.php
// RJM Programming 
// January, 2019
// Add accountability to flowchart.html

$phpcont="";
$getpostfound=false;
foreach( $_POST as $stuff ) {
  $getpostfound=true;
}
foreach( $_GET as $stuff ) {
  $getpostfound=true;
}

function server_remote_addr() {
    $rma = $_SERVER['REMOTE_ADDR'];
    $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
    // you can add different browsers with the same way ..
    if(preg_match('/(chromium)[ \/]([\w.]+)/', $ua))
            $rma = '000000'.$rma;
    elseif(preg_match('/(chrome)[ \/]([\w.]+)/', $ua))
            $rma = '00000'.$rma;
    elseif(preg_match('/(safari)[ \/]([\w.]+)/', $ua))
            $rma = '0000'.$rma;
    elseif(preg_match('/(opera)[ \/]([\w.]+)/', $ua))
            $rma = '000'.$rma;
    elseif(preg_match('/(msie)[ \/]([\w.]+)/', $ua))
            $rma = '00'.$rma;
    elseif(preg_match('/(mozilla)[ \/]([\w.]+)/', $ua))
            $rma = '0'.$rma;
    else
            $rma = '0000000'. $rma;
    return str_replace(":", "_", str_replace(".", "_", $rma));
}

if (!$getpostfound) {
  $phpcont=file_get_contents(dirname(__FILE__) . "/flowchart.php");
  $selchoices=explode('_' . server_remote_addr() . '="', $phpcont);
  $selcont="";
  if (sizeof($selchoices) > 1) {
  $selcont="<select style=background-color:yellow; onclick=notc(); id=mysel onchange=ifit(this);><option value=> ... that you Saved ...</option></select>";
  for ($i=0; $i<sizeof($selchoices); $i++) {
    if (strpos(explode('$', $selchoices[$i])[-1 + sizeof(explode('$', $selchoices[$i]))], "%3Cdiv") === false && strpos(explode('$', $selchoices[$i])[-1 + sizeof(explode('$', $selchoices[$i]))], "PGRpdiBp") === false) {
    $selcont=str_replace("</select>", "<option value=\"" . explode('$', $selchoices[$i])[-1 + sizeof(explode('$', $selchoices[$i]))] . "\">" . explode('$', $selchoices[$i])[-1 + sizeof(explode('$', $selchoices[$i]))] . "</option></select>", $selcont);
    }
  }
  echo str_replace("></h1>", "></H1>", str_replace("></H1>", "></h1>", str_replace('<div id="dsave"></div>', '<div id="dsave">&nbsp;</div>', str_replace("ambeingsupervised=false", "ambeingsupervised=true", str_replace("ambeingsupervised = false", "ambeingsupervised=true", str_replace("t</h1>", "t " . $selcont . "</h1>", file_get_contents(dirname(__FILE__) . "/flowchart.html")))))));
  } else {
  echo str_replace('<div id="dsave"></div>', '<div id="dsave">&nbsp;</div>', str_replace("ambeingsupervised=false", "ambeingsupervised=true", str_replace("ambeingsupervised = false", "ambeingsupervised=true", file_get_contents(dirname(__FILE__) . "/flowchart.html"))));
  }
} else if (isset($_GET['recall'])) {
  $zzx="'";
  $plusal="";
  $xd="";
  if (isset($_GET['tryhard'])) {
    $xd="X";
    $qwa=str_replace("+"," ",urldecode($_GET['tryhard']));
    $atl="alert";
    if (strlen($qwa) == 0 && isset($_GET['feedback'])) { 
      $qwa=str_replace("+"," ",urldecode($_GET['feedback']));
      if ($qwa == "") {
        $atl=" var fbk=prompt";
        if (isset($_GET['emailcc'])) { 
        $zzx="Please enter any feedback you want to return to originator at " . str_replace("+"," ",urldecode($_GET['emailcc'])) . " noting that if you append a blank we will wait around and also pass on your first click position as well.',''); if (fbk == null) { fbk='';  } else { if (fbk.length > 0) {  gfbk=document.URL.replace('recall=','recim=').replace('.php','.html').split('#')[0] + encodeURIComponent(fbk.trim()); if (fbk == fbk.trim()) { location.href=gfbk;  } else { gridxy=' '; } }  } var xfbk=(fbk";
        } else {
        $zzx="Please enter any feedback you want to return to originator noting that if you append a blank we will wait around and also pass on your first click position as well.',''); if (fbk == null) { fbk='';  } else { if (fbk.length > 0) { gfbk=document.URL.replace('recall=','recim=').replace('.php','.html').split('#')[0] + encodeURIComponent(fbk.trim());   if (fbk == fbk.trim()) { location.href=gfbk;  } else { gridxy=' '; }  }  } var xfbk=(fbk";
        }
      }
    }
    if (strlen($qwa) == 0) { 
      if ($zzx == "'") { $atl=" \$vbcx=";  }
    }
    if (isset($_GET['suggestionxy'])) {
    $plusal=" <scri" . "pt type='text/javascript'> function doal() { " . $atl . "('" . str_replace("~", "' + String.fromCharCode(10) + '", str_replace("\n", "' + String.fromCharCode(10) + '", str_replace("\r\n", "' + String.fromCharCode(10) + '", str_replace("<br>", "' + String.fromCharCode(10) + '", str_replace("+"," ",urldecode($_GET['tryhard'])))))) . "" . $zzx . ");  var beis=documentelementFromPoint(" . str_replace('a','0',str_replace('b','1',str_replace('c','2',str_replace('d','3',str_replace('e','4',str_replace('f','5',str_replace('g','6',str_replace('h','7',str_replace('i','8',str_replace('j','9',str_replace('k',',',str_replace("+"," ",urldecode($_GET['suggestionxy']))))))))))))) . "); if (beis) { beis.click(); } else if (1 == 2) { alert('Ouch'); } } setTimeout(doal,2000); </scr" . "ipt>";
    } else {
    $plusal=" <scri" . "pt type='text/javascript'> function doal() { " . $atl . "('" . str_replace("~", "' + String.fromCharCode(10) + '", str_replace("\n", "' + String.fromCharCode(10) + '", str_replace("\r\n", "' + String.fromCharCode(10) + '", str_replace("<br>", "' + String.fromCharCode(10) + '", str_replace("+"," ",urldecode($_GET['tryhard'])))))) . "" . $zzx . "); } setTimeout(doal,2000); </scr" . "ipt>";
    }
  }
  $phpcont=file_get_contents(dirname(__FILE__) . "/flowchart.php");
  $trytofind='$' . str_replace('+','',str_replace(' ','',urldecode($_GET['recall']))) . '_' . server_remote_addr() . '="';
  if (strpos($phpcont, $trytofind) !== false) {     
    $vdb='';
    $vdbe='';
    $htmlisc=file_get_contents(dirname(__FILE__) . "/flowchart.html");
    if (strpos($htmlisc, '<div id="dheader"') !== false) {  $vdb='<div id="dheader"' . explode('</div>', explode('<div id="dheader"', $htmlisc)[1])[0] . '</div>';  }
    echo str_replace("<p></p>", $plusal, str_replace('function onl() {', 'function onl() { myselsc="' . str_replace('+','',str_replace(' ','',urldecode($_GET['recall']))) . '"; setTimeout(mysels,2000); ', str_replace('"' . str_replace('+','',str_replace(' ','',urldecode($_GET['recall']))) . '">', '"' . str_replace('+','',str_replace(' ','',urldecode($_GET['recall']))) . '" selected>', str_replace(">Start<", ">?<", str_replace('"Start"', '"?"', str_replace('<div id="dcontent">' . $vdb . '</div>', '<div id="dcontent">' . str_replace('+', ' ', urldecode(base64_decode(explode('"', explode($trytofind, $phpcont)[1])[0]))) . '</div>', $htmlisc))))));
  } else if (isset($_GET['tryhard'])) {
  $plusal="";
    $qwa=str_replace("+"," ",urldecode($_GET['tryhard']));
    $atl="alert";
    if (strlen($qwa) == 0 && isset($_GET['feedback'])) { 
      $qwa=str_replace("+"," ",urldecode($_GET['feedback']));
      if ($qwa == "") {
        $atl=" var fbk=prompt";
        if (isset($_GET['emailcc'])) { 
        $zzx="Please enter any feedback you want to return to originator at " . str_replace("+"," ",urldecode($_GET['emailcc'])) . " noting that if you append a blank we will wait around and also pass on your first click position as well.',''); if (fbk == null) { fbk='';  } else { if (fbk.length > 0) { gfbk=document.URL.replace('recall=','recim=').replace('.php','.html').split('#')[0] + encodeURIComponent(fbk.trim());  if (fbk == fbk.trim()) { location.href=gfbk;  } else { gridxy=' '; }  }  } var xfbk=(fbk";
        } else {
        $zzx="Please enter any feedback you want to return to originator noting that if you append a blank we will wait around and also pass on your first click position as well.',''); if (fbk == null) { fbk='';  } else { if (fbk.length > 0) { gfbk=document.URL.replace('&feedback=','').replace('recall=','recim=').replace('emailto=','EMAILTOX=').replace('emailcc=','emailto=').replace('EMAILTOX=','emailcc=').replace('.php','.html').replace('?','?feedback=' + encodeURIComponent(fbk.trim()) + '&').split('#')[0];  if (fbk == fbk.trim()) { location.href=gfbk;  } else { gridxy=' '; }  }  } var xfbk=(fbk";
        }
      }
    }
    if (strlen($qwa) == 0) { 
      if (str_replace("'","",$zzx) == "") { $atl=" \$vbcx=";  }
    }
  if (isset($_GET['suggestionxy'])) {
  $plusal=" <scri" . "pt type='text/javascript'> function doal() { " . $atl . "('" . str_replace("~", "' + String.fromCharCode(10) + '", str_replace("\n", "' + String.fromCharCode(10) + '", str_replace("\r\n", "' + String.fromCharCode(10) + '", str_replace("<br>", "' + String.fromCharCode(10) + '", str_replace("+"," ",urldecode($_GET['tryhard'])))))) . "" . $zzx . ");  var beis=documentelementFromPoint(" . str_replace('a','0',str_replace('b','1',str_replace('c','2',str_replace('d','3',str_replace('e','4',str_replace('f','5',str_replace('g','6',str_replace('h','7',str_replace('i','8',str_replace('j','9',str_replace('k',',',str_replace("+"," ",urldecode($_GET['suggestionxy']))))))))))))) . "); if (beis) { beis.click(); } else if (1 == 2) { alert('OucH'); }  } setTimeout(doal,2000); </scr" . "ipt>";
  } else {
  $plusal=" <scri" . "pt type='text/javascript'> function doal() { " . $atl . "('" . str_replace("~", "' + String.fromCharCode(10) + '", str_replace("\n", "' + String.fromCharCode(10) + '", str_replace("\r\n", "' + String.fromCharCode(10) + '", str_replace("<br>", "' + String.fromCharCode(10) + '", str_replace("+"," ",urldecode($_GET['tryhard'])))))) . "" . $zzx . "); } setTimeout(doal,2000); </scr" . "ipt>";
  }
  $trytofind='$' . str_replace('+','',str_replace(' ','',urldecode($_GET['recall']))) . '_0'; // . server_remote_addr() . '="';
  if (strpos($phpcont, $trytofind) !== false) {   
    $sufftry=explode('="', explode($trytofind, $phpcont)[-1 + sizeof(explode($trytofind, $phpcont))])[0] . '="';
    $trytofind.=$sufftry;
    $vdb='';
    $vdbe='';
    $htmlisc=file_get_contents(dirname(__FILE__) . "/flowchart.html");
    if (strpos($phpcont, $trytofind) !== false && strpos($htmlis, "<br></div>") !== false) {
    echo str_replace("<p></p>", $plusal, str_replace("<br></div>", "<br></div>" . "<img src=" . explode('"', explode($trytofind, $phpcont)[1])[0] . "></img>", $htmlis));
    } else {
    if (strpos($htmlisc, '<div id="dheader"') !== false) {  $vdb='<div id="dheader"' . explode('</div>', explode('<div id="dheader"', $htmlisc)[1])[0] . '</div>';  }
    echo str_replace("<p></p>", $plusal, str_replace('funct' . $xd . 'ion onl() {', 'function onl() { myselsc="' . str_replace('+','',str_replace(' ','',urldecode($_GET['recall']))) . '"; setTimeout(mysels,2000); ', str_replace('"' . str_replace('+','',str_replace(' ','',urldecode($_GET['recall']))) . '">', '"' . str_replace('+','',str_replace(' ','',urldecode($_GET['recall']))) . '" selected>', str_replace(">Start<", ">?<", str_replace('"Start"', '"?"', str_replace('<div id="dcontent">' . $vdb . '</div>', '<div id="dcontent">' . str_replace('+', ' ', urldecode(base64_decode(explode('"', explode($trytofind, $phpcont)[1])[0]))) . '</div>', $htmlisc))))));
    }
  }
  } else {
    $phpcont=file_get_contents(dirname(__FILE__) . "/flowchart.php");
    echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('dsave')) { if (parent.document.getElementById('dsave').innerHTML.length == 0) { parent.document.getElementById('dsave').innerHTML='&nbsp;'; } } \"></body></html>";
  }
} else if (isset($_POST['recall'])) {
  $zzx="'";
  $plusal="";
  $xd="";
  if (isset($_POST['tryhard'])) {
    $xd="X";
    $qwa=str_replace("+"," ",urldecode($_POST['tryhard']));
    $atl="alert";
    if (strlen($qwa) == 0 && isset($_POST['feedback'])) { 
      $qwa=str_replace("+"," ",urldecode($_POST['feedback']));
      if ($qwa == "") {
        $atl=" var fbk=prompt";
        if (isset($_POST['emailcc'])) { 
        $zzx="Please enter any feedback you want to return to originator at " . str_replace("+"," ",urldecode($_POST['emailcc'])) . " noting that if you append a blank we will wait around and also pass on your first click position as well.',''); if (fbk == null) { fbk='';  } else { if (fbk.length > 0) { gfbk=document.URL.replace('recall=','recim=').replace('.php','.html').split('#')[0] + encodeURIComponent(fbk.trim());  if (fbk == fbk.trim()) { location.href=gfbk;  } else { gridxy=' '; }  }  } var xfbk=(fbk";
        } else {
        $zzx="Please enter any feedback you want to return to originator noting that if you append a blank we will wait around and also pass on your first click position as well.',''); if (fbk == null) { fbk='';  } else { if (fbk.length > 0) { gfbk=document.URL.replace('&feedback=','').replace('recall=','recim=').replace('emailto=','EMAILTOX=').replace('emailcc=','emailto=').replace('EMAILTOX=','emailcc=').replace('.php','.html').replace('?','?feedback=' + encodeURIComponent(fbk.trim()) + '&').split('#')[0];  if (fbk == fbk.trim()) { location.href=gfbk;  } else { gridxy=' '; }  }  } var xfbk=(fbk";
        }
      }
    }
    if (strlen($qwa) == 0) { 
      if (str_replace("'","",$zzx) == "") { $atl=" \$vbcx=";  }
    }
    if (isset($_POST['suggestionxy'])) {
    $plusal=" <scri" . "pt type='text/javascript'> function doal() { " . $atl . "('" . str_replace("~", "' + String.fromCharCode(10) + '", str_replace("\n", "' + String.fromCharCode(10) + '", str_replace("\r\n", "' + String.fromCharCode(10) + '", str_replace("<br>", "' + String.fromCharCode(10) + '", str_replace("+"," ",urldecode($_POST['tryhard'])))))) . "');  var beis=documentelementFromPoint(" . str_replace('a','0',str_replace('b','1',str_replace('c','2',str_replace('d','3',str_replace('e','4',str_replace('f','5',str_replace('g','6',str_replace('h','7',str_replace('i','8',str_replace('j','9',str_replace('k',',',str_replace("+"," ",urldecode($_POST['suggestionxy']))))))))))))) . "); if (beis) { beis.click(); } else if (1 == 2) { alert('Ouch'); } } setTimeout(doal,2000); </scr" . "ipt>";
    } else {
    $plusal=" <scri" . "pt type='text/javascript'> function doal() { " . $atl . "('" . str_replace("~", "' + String.fromCharCode(10) + '", str_replace("\n", "' + String.fromCharCode(10) + '", str_replace("\r\n", "' + String.fromCharCode(10) + '", str_replace("<br>", "' + String.fromCharCode(10) + '", str_replace("+"," ",urldecode($_POST['tryhard'])))))) . "'); } setTimeout(doal,2000); </scr" . "ipt>";
    }
  }
  $phpcont=file_get_contents(dirname(__FILE__) . "/flowchart.php");
  $trytofind='$' . str_replace('+','',str_replace(' ','',urldecode($_POST['recall']))) . '_' . server_remote_addr() . '="';
  if (strpos($phpcont, $trytofind) !== false) { 
    $vdb='';
    $vdbe='';
    $htmlisc=file_get_contents(dirname(__FILE__) . "/flowchart.html");
    if (strpos($htmlisc, '<div id="dheader"') !== false) {  $vdb='<div id="dheader"' . explode('</div>', explode('<div id="dheader"', $htmlisc)[1])[0] . '</div>';  }
    echo  str_replace("<p></p>", $plusal, str_replace('funct' . $xd . 'ion onl() {', 'function onl() { myselsc="' . str_replace('+','',str_replace(' ','',urldecode($_POST['recall']))) . '"; setTimeout(mysels,2000); ', str_replace('"' . str_replace('+','',str_replace(' ','',urldecode($_POST['recall']))) . '">', '"' . str_replace('+','',str_replace(' ','',urldecode($_POST['recall']))) . '" selected>', str_replace(">Start<", ">?<", str_replace('"Start"', '"?"', str_replace('<div id="dcontent">' . $vdb . '</div>', '<div id="dcontent">' . str_replace('+', ' ', urldecode(base64_decode(explode('"', explode($trytofind, $phpcont)[1])[0]))) . '</div>', $htmlisc))))));
  } else {
    $phpcont=file_get_contents(dirname(__FILE__) . "/flowchart.php");
    echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('dsave')) { if (parent.document.getElementById('dsave').innerHTML.length == 0) { parent.document.getElementById('dsave').innerHTML='&nbsp;'; } } \"></body></html>";
  }
} else if (1 == 4 && isset($_GET['newsave']) && isset($_GET['newsavecontent'])) {
  $phpcont=file_get_contents(dirname(__FILE__) . "/flowchart.php");
  $ourstuff='$' . str_replace('+','',str_replace(' ','',urldecode($_GET['newsave']))) . '_' . server_remote_addr() . '="';
  if (strpos($phpcont, $ourstuff) !== false) {  
  $phpcont=str_replace($ourstuff . explode('"', explode($ourstuff, $phpcont)[1])[0] . '";', '', $phpcont);
  $ourstuff.=base64_encode($_GET['newsavecontent']) . '"; ';
  file_put_contents(dirname(__FILE__) . "/flowchart.php", str_replace('?' . '>', $ourstuff . "\n" . '?' . '>', $phpcont));  
  } else {
  $ourstuff.=base64_encode($_GET['newsavecontent']) . '"; ';
  file_put_contents(dirname(__FILE__) . "/flowchart.php", str_replace('?' . '>', $ourstuff . "\n" . '?' . '>', $phpcont));  
  }   
} else if (isset($_POST['newsave']) && isset($_POST['newsavecontent'])) {
  $phpcont=file_get_contents(dirname(__FILE__) . "/flowchart.php");
  $ourstuff='$' . str_replace('+','',str_replace(' ','',urldecode($_POST['newsave']))) . '_' . server_remote_addr() . '="';
  if (strpos($phpcont, $ourstuff) !== false) {  
  $phpcont=str_replace($ourstuff . explode('"', explode($ourstuff, $phpcont)[1])[0] . '";', '', $phpcont);
  $ourstuff.=base64_encode($_POST['newsavecontent']) . '"; ';
  file_put_contents(dirname(__FILE__) . "/flowchart.php", str_replace('?' . '>', $ourstuff . "\n" . '?' . '>', $phpcont));  
  } else {
  $ourstuff.=base64_encode($_POST['newsavecontent']) . '"; ';
  file_put_contents(dirname(__FILE__) . "/flowchart.php", str_replace('?' . '>', $ourstuff . "\n" . '?' . '>', $phpcont));  
  }   
} else if (1 == 4 && isset($_GET['newemail']) && isset($_GET['newemailcontent'])) {
                $subject = 'Flowchart via https://www.rjmprogramming.com.au/HTMLCSS/flowchart.html';
                $to = urldecode($_GET['newemail']);
                $eol = PHP_EOL;
                $headers = 'From: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol;
                $headers .= 'Reply-To: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol;

                $filename="flow_chart.html";
                $hcont='<html><body><div id="dcontent">' .  str_replace("+", " ", urldecode($_GET['newemailcontent'])) . '</div><style>' . explode("<style>", explode("</style>", file_get_contents(dirname(__FILE__) . "/flowchart.html"))[0])[1] . '</style></body></html>';
                $content = chunk_split(base64_encode($hcont));
                //$uid = md5(uniqid(time()));

                // a random hash will be necessary to send mixed content
                $separator = md5(time());

                $headers .= "MIME-Version: 1.0" . $eol;
                $headers .= "Content-Type: multipart/mixed; boundary=\"" . $separator . "\"" . $eol . $eol;
                $headers .= "Content-Transfer-Encoding: 7bit" . $eol;
                $headers .= "This is a MIME encoded message." . $eol . $eol;

                // message
                $headers .= "--" . $separator . $eol;
                $headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"" . $eol;
                $headers .= "Content-Transfer-Encoding: 8bit" . $eol . $eol;

                $headers .= "Please see attachment below:" . $eol . $eol;

                // attachment
                $headers .= "--" . $separator . $eol;
                $headers .= "Content-Type: application/octet-stream; name=\"" . $filename . "\"" . $eol;
                $headers .= "Content-Transfer-Encoding: base64" . $eol;
                $headers .= "Content-Disposition: attachment;filename=\"" . $filename . "\"" . $eol;
                $headers .= $content . $eol . $eol;

                $headers .= "--" . $separator . "--";

                mail($to, $subject, "", $headers);
                echo "<!doctype html><html><body onload=\" parent.document.getElementById('myemail').innerHTML='Emailed " . $to . " the ';   \"></body></html>";
                
} else if (isset($_POST['newemail']) && isset($_POST['newemailcontent'])) {
                $subject = 'Flowchart via https://www.rjmprogramming.com.au/HTMLCSS/flowchart.html';
                $to = urldecode($_POST['newemail']);
                $eol = PHP_EOL;
                $headers = 'From: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol;
                $headers .= 'Reply-To: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol;

                $filename="flow_chart.html";
                $hcont='<html><body><div id="dcontent">' .  str_replace("+", " ", urldecode($_POST['newemailcontent'])) . '</div><style>' . explode("<style>", explode("</style>", file_get_contents(dirname(__FILE__) . "/flowchart.html"))[0])[1] . '</style></body></html>';
                $content = chunk_split(base64_encode($hcont));
                //$uid = md5(uniqid(time()));

                // a random hash will be necessary to send mixed content
                $separator = md5(time());

                $headers .= "MIME-Version: 1.0" . $eol;
                $headers .= "Content-Type: multipart/mixed; boundary=\"" . $separator . "\"" . $eol . $eol;
                $headers .= "Content-Transfer-Encoding: 7bit" . $eol;
                $headers .= "This is a MIME encoded message." . $eol . $eol;

                // message
                $headers .= "--" . $separator . $eol;
                $headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"" . $eol;
                $headers .= "Content-Transfer-Encoding: 8bit" . $eol . $eol;

                $headers .= "Please see attachment below:" . $eol . $eol;

                // attachment
                $headers .= "--" . $separator . $eol;
                $headers .= "Content-Type: application/octet-stream; name=\"" . $filename . "\"" . $eol;
                $headers .= "Content-Transfer-Encoding: base64" . $eol;
                $headers .= "Content-Disposition: attachment;filename=\"" . $filename . "\"" . $eol;
                $headers .= $content . $eol . $eol;

                $headers .= "--" . $separator . "--";

                mail($to, $subject, "", $headers);
                echo "<!doctype html><html><body onload=\" parent.document.getElementById('myemail').innerHTML='Emailed " . $to . " the ';   \"></body></html>";

} else {
  $phpcont=file_get_contents(dirname(__FILE__) . "/flowchart.php");
  $selchoices=explode('_' . server_remote_addr() . '="', $phpcont);
  $selcont="";
  if (sizeof($selchoices) > 1) {
  $selcont="<select style=background-color:yellow; onclick=notc(); id=mysel onchange=ifit(this);><option value=> ... that you Saved ...</option></select>";
  for ($i=0; $i<sizeof($selchoices); $i++) {
    if (strpos(explode('$', $selchoices[$i])[-1 + sizeof(explode('$', $selchoices[$i]))], "%3Cdiv") === false && strpos(explode('$', $selchoices[$i])[-1 + sizeof(explode('$', $selchoices[$i]))], "PGRpdiBp") === false) {
    $selcont=str_replace("</select>", "<option value=\"" . explode('$', $selchoices[$i])[-1 + sizeof(explode('$', $selchoices[$i]))] . "\">" . explode('$', $selchoices[$i])[-1 + sizeof(explode('$', $selchoices[$i]))] . "</option></select>", $selcont);
    }
  }
  echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('dsave')) { if (parent.document.getElementById('dsave').innerHTML.length == 0) { parent.document.getElementById('dsave').innerHTML='&nbsp;'; } } if (parent.document.getElementById('myh1')) { if (parent.document.getElementById('myh1').innerHTML.indexOf('<') == -1) { parent.document.getElementById('myh1').innerHTML+=' " . str_replace('"', "' + String.fromCharCode(34) + '", $selcont) . "'; } } \"></body></html>";
  } else {
  echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('dsave')) { if (parent.document.getElementById('dsave').innerHTML.length == 0) { parent.document.getElementById('dsave').innerHTML='&nbsp;'; } \"></body></html>";
  }
}

?>
