Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

POST Array

Featured Replies

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.

 

 

 

image.thumb.png.bc071f229820988d3f2ff4232a614a7f.png

 

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>


 

  • 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.

Not how I use $_POST.  I've never played with them when reloading the page

  • 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?

  • 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.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.