"ESP-3DES-SHA", "ESP-3DES-MD5" => "ESP-3DES-MD5", "ESP-AES-256-SHA" => "ESP-AES-256-SHA", "ESP-AES-256-MD5" => "ESP-AES-256-MD5" ); $t = new Template(); $t->set_file('main','index.htm'); $t->set_file('menu_strip','menu_strip.htm'); $t->parse('_menu_strip','menu_strip'); $t->set_block('main','vpn','_vpn'); $t->set_block('main','port_forward','_port_forward'); if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) { copy_vars(); redirect('generate.php'); } $fieldlist = array('hostname','domain_name','password','enable_password', 'LAN_IP','LAN_subnet','WAN_IP','WAN_subnet','gateway','DNS1'); foreach ( $fieldlist as $field ) { $t->set_var($field,$_SESSION[$field]); } // VPN Tunnels $tunnel_name = $_SESSION['tunnel_name']; $max = sizeof($tunnel_name); if ( $max ) { for($i=0;$i<$max;$i++) { $t->set_var('tunnel_name',$tunnel_name[$i]); $t->set_var('remote_ip',$remote_ip[$i]); $t->set_var('remote_network',$remote_network[$i]); $t->set_var('remote_subnet',$remote_subnet[$i]); $t->set_var('transform_set',options($tsets,$transform_set[$i])); $t->set_var('preshared_key',$preshared_key[$i]); $t->parse('_vpn','vpn',true); } } else { $t->set_var('tunnel_name',''); $t->set_var('remote_ip',''); $t->set_var('remote_network',''); $t->set_var('remote_subnet','255.255.255.0'); $t->set_var('transform_set',options($tsets)); $t->set_var('preshared_key',''); $t->parse('_vpn','vpn',true); } // Port Forwarding $port = $_SESSION['port']; $max = sizeof($port); if ( $max ) { for($i=0;$i<$max;$i++) { $t->set_var('port',$port[$i]); $t->set_var('local_ip',$local_ip[$i]); $t->parse('_port_forward','port_forward',true); } } else { $t->set_var('port',''); $t->set_var('local_ip',''); $t->parse('_port_forward','port_forward',true); } // DHCP if ( $_SESSION['DHCP_enable'] == '1' ) { $t->set_var('DHCP_enable','checked'); $t->set_var('DHCP_start',$_SESSION['DHCP_start']); $t->set_var('DHCP_end',$_SESSION['DHCP_end']); $t->set_var('DHCP_DNS',$_SESSION['DHCP_DNS']); $t->parse('_dhcp','dhcp'); } $t->pparse('_main','main'); function copy_vars() { global $vars; foreach ( $vars as $var ) { $_SESSION[$var] = $_REQUEST[$var]; } } ?>