POST Array


6 posts in this topic Last Reply

Recommended Posts

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.



#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) ;
  $cmd=$cmdstr."\nexit\n"  ;
  exec("echo \"$cmd\" >/tmp/", $output, $myreturn );
    $cmd="targetcli </tmp/ ";
    exec($cmd, $output, $return) ;
    if ($debug) {
        echo "\n" ;
        var_dump($return) ;
        var_dump($output) ;
    return($return) ;

# /iscsi/  create /backstores/ramdisk/testramdisk add_mapped_luns=false 

if (count($_POST)) {

  var_dump($_POST) ;

if(isset($_POST['#applytgt'])) {
    if ($_POST['#applytgt'] == "_(Add Target)_") {
      $cmdstr="/iscsi/ create ".$tgtname;
      $test=processTargetcli($cmdstr) ;
      if ($test=0) 
       $_POST = array();

  $_POST=array() ;
  echo '<script>window.opener.location.reload(true);</script>';

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}

<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)_'>


Link to post

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.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.