November 28, 20205 yr Hi is there a defined method for clear POST data within unraid Plugins. I have created a test page but options I tried refresh with F5 always prompts for re-submission. Source Code for page below. I have copied processtargetcli function from lib.php and modified. Real page has more selections that test page but trying to find solution for single entry first. Menu="SystemInformation" Title="iSCSITest" Tag="save" --- <?PHP #require_once "$docroot/plugins/unraid.iSCSI/include/lib.php"; function processTargetcli($cmdstr) { # Write command string a process # targetctl /tmp/string > /var/run/targetcli.last #exec($cmdstr ,$tj) ; $debug=true; $cmd=$cmdstr."\nexit\n" ; exec("echo \"$cmd\" >/tmp/iscsicmd.run", $output, $myreturn ); $cmd="targetcli </tmp/iscsicmd.run "; exec($cmd, $output, $return) ; if ($debug) { echo "\n" ; var_dump($return) ; var_dump($output) ; } return($return) ; } # /iscsi/iqn.2003-01.org.linux-iscsi.tower.x8664:sn.ee5cd767532c/tpg1/luns create /backstores/ramdisk/testramdisk add_mapped_luns=false if (count($_POST)) { var_dump($_POST) ; if(isset($_POST['#applytgt'])) { if ($_POST['#applytgt'] == "_(Add Target)_") { $tgtname=$_POST["newtgt"]; $cmdstr="/iscsi/ create ".$tgtname; $test=processTargetcli($cmdstr) ; if ($test=0) $_POST = array(); } } $_POST=array() ; echo '<script>window.opener.location.reload(true);</script>'; } ?> <style> table.pre{margin-top:0;background:transparent} table.pre td:first-child{width:144px} table tr td{padding:0 0 3px 0;margin:0} table tr td.thin{line-height:8px;height:8px} </style> <form id="newtgt" method="POST" > <b>_(Create Target:)_</b> <input type="text" name="newtgt" placeholder="Auto create random name"/> <input type="submit" name="#applytgt" value='_(Add Target)_'> </form>
December 6, 20205 yr Author @Squid Do you have any suggestions where I can look or who I can ask? I have looked at others code and cannot find a work around.
December 12, 20205 yr Author On 12/6/2020 at 3:57 PM, Squid said: Not how I use $_POST. I've never played with them when reloading the page Any suggestions on who may be a good person to be ask?
December 14, 20205 yr Author @ich777 provided suggestion of if ( window.history.replaceState ) { window.history.replaceState( null, null, window.location.href ); } Which fixed the issue thanks.
Archived
This topic is now archived and is closed to further replies.