SimonF Posted November 28, 2020 Share Posted November 28, 2020 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> Quote Link to comment
SimonF Posted December 1, 2020 Author Share Posted December 1, 2020 Anyone have any suggestions? Quote Link to comment
SimonF Posted December 6, 2020 Author Share Posted December 6, 2020 @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. Quote Link to comment
Squid Posted December 6, 2020 Share Posted December 6, 2020 Not how I use $_POST. I've never played with them when reloading the page Quote Link to comment
SimonF Posted December 12, 2020 Author Share Posted December 12, 2020 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? Quote Link to comment
SimonF Posted December 14, 2020 Author Share Posted December 14, 2020 @ich777 provided suggestion of if ( window.history.replaceState ) { window.history.replaceState( null, null, window.location.href ); } Which fixed the issue thanks. 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.