$val) { $names.=$ndelim . short($name); // . '=' . urldecode($val); $ndelim=","; } foreach ($_GET as $name => $val) { if (!$pdf) $pdf = new PDF_Attachment(); //if (strpos(htmlspecialchars($val), ".php") === false) { if ($val != "" && substr(strtolower($name),0,7) == "subject") { if (strtolower($name) == "subject" || (strpos(urldecode($name),".") === false && strpos(urldecode($name),"_") === false)) { if ($lastsub != "" && urldecode($name) != $lastsub) { $msg[$imsg + 1]=''; } if (sizeof($msg) > $imsg) { $imsg++; } $httpc=""; short($val); if ($httpc != "" || $imsg > 0) { $msg[$imsg]=$httpc; $msg[$imsg]=urldecode($val); if (sizeof($msgn) > $imsg) { $msgn[$imsg]=''; $msgv[$imsg]=''; } } else { $msg[$imsg]=urldecode($val); if (sizeof($msgn) > $imsg) { $msgn[$imsg]=''; $msgv[$imsg]=''; } } $lastsub=urldecode($name); } else { if ($lastsubi != "" && urldecode($name) != $lastsubi) { $msgn[$imsg + 1]=''; $msgv[$imsg + 1]=''; $names.=' 00'; } if (sizeof($msgn) > $imsg) { $imsg++; } if (strpos($names, "," . explode(".",str_replace("subject2","subject",str_replace("_",".",urldecode($name))))[0] . ",") !== false) { $jmsg=1; while ($msgn[$jmsg] != '') { $jmsg++; } $msgn[$jmsg]=str_replace("_",".",urldecode($name)); $msgv[$jmsg]=str_replace('$@$','+',str_replace('@!@','+',urldecode($val))); } else { $msgn[$imsg]=str_replace("_",".",urldecode($name)); $msgv[$imsg]=str_replace('$@$','+',str_replace('@!@','+',urldecode($val))); } if (sizeof($msg) > $imsg) { $msg[$imsg]=''; } $lastsubi=urldecode($name); } } else if ($val == "" && substr(strtolower($name),0,7) == "subject") { if ($lastsub != "" && urldecode($name) != $lastsub) { $msg[$imsg + 1]=''; } if (sizeof($msg) > $imsg) { $imsg++; $names.=' 0'; } $msg[$imsg]=$msg[$imsg]; $lastsub=urldecode($name); } else if ($val == "" && file_exists($name)) { $pdf->Attach(getcwd() . "/" . $name); $att=true; $done=true; $cnt++; } else if ($val == "" && !file_exists(short($name))) { file_put_contents(short($name), ""); $pdf->Attach(getcwd() . "/" . short($name)); $att=true; $flist.=$fdelim . (short($name)); $fdelim=','; $done=true; $cnt++; } else if ($val != "" && file_exists($name)) { $pref="1_"; while (file_exists($pref . short($name))) { $pref.="1_"; } file_put_contents($pref . short($name), ourhtmlspecialchars($val)); $pdf->Attach(getcwd() . "/" . $pref . short($name)); $att=true; $flist.=$fdelim . ($pref . short($name)); $fdelim=','; $done=true; $cnt++; } else if ($val != "") { file_put_contents(short($name), ourhtmlspecialchars($val)); $pdf->Attach(getcwd() . "/" . short($name)); $att=true; $flist.=(short($name)); $fdelim=','; $done=true; $cnt++; } //} $pref=''; } if (!$done) { $names=","; $ndelim=""; foreach ($_POST as $name => $val) { $names.=$ndelim . short($name); // . '=' . urldecode($val); $ndelim=","; } //if ($names != "") { //echo $names; //exit; //} // 0 1 00 0 1 6 7 00 5 6 // This PDF contains an attached file.,page 1, // ,,subject22.png foreach ($_POST as $name => $val) { if (!$pdf) $pdf = new PDF_Attachment(); //if (strpos(htmlspecialchars($val), ".php") === false) { if ($val != "" && substr(strtolower($name),0,7) == "subject") { if (strtolower($name) == "subject" || (strpos(urldecode($name),".") === false && strpos(urldecode($name),"_") === false)) { if ($lastsub != "" && urldecode($name) != $lastsub) { $msg[$imsg + 1]=''; $names.=' 00' . urldecode($name); } if (sizeof($msg) > $imsg) { $imsg++; $names.=' 0'; } $httpc=""; short($val); if ($httpc != "" || $imsg > 0) { $msg[$imsg]=$httpc; $msg[$imsg]=urldecode($val); $names.=' 1'; if (sizeof($msgn) > $imsg) { $names.=' 2'; $msgn[$imsg]=''; $msgv[$imsg]=''; } } else { $msg[$imsg]=urldecode($val); $names.=' 3.' . $imsg; if (sizeof($msgn) > $imsg) { $names.=' 4'; $msgn[$imsg]=''; $msgv[$imsg]=''; } } $lastsub=urldecode($name); } else { if ($lastsubi != "" && urldecode($name) != $lastsubi && strpos($names, "," . explode(".",str_replace("subject2","subject",str_replace("_",".",urldecode($name))))[0] . ",") === false) { $msgn[$imsg + 1]=''; $msgv[$imsg + 1]=''; $names.=' 000' . urldecode($name); } if (sizeof($msgn) > $imsg) { $names.=' 5'; $imsg++; } $names.=' 6'; if (strpos($names, "," . explode(".",str_replace("subject2","subject",str_replace("_",".",urldecode($name))))[0] . ",") !== false) { $jmsg=1; while ($msgn[$jmsg] != '') { $jmsg++; } $msgn[$jmsg]=str_replace("_",".",urldecode($name)); $msgv[$jmsg]=str_replace('$@$','+',str_replace('@!@','+',urldecode($val))); $names.=' 65'; } else { $names.=' 675'; $msgn[$imsg]=str_replace("_",".",urldecode($name)); $msgv[$imsg]=str_replace('$@$','+',str_replace('@!@','+',urldecode($val))); if (sizeof($msg) > $imsg) { $names.=' 7'; $msg[$imsg]=''; } } $lastsubi=urldecode($name); } } else if ($val == "" && substr(strtolower($name),0,7) == "subject") { $names.=' 8'; if ($lastsub != "" && urldecode($name) != $lastsub) { $msg[$imsg + 1]=''; } if (sizeof($msg) > $imsg) { $imsg++; $names.=' 0'; } $msg[$imsg]=$msg[$imsg]; $lastsub=urldecode($name); } else if ($val == "" && file_exists(short($name))) { $names.=' 9'; echo "\n ! " . short($name) . "\n"; if (file_exists($pref . short($name))) echo "\n !! " . $pref . short($name) . "\n"; $pdf->Attach(getcwd() . "/" . short($name)); $att=true; $done=true; $cnt++; } else if ($val == "" && !file_exists(short($name))) { $names.=' a'; file_put_contents(short($name), ""); //echo "\n ? " . short($name) . "\n"; //if (file_exists($pref . short($name))) echo "\n ?? " . $pref . short($name) . "\n"; $pdf->Attach(getcwd() . "/" . short($name)); $att=true; $flist.=(short($name)); $fdelim=','; $done=true; $cnt++; } else if ($val != "" && file_exists(short($name))) { $names.=' b'; $pref="1_"; while (file_exists($pref . short($name))) { $pref.="1_"; } $names.=' c'; file_put_contents($pref . short($name), ourhtmlspecialchars($val)); //echo "\n . " . $pref . short($name) . "\n"; //if (file_exists($pref . short($name))) echo "\n .. " . $pref . short($name) . "\n"; $pdf->Attach(getcwd() . "/" . $pref . short($name)); $att=true; $flist.=($pref . short($name)); $fdelim=','; $done=true; $cnt++; } else if ($val != "") { file_put_contents(short($name), ourhtmlspecialchars($val)); //echo "\n " . short($name) . "\n"; //if (file_exists(short($name))) echo "\n ... " . short($name) . "\n"; $pdf->Attach(getcwd() . "/" . short($name)); $att=true; $flist.=(short($name)); $fdelim=','; $done=true; $cnt++; } //} $pref=''; } if ($names != "") { //echo $names; //exit; } } if (!$pdf) { echo " PDF Attachments - RJM Programming - July, 2018
'; } return true;\" action='./use_attachment.php' method='POST'>

PDF Attachments

RJM Programming

July, 2018

Attachment name (or HTTP url content) 1:
Non HTTP URL Content 1:
Attachment name (or HTTP url content) 2:
Non HTTP URL Content 2:
Attachment name (or HTTP url content) 3:
Non HTTP URL Content 3:
Attachment name (or HTTP url content) 4:
Non HTTP URL Content 4:

"; } else { if (1 == 7 && !$done && strpos(("~" . $msg[0]), "~This PDF contain") !== false) $pdf->Attach('attached.txt'); if ($cnt > 1 && strpos(("~" . $msg[0]), "~This PDF contain") !== false) $msg[0]='This PDF contains ' . $cnt . ' attached files.'; $pdf->OpenAttachmentPane(); if ($names != "") { //echo $names . ' === ' . $imsg . ' ... ' . sizeof($msg) . ' ... ' . sizeof($msgn) . ' ... ' . $msg[0] . ' ... ' . $msg[1] . "
\n" . $msg[0] . "," . $msg[1] . "," . $msg[2] . "
\n" . $msgn[0] . "," . $msgn[1] . "," . $msgn[2]; //exit; } for ($jmsg=(sizeof($msg) - $imsg); $jmsg<=$imsg; $jmsg++) { $pdf->AddPage(); if (sizeof($msgn) > $jmsg) { if ($msgn[$jmsg] != '') { if (file_exists($msgn[$jmsg])) { $pref="1_"; while (file_exists($pref . $msgn[$jmsg])) { $pref.="1_"; } file_put_contents($pref . $msgn[$jmsg], base64_decode(substr($msgv[$jmsg],strlen("data:image/png;base64,")))); $pdf->Image("http://www.rjmprogramming.com.au/PHP/" . $pref . $msgn[$jmsg], 0.0, 0.0); $flist.=($pref . $msgn[$jmsg]); $fdelim=','; } else { file_put_contents($msgn[$jmsg], base64_decode(substr($msgv[$jmsg],strlen("data:image/png;base64,")))); //$pdf->Image(getcwd() . "/" . $msgn[$jmsg], 0.0, 0.0); $pdf->Image("http://www.rjmprogramming.com.au/PHP/" . $msgn[$jmsg], 0.0, 0.0); $flist.=($msgn[$jmsg]); $fdelim=','; } } } if (sizeof($msg) > $jmsg) { $pdf->SetFont('Arial','',14); if ($msg[$jmsg] != '') { $pdf->Write(5,$msg[$jmsg]); } else if ($imsg == 0 && $att && $cnt > 0) { $pdf->Write(5,'This PDF contains ' . $cnt . ' attached file(s).'); } else if ($jmsg == (sizeof($msg) - $imsg) && $jmsg == $imsg && $att && $cnt > 0) { $pdf->Write(5,'This PDF contains ' . $cnt . ' attached file(s).'); } } else if ($jmsg == (sizeof($msg) - $imsg) && $jmsg == $imsg && $att && $cnt > 0) { $pdf->Write(5,'This PDF contains ' . $cnt . ' attached file(s).'); } } $pdf->Output(); if ($flist != '') { $fs=explode($fdelim, $flist); for ($ifs=0; $ifs