:::

3-6 增加Captive portal顯示使用者名稱--轉貼

 原文網址:http://203.68.236.4/html/modules ... cle.php?articleid=3

作者:黃建庭 (linux010101@yahoo.com.tw)

本篇文章使用系統
1. FreeBSD 5.3
2. m0n0 1.11 Release date:11/11/2004

一、 操作步驟
step1)建立工作資料夾
# cd $HOME
# mkdir devel
# mkdir devel/change
# mkdir devel/system
# cd devel

step2)下載m0n0的映像檔,上傳到$HOME/devel資料夾下
http://m0n0.ch/wall/download.php?file=generic-pc-1.11.img

step3)解壓縮generic-pc-1.11.img
# mv generic-pc-1.11.img generic-pc-1.11.img.gz
# gzip -d generic-pc-1.11.img.gz

step4)將m0n0的映像檔mount到作業系統
# mdconfig –a –t vnode –u 0 –f generic-pc-1.11.img
# mount /dev/md0a system/

step5)拷備m0n0的檔案資料到change資料夾。
# cp system/mfsroot.gz change/

step6)卸載m0n0的映像檔
# umount system/
# mdconfig -d -u 0

step7)解壓縮mfsroot.gz
# gzip -d change/mfsroot.gz

step8)不能直接存取mfsroot,需將mfsroot mount到作業系統
# mdconfig -a -t vnode -u 0 -f change/mfsroot
# mount /dev/md0 system/


step9)到目前為止,終於可以編輯m0n0的檔案,修改映像檔。
要增加顯示Captive portal的使用者名稱,需修改usr/local/www/ status_captiveportal.php此檔案
,紅色文字為新增修改地方。

Line 65-70:新增此行將$cpent[4]備份到$cpent[5]
if ($line) {
$cpent = explode(",", $line);
$cpent[5]=$cpent[4];
if ($_GET['showact'])
$cpent[4] = captiveportal_get_last_activity($cpent[1]);
$cpdb[] = $cpent;
}

Line90-94:新增表格標頭
<tr>
<td class="listhdrr"><a href="?order=ip&showact=<?=$_GET['showact'];?>">IP address</a></td>
<td class="listhdrr"><a href="?order=mac&showact=<?=$_GET['showact'];?>">MAC address</a></td>
<td class="listhdrr"><a href="?order=mac&showact=<?=$_GET['showact'];?>">User name</a></td>
<?php if ($_GET['showact']): ?> …

Line101-105:顯示使用者資料
<?php foreach ($cpdb as $cpent): ?>
<tr>
<td class="listlr"><?=$cpent[2];?></td>
<td class="listr"><?=$cpent[3];?></td>
<td class="listr"><?=$cpent[5];?></td>

新增此三部份,讓m0n0顯示使用者名稱

step10)卸載映像檔
# cd $HOME/devel
# umount system/
# mdconfig -d -u 0

step11)重新製作映像檔
# gzip -9 change/mfsroot
# mdconfig -a -t vnode -u 0 -f generic-pc-1.11.img
# mount /dev/md0a system/
# cp change/mfsroot.gz system/
# umount system/
# mdconfig -d -u 0
# gzip -9 generic-pc-1.11.img
# mv generic-pc-1.11.img.gz generic-pc-1.11.img

step12)登入m0n0,利用此新的映像檔,更新firmware。
#利用瀏覽器連線m0n0,登入後,點選System->Fireware->Enable firmware upload,上傳映像檔。

step13) 點選Status->Captive portal,出現以下畫面表示成功