Project

General

Profile

« Previous | Next » 

Revision 6f3f9671

Added by Viktor Gurov over 4 years ago

Button to clear the ARP cache. Issue #4038

View differences:

src/usr/local/www/diag_arp.php
52 52
		$savemsg = sprintf(gettext("The ARP cache entry for %s has been deleted."), $ip);
53 53
		$savemsgtype = 'success';
54 54
	}
55
} elseif (isset($_POST['cleararptable'])) {
56
	$out = "";
57
	$ret = exec("/usr/sbin/arp -d -a", $out, $arpTableRetVal);
58
	if ($arpTableRetVal == 0) { 
59
		$savemsg = gettext("ARP Table has been cleared.");
60
		$savemsgtype = 'success';
61
	} else {
62
		$savemsg = gettext("Unable to clear ARP Table.");
63
		$savemsgtype = 'alert-warning';
64
	}
55 65
}
56 66

  
57 67
$leases = system_get_dhcpleases();
......
261 271
	</div>
262 272
</div>
263 273

  
274
<nav class="action-buttons">
275
	<button id="cleararp" class="btn btn-danger no-confirm">
276
		<i class="fa fa-trash icon-embed-btn"></i>
277
		<?=gettext("Clear ARP Table")?>
278
	</button>
279
</nav>
280

  
264 281
<script type="text/javascript">
265 282
//<![CDATA[
266 283
// Clear the "loading" div once the page has loaded"
......
323 340
		}
324 341
	});
325 342

  
343
	$('#cleararp').click(function() {
344
		if (confirm("Are you sure you wish to clear ARP table?")) {
345
			postSubmit({cleararptable: 'true'}, 'diag_arp.php');
346
		}
347
	});
348

  
326 349
});
327 350
//]]>
328 351
</script>

Also available in: Unified diff