<%+header%>
<script>
function runscript(url) {
	var script = document.createElement('script');  
	script.setAttribute('src', url);
	document.getElementsByTagName('head')[0].appendChild(script);  
}
function doSet() {
    runscript( '/cgi-bin/luci/admin/oplus/moreconn_set/?myMax='+ encodeURIComponent(document.getElementById('myMax').value) +'&_r='+ Math.random() );
}
function onGet(c, m) {
    document.getElementById('spCurValue').innerHTML = c;
    document.getElementById('spCurMax').innerHTML = m;
}
function onSet(result) {
    if(result == 0) {
        document.getElementById('dvMsg').innerHTML = "<%:Adjustment succeeded %>";
        runscript( '/cgi-bin/luci/admin/oplus/moreconn_get/?_r'+ Math.random() );
    } else if(result == 1) {
        document.getElementById('dvMsg').innerHTML = "<font color=red><%:Illegal value %></font>";
    } else if(result == 9) {
		document.getElementById('dvMsg').innerHTML = "<a href='/cgi-bin/luci/admin/oplus/oplus'><font color=red><%:No valid license. Please activate your license first. %></font></a>";
	}
}

function doConnlimitSet() {
	runscript( '/cgi-bin/luci/admin/oplus/connlimit_set/?interfaces='+ encodeURIComponent(document.getElementById('interfaces').value) +
		'&connlimit='+ encodeURIComponent(document.getElementById('connlimit').value) +'&_r='+ Math.random() );
}
function on_connlimit_get(interfaces, connlimit) {
	document.getElementById('interfaces').value = interfaces;
	document.getElementById('connlimit').value = connlimit;
}
function on_connlimit_set(result) {
    if(result == 0) {
        document.getElementById('dvMsg').innerHTML = "<%:Adjustment succeeded %>";
    } else if(result == 1) {
        document.getElementById('dvMsg').innerHTML = "<font color=red><%:Illegal value %></font>";
    } else if(result == 9) {
		document.getElementById('dvMsg').innerHTML = "<a href='/cgi-bin/luci/admin/oplus/oplus'><font color=red><%:No valid license. Please activate your license first. %></font></a>";
	}
}
</script>
<br><br>
<b><%:This tool is used to adjust the limit of Active Connections. %></b>
<br><br>
<%:The limit on Active Connections is used to limit the number of concurrent connections in the network. %> <br>
<%:If the number of concurrent connections exceeds the limit, upcoming traffics will be rejected, thusly it causes network congestion. %>

<center>

<div id="dvMsg" style="color:#008800; font-size: larger; font-weight: bold; margin-top: 16px;"></div>

<br>
<div style="width:100%; border: 1px #ccc solid; padding:10px">
 <b><%:System Active Connections %></b><br>
<table>
	<tr style="height: 50px;">
		<td align="right"> <%:Current Active Connections %> : </td>
		<td> <span id="spCurValue"></span> </td>
	</tr>    
	<tr style="height: 50px;">
		<td align="right"> <%:Current Limit %> : </td>
		<td> <span id="spCurMax"></span> </td>
	</tr>
	<tr style="height: 50px;">
		<td align="right"> <%:Adjust To %> : </td>
		<td> 
            <input type="text" id="myMax" value="65536" style="width: 90px;" /> 
            <input type="button" style="background-color: #0055ff; color: #fff; width:100px; height: 36px;" value="<%:Set %>" onclick="doSet();" />
        </td>
	</tr>
</table>
<%:Note: Too many concurrent active connections may cause system crash in case of old devices with low memory or poor performance, please use with caution ! %>
</div>
</center>

<br><br>
<%:Setting a limit on Active Connections for each user's IP can prevent network congestion caused by individual users occupying excessive usage. %> <br><br>
<center>
<div style="width:100%; border: 1px #ccc solid; padding:10px">
<b><%:Active Connections Per IP %></b><br>
<table>
	<tr style="height: 50px;">
		<td align="right"> <%:Network Interface of LAN %> : </td>
		<td> <input type="text" id="interfaces" value="lan" />  </td>
	</tr> 
	<tr style="height: 50px;">
		<td align="right"> <%:Connection Limit (0 means no limit) %> : </td>
		<td> 
			<input type="text" id="connlimit" value="0" style="width: 90px;" /> 
			<input type="button" style="background-color: #0055ff; color: #fff; width:100px; height: 36px;" value="<%:Set %>" onclick="doConnlimitSet();" />
		</td>
	</tr>
</table>
</div>
<br>
<a href="http://www.wiwiz.com/pinpinwifi/oplus/help.htm" target="_blank"><%:Docs %></a>
<br><br>
Copyright &copy; 2025-<script>document.write(new Date().getFullYear());</script> <a href="http://www.wiwiz.com/pinpinwifi" target='_blank'>www.PinPinWiFi.com</a>. All rights reserved.
<br>
<%: We reserve the right to pursue legal responsibility for any unauthorized copying, distribution, cracking, reverse engineering, unauthorized use, etc. %>
<br>

</center>
</br></br>

<script>
    runscript( '/cgi-bin/luci/admin/oplus/moreconn_get/?_r'+ Math.random() );
	runscript( '/cgi-bin/luci/admin/oplus/connlimit_get/?_r'+ Math.random() );
</script>

<%+footer%>