Location: PHPKode > projects > Slashster > slashster/html/friends.php
<?

# Slashster: Open Source Friend of a Friend Software
# Copyright 2004 Mark El-Wakil
# Contact: hide@address.com
# http://seventhcycle.net
#
# This file is part of Slashster.
#
# Slashster is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Slashster is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Slashster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    import_request_variables("gPc");

    require_once("PageClass.php");

    $mpage = new PageClass("authonly");  
    $mpage->MembersOnly();

    $lvl = $mpage->UserDistance($id);

    if ($lvl < 0) $id = $mpage->IdNum;

    $sql = "select * from UserTable where Id = \"$id\" ";
    $sv = $mpage->DoQuery($sql,1);
    $sv = $sv[0];

    $sql = "select UserTable.* from FriendTable
            left join UserTable on UserTable.Id = FriendTable.End
            where Start=\"$id\" ";
    $r = $mpage->DoQuery($sql,1);

    $mpage->Initialize("authremainder"); 

?>

<BR>

<table width=600 border=1 cellspacing=0 align=center>
<tr><td align=center colspan=8 class="stdtable">
<B><?= ($sv[Id] == $mpage->IdNum) ? "Your" : $sv[Fname] . "'s" ?> 


Friends (<?= sizeof($r) ?>)</b>

<? if ($id == $mpage->IdNum) { ?>
[<a class="stdtxt" href="editfriends.php">Edit Friends</a>]
<? } ?>

</span>
</td></tr>

<?
   for ($x = 0; $x < sizeof($r); $x++)
   {
       if ($x % 8 == 0) echo "\n<tr>\n";
       ?>
          <td width=75 align=center class="stdaltfilling"><BR>
              <a href="user.php?id=<?= $r[$x][Id] ?>">
              <img border=0 width=48 height=36 src="userpics/<?= $mpage->PicPr($r[$x][PicDefault], $r[$x][Id]) 
              ?>-c.jpg"></a>
              <BR>
                  <small><a href="user.php?id=<?= $r[$x][Id] ?>"><?= $r[$x][Fname] ?>
                  <?= substr($r[$x][Lname], 0, 1) ?></a></small>
          </td>
       <?
       if ($x % 8 == 7) echo "\n</tr>\n";
   }

   for ($x; $x % 8 != 0; $x++)
   {
      echo "<td width=75 class=\"stdaltfilling\">&nbsp;</td>";
      if ($x % 8 == 7) echo "\n</tr>\n";
   }
?>

</table>
<BR><BR>



<? $mpage->ClosePage(); ?>

Return current item: Slashster