Location: PHPKode > projects > Slashster > slashster/html/confirmfriend.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();
    $mpage->VerifiedOnly();
    $mpage->Initialize("authremainder"); 

    $msg = "";

    if ($id && in_array($op, array("c","d")))
    {
        $sql = "select * from FriendRequest where Start = \"$id\" AND End=$mpage->IdNum";
        $g = $mpage->DoQuery($sql);

        if (sizeof($g))
        {
           $confdeny = ($op == "c") ? 1 : 0;
           $mpage->AddFriend($mpage->IdNum, $id, $confdeny);

           if ($op == "c") $msg = "Your friendship with this person has been confirmed.";
           if ($op == "d") $msg = "You have denied friendship with this person";
        }
        else
        {
           $msg = "No such friend request";
        }
    }

    if ($msg) { ?>

<P><BR>
<table border=4 bordercolor=red cellspacing=0 cellpadding=5px>
<tr><td style="font: bold 16px arial; color:red;">
<?= $msg ?>
</td></tr>
</table>
<P>
    
    <? } 


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


    if (!sizeof($r))
    {
        echo "<P>Sorry, you don't have any friend requests at the moment.";
        $mpage->ClosePage();
    }


?>

<BR>
<table width=700 border=0>
<tr><td width=700 valign=top>

<form method=post>

<b>Add Friend</b>
<br><BR>
<table border=1 cellspacing=0>
<? foreach ($r as $s) { ?>
<tr><td width=100 valign=middle align=center>
<img src="userpics/<?= $mpage->PicPr($s[PicDefault], $s[Id]) ?>-b.jpg" width=80 height=60>
</td><td width=400>

<table>
<tr><td><B>Name</b>:</td><td> <?= $s[Fname] ?> <?= $s[Lname] ?></td></tr>
<tr><td><B>Email</b>:</td><td> <?= $s[Email] ?> </td></tr>
</table>

<P>What would you like to do?<BR>
<small>
[<a href="confirmfriend.php?op=c&id=<?= $s[Id] ?>">confirm</a>] 
[<a href="confirmfriend.php?op=d&id=<?= $s[Id] ?>">deny</a>]
</small>


</td>
</tr>
<? } ?>
</table>

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

Return current item: Slashster