$value ) { $_POST[$key] = $value; } $abl=['round-table','King Arthur','Sir Bedevere the Wise','Sir Lancelot the Brave']; $newabl=['solar-system-planets','Sun','Earth','Moon']; $prefix=''; $suffix=''; $yes='n'; function server_remote_addr() { $rma = $_SERVER['REMOTE_ADDR']; return str_replace('.','_',$rma); } if (!isset($_GET['one']) && !isset($_GET['two']) && !isset($_GET['three']) && !isset($_GET['original'])) { $yes='y'; $_GET['one']=$newabl[1]; $_GET['two']=$newabl[2]; $_GET['three']=$newabl[3]; } if (isset($_GET['title'])) { $newabl[0]=str_replace('+',' ',urldecode($_GET['title'])); } else if (!isset($_GET['original'])) { $_GET['title']=$newabl[0]; } if (isset($_GET['one']) && isset($_GET['two']) && isset($_GET['three'])) { $prefix=$_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR; //'/tmp/'; $newabl[1]=str_replace('+',' ',urldecode($_GET['one'])); $newabl[2]=str_replace('+',' ',urldecode($_GET['two'])); $newabl[3]=str_replace('+',' ',urldecode($_GET['three'])); $pycont=file_get_contents('./subgraph_example.py'); $pycont=str_replace($abl[0], str_replace("\n", "' + \"\\n\" + '",str_replace("'", "' + \"'\" + '",str_replace('+',' ',urldecode(str_replace("%0D","",$_GET['title']))))), $pycont); $pycont=str_replace($abl[1], str_replace("\n", "' + \"\\n\" + '",str_replace("'", "' + \"'\" + '",str_replace('+',' ',urldecode(str_replace("%0D","",$_GET['one']))))), $pycont); $pycont=str_replace($abl[2], str_replace("\n", "' + \"\\n\" + '",str_replace("'", "' + \"'\" + '",str_replace('+',' ',urldecode(str_replace("%0D","",$_GET['two']))))), $pycont); $pycont=str_replace($abl[3], str_replace("\n", "' + \"\\n\" + '",str_replace("'", "' + \"'\" + '",str_replace('+',' ',urldecode(str_replace("%0D","",$_GET['three']))))), $pycont); $pycont=str_replace('doctest-output', $prefix . 'doctest-output', $pycont); if ($yes != 'y') { // use crontab $suffix='_' . server_remote_addr(); file_put_contents($prefix . 'subgraph_example_' . $suffix . '.py', $pycont); file_put_contents($prefix . 'subgraph_example_' . $suffix . '.ksh', "#!/bin/ksh\n/usr/bin/python3 " . $prefix . "subgraph_example_" . $suffix . ".py >> " . $prefix . "subgraph_example.good 2>> " . $prefix . "subgraph_example.bad \nln -s " . $prefix . "doctest-output" . DIRECTORY_SEPARATOR . $newabl[0] . ".gv.pdf " . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "doctest-output" . DIRECTORY_SEPARATOR . $newabl[0] . ".gv.pdf \nrm -f " . $prefix . "subgraph_example_" . $suffix . ".py \nrm -f " . $prefix . "subgraph_example_" . $suffix . ".ksh \nexit"); exec('chmod 777 ' . $prefix . 'subgraph_example_' . $suffix . '.ksh'); exec('ksh ' . $prefix . 'subgraph_example_' . $suffix . '.ksh'); exec('chown root ' . $prefix . 'subgraph_example_' . $suffix . '.ksh'); exec('chgrp root ' . $prefix . 'subgraph_example_' . $suffix . '.ksh'); while (file_exists($prefix . 'subgraph_example_' . $suffix . '.ksh')) { sleep(10); } } else { file_put_contents($ourtmp . 'subgraph_example.py', $pycont); exec('chmod 777 ' . $ourtmp . 'subgraph_example.py'); exec('chown rjmprogr ' . $ourtmp . 'subgraph_example.py'); exec('chgrp rjmprogr ' . $ourtmp . 'subgraph_example.py'); //if (file_exists('doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf')) { //exec('rm -f ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf'); //exec('rm -f ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv'); //unlink('doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf'); //unlink('doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv'); //} exec('/usr/bin/python3 ' . $ourtmp . 'subgraph_example.py > ' . $ourtmp . 'subgraph_example.good 2> ' . $ourtmp . 'subgraph_example.bad'); sleep(8); if (file_exists($prefix . 'doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf')) { exec('ln -s ' . $prefix . 'doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf'); } } } else { exec('/usr/bin/python3 subgraph_example.py'); sleep(8); } if (file_exists('doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf')) { exec('chmod 777 ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf'); exec('chmod 777 ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv'); exec('chown rjmprogr ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf'); exec('chown rjmprogr ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv'); exec('chgrp rjmprogr ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf'); exec('chgrp rjmprogr ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv'); echo " Trying out Python GraphViz hosted in PHP - RJM Programming - September, 2024 - Triangular Relationship

Trying out Python GraphViz hosted in PHP - Triangular Relationship 

RJM Programming - September, 2024

Thanks to https://graphviz.readthedocs.io/en/stable/

Title ...




Triangular Relationship Names ...






"; } else { echo " Trying out Python GraphViz hosted in PHP - RJM Programming - September, 2024 - Triangular Relationship

Trying out Python GraphViz hosted in PHP - Triangular Relationship 

RJM Programming - September, 2024

Thanks to https://graphviz.readthedocs.io/en/stable/

Title ...




Triangular Relationship Names ...






"; } ?>