Example #1
0
function display_friend_manage($pc, $err = "")
{
    $friendlist = pc_friend_list($pc["USER"]);
    ?>
<table cellspacing="0" cellpadding="5" border="0" width="99%" class="t1">
<tr>
	<td class="t2" width="25%">序号</td>
	<td class="t2">好友</td>
	<td class="t2">Blog</td>
	<td class="t2" width="25%">删除</td>
</tr>
<?php 
    for ($i = 0; $i < count($friendlist); $i++) {
        echo "<tr>\n<td class='t3'>" . ($i + 1) . "</td>\n" . "<td class='t4'><a href=\"/bbsqry.php?userid=" . $friendlist[$i] . "\">" . $friendlist[$i] . "</a></td>\n" . "<td class='t3'><a href=\"pcsearch.php?exact=1&key=u&keyword=" . $friendlist[$i] . "\">" . $friendlist[$i] . "</a></td>\n" . "<td class='t4'><a href=\"pcdoc.php?userid=" . $pc["USER"] . "&tag=5&act=delfriend&id=" . urlencode($friendlist[$i]) . "\">删除</a></td>\n</tr>\n";
    }
    ?>

<form action="pcdoc.php" method="get" onsubmit="if(this.id.value==''){alert('请输入好友用户名!');return false;}">
<tr>
	<td colspan="3" align="center">
	<input type="hidden" name="act" value="addfriend">
	<input type="hidden" name="tag" value="5">
	<input type="hidden" name="userid" value="<?php 
    echo $pc["USER"];
    ?>
">
	<input type="text" size="12" name="id" id="id" class="b2">
	<input type="submit" value="添加好友" class="b1">
<?php 
    echo $err;
    ?>
	</td>
</tr>
</form>
</table>
<?php 
}
Example #2
0
function pc_del_friend($id, $uid)
{
    $friendlist = pc_friend_list($uid);
    if ($file = pc_friend_file_open($uid, "w")) {
        $fp = $file["FP"];
        for ($i = 0; $i < count($friendlist); $i++) {
            if (strtolower($id) != strtolower($friendlist[$i])) {
                fputs($fp, $friendlist[$i] . "\n", strlen($friendlist[$i]) + 2);
            }
        }
        pc_friend_file_close($fp);
    }
}