<?php
$file = __FILE__;
include ("inc/inc_common.php");
include ("inc/inc_connect.php");
include ("inc/inc_admincheck.php");
include ("inc/inc_getdate.php");
include ("inc/inc_forumname.php");
$page = "My Buddies";
$pagelink = $file;
include("inc/inc_setonline.php");
$title = "My Buddies";
include ("inc/inc_head.php");
include ("inc/inc_body.php");
$title = "My Buddies";
include ("inc/inc_title.php");

print "</centeR><table border=0 width=\"100%\" cellpadding=1 cellspacing=0><tr><td  width=\"20%\">
<table border=0 cellpadding=1 cellspacing=0><tr><td>
<font face=\"$font\" size=$fontsize><image src=\"images/folder_icon.gif\">&nbsp;<a href=\"index.php\">$name1&nbsp;Home</a>
</td></tr>
<tr><td><image src=\"images/folder_line.gif\">
<font face=\"$font\" size=$fontsize><image src=\"images/open_folder_icon.gif\">&nbsp;My Buddies</td></tr>
</table>
</td><td><center>";

include ("inc/inc_navigation.php");
include ("inc/inc_newmailsdisplay.php");
print "</td></tr></table><br><center><table border=1 bordercolor=\"$bordercolor\" cellpadding=15 cellspacing=0 bgcolor=\"$fgcolour\"><tr><td align=\"center\"><font size=\"$fontsizeb\" color=\"$fontcolor\" face=\"$font\"><bR><b>Your buddies are...</b><br><br><table border=0 cellpadding=2 cellspacing=0>";

//end of include files...

if ($action == "delete")
{
    $query = "DELETE FROM $buddytable WHERE intId = '$delid'";
    mysql_query( $query, $link )
    or die ( "Could not delete from \"$buddytable\" table: "
    .mysql_error() );
}


$result = mysql_query( "SELECT * FROM $buddytable WHERE strName = '$gfcookie[1]'" );
$num_rows = mysql_num_rows( $result );
//Display Records
while ( $a_row = mysql_fetch_object( $result ) )
{
    print "<tr><td>
    <a title=\"Delete $a_row->strBuddyName from your buddy list\" OnClick=\"return confirm('Are you sure you want to delete $a_row->strBuddyName from your list?')\" href=\"buddymenu.php?groupid=$groupid&userid=$userid&delid=$a_row->intId&action=delete\"><img border=0 src=\"images/delete_sm.gif\"></a>

    <a title=\"Send an instant message to $a_row->strBuddyName\" href=\"inbox_create.php?to=$a_row->strBuddyName\"><img border=0 src=\"images/pm_icon.gif\"></a>&nbsp;</td>


    <td><font face=$font size=2><a title=\"See $a_row->strBuddyName's profile\" href=\"profile.php?userid=$a_row->strBuddyName&groupid=$groupid\">$a_row->strBuddyName</a></td></tr>";
}


$result = mysql_query( "SELECT * FROM $buddytable WHERE strBuddyName = '$gfcookie[1]'" );
$num_rows = mysql_num_rows( $result );
if ( $num_rows > 0 )
{
    print "</table><br><br><b>The following people have you as their buddy...</b><br><br><table border=0 cellpadding=0 cellspacing=0>";

    //Display Records
    while ( $a_row = mysql_fetch_object( $result ) )
    {
        print "<tr><td><a title=\"Add $a_row->strName to your buddy list\" href=\"addbuddy.php?name=$gfcookie[1]&buddyname=$a_row->strName&topicid=prof&groupid=$groupid\"><img border=0 src=\"images/add_buddy_sm.gif\"></a>&nbsp;</td><td><font face=$font size=2><a title=\"See $a_row->strName's profile\" href=\"profile.php?userid=$a_row->strName&groupid=$groupid\">$a_row->strName</a><br>";
        print "</td></tr>";
    }
}
print "</table><font size=\"$fontsize\"><br></td></tr></table>";
include ("inc/inc_footer.php");