2 require('../conf/config.php3');
4 if ($login == 'da_server_test'){
5 $login = $config[general_test_account_login];
12 <title>test user $login</title>
13 <meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
14 <link rel="stylesheet" href="style.css">
16 <body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
18 <table border=0 width=550 cellpadding=0 cellspacing=0>
20 <td align=center><img src="images/title2.gif"></td>
24 <table border=0 width=400 cellpadding=0 cellspacing=2>
28 include("../html/user_toolbar.html.php3");
34 <table border=0 width=540 cellpadding=1 cellspacing=1>
37 <td bgcolor="black" width=200>
38 <table border=0 width=100% cellpadding=2 cellspacing=0>
39 <tr bgcolor="#907030" align=right valign=top><th>
44 <font color="white">Radius Server Test Page</font>
48 <font color="white">User $login Test Page</font>
55 <tr bgcolor="black" valign=top><td colspan=2>
56 <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
60 if ($server == '' || !preg_match('/^[\w\.]+$/',$server))
61 $server = $config[general_radius_server];
62 if ($port == 0 || !is_numeric($port))
63 $port = $config[general_radius_server_port];
64 if ($auth_proto == '')
65 $auth_proto = $config[general_radius_server_auth_proto];
66 $selected[$auth_proto] = 'selected';
69 $tmp_file = tempnam("$config[general_tmp_dir]",'DA');
70 $req=file($config[general_auth_request_file]);
71 if ($config[general_ld_library_path] != '')
72 putenv("LD_LIBRARY_PATH=$config[general_ld_library_path]");
73 $comm = $config[general_radclient_bin] . " $server:$port" . ' auth ' . $config[general_radius_server_secret]
75 $fp = popen("$comm","w");
77 foreach ($req as $val){
79 if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
85 fwrite($fp, "User-Name = \"$config[general_test_account_login]\"\n");
86 fwrite($fp, "User-Password = \"$config[general_test_account_password]\"\n");
90 fwrite($fp, "User-Name = \"$login\"\n");
91 if ($auth_proto == 'chap')
92 fwrite($fp, "CHAP-Password = \"$passwd\"\n");
94 fwrite($fp, "User-Password = \"$passwd\"\n");
99 $reply = file($tmp_file);
101 $msg = "<b>" . strftime('%A, %e %B %Y, %T %Z') . "</b><br>\n";
102 $msg .= "<b>Server: </b><i>$server:$port</i><br><br>\n";
103 if (ereg('code 2', $reply[0]))
104 $msg .= "<b>Authentication was <font color=green>successful</font>";
105 else if (ereg('code 3',$reply[0]))
106 $msg .= "<b>Authentication <font color=red>failed</font>";
107 else if (ereg('no response from server', $reply[0]))
108 $msg .= "<b><font color=red>No response from server</font>";
109 else if (ereg('Connection refused',$reply[0]))
110 $msg .= "<b><font color=red>Connection was refused</font>";
112 $msg .= "</b><i> (test user $login)</i><br>\n";
114 $msg .= "</b><br>\n";
117 $msg .= "<br><b>Server response:</b><br>\n";
118 foreach ($reply as $val){
119 $msg .= "<i>$val</i><br>\n";
140 <input type=hidden name=login value=<?php print $login ?>>
141 <input type=hidden name=test_user value="0">
142 <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
144 <td align=right bgcolor="#d0ddb0">
148 <input type=password name=passwd value="<?php print $passwd ?>" size=25>
152 <td align=right bgcolor="#d0ddb0">
156 <input type=text name=server value="<?php print $server ?>" size=25>
160 <td align=right bgcolor="#d0ddb0">
164 <input type=text name=port value="<?php print $port ?>" size=25>
168 <td align=right bgcolor="#d0ddb0">
172 <textarea name="extra" cols="35" wrap="PHYSICAL" rows="4"><?php print $extra ?></textarea>
176 <td align=right bgcolor="#d0ddb0">
177 Authentication Protocol
182 <select name="auth_proto" editable>
183 <option $selected[pap] value="pap">PAP
184 <option $selected[chap] value="chap">CHAP
193 <input type=submit class=button value="Run Test" OnClick="this.form.test_user.value=1">
196 if ($test_user == 1){