<?php

/**
 * @file
 * popup window for playing recording
 */

chdir("..");

include "./includes/variables.php";
include "./misc/database.php";

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="icon" href="../includes/images/favicon.ico" type="image/x-icon">
<script>
function resize(){
	if(window.sizeToContent) window.sizeToContent();
}
function closeW(){
this.window.close();
}
</script>
<TITLE>Network Configuration</TITLE>
<link rel="stylesheet" href="../includes/template_css.css" type="text/css">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body onload="resize();">
<center>
<?php
@session_start();
if((isset($_SESSION['beroari_time']))&&(($_SESSION['beroari_time']+1200)<time())){
        @session_unset();
        @session_destroy();
        echo "<script>window.opener.location='../index.php?m=sip'</script>";
        echo "<script>this.window.close();</script>";
}else{
        $_SESSION['beroari_time']=time();
}

$lastip = exec('/sbin/ifconfig eth0 | sed -ne "s/.*inet addr:\(.*\) Bcast.*/\1/p"');
$ba= new beroAri();
echo "<script>window.opener.location='../index.php?m=net_conf'</script>";
print "<br><table align=\"center\" bgcolor=\"#f0f0ec\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"450\">
<colgroup>
<col width=\"39\"></col>
</colgroup>
<tbody><tr>
<td colspan=\"2\"><img src=\"../includes/images/bg_topindex.png\"></td>
</tr>
<tr>
<td background=\"../includes/images/bg_left.png\" width=\"30\"><img src=\"../includes/images/trans.gif\" height=\"10\" width=\"39\"></td>
<td><p align='left'><img src=\"../includes/images/berofixlogo.png\"/></p><hr size= \"1\" noshade><p><center><font size='3'>Network Configuration</font></p><br><br>";

echo" <form class='beroari_form' name='net_conf' action='netconfig_submit.php' method='POST'>
	<input type=hidden name=last_ip value=".$lastip.">
	<input type=hidden name=m value=" . $m . ">
	<br/>
            <table class='netconf'>
            <tr>
            <td><input type='radio' name='mode' value='dhcp' onclick=\"javascript:var div_st = document.getElementById('div_static');
            div_st.innerHTML='';\"></td><td>DHCP</td>
            </tr>
            <tr>
            <td><input type='radio' name='mode' id='static' value='static' onclick=\"javascript:var div_st = document.getElementById('div_static');
                    div_st.innerHTML='<table class=\'preferences\'><tr><td>IP Address:</td><td><input type=\'text\' name=\'ip\' id=\'ip\'></td></tr><tr><td>Netmask:</td><td><input type=\'text\' name=\'netmask\'></td></tr><tr><td>Gateway:</td><td><input type=\'text\' name=\'gateway\'></td></tr><tr><td>Primary DNS:</td><td><input type=\'text\' name=\'primary\'></td></tr><tr><td>Secondary DNS:</td><td><input type=\'text\' name=\'secondary\'></td></tr></table>';\"></td><td>Static</td>
            </tr>
            </table>
            <div id='div_static'></div>
            <br>
            <input type=Submit value=Save onmouseover=\"Tip('".HARDWARE_NETCONFIG_MOD_SAVE."')\" onmouseout='UnTip()'>
			<br>
            </form>";
print "<hr size= \"1\" noshade>";
print "<br><a href=\"http://www.beronet.com\" target=\"_blank\" onfocus=\"if (this.blur()) { this.blur(); }\"><img src=\"../includes/images/beroLogo.gif\" align=\"right\" border=\"0\"></a>";
print "</center></td></tr>
<tr>
<td colspan=\"2\" style=\"background-repeat:no-repeat\" background=\"../includes/images/bg_bottom.png\"><img src=\"../includes/images/trans.gif\" border=\"0\" height=\"39\" width=\"10\"><div style=\"color: white;\" align=\"right\">&nbsp;&nbsp;&nbsp;</div>
</td></tr></table>";
?>
</center>
</body>
</html>

