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

    $msg = "";

    if ($delete)
    {
        $lvl = $mpage->UserDistance($delete);
        
        if ($lvl != 1)
        {
             $msg = "This Person is not your friend.";
             $mpage->ClosePage();
        }
        else
        {
             $msg  = "Are you sure you wish to delete this testimonial?";
             $msg .= "<BR>[<a href=\"edittestimonials.php\">Cancel</a>]&nbsp;&nbsp;&nbsp;";
             $msg .= "[<a href=\"edittestimonials.php?id=$delete\">Delete</a>]";
        }

    } 
    elseif ($id)
    {
        $lvl = $mpage->UserDistance($id);
     
        if ($lvl != 1)
        {
             $msg = "This Person is not your friend.";
             $mpage->ClosePage();
        }
        else
        {
             $sql = "delete from Testimonials where End=$mpage->IdNum && Id=\"$id\" ";
             $mpage->DoQuery($sql);


             $msg  = "Thank you.  This testimonial has been deleted.";

        }
    }


   $sql = "select Testimonials.*, UserTable.Fname, UserTable.PicDefault, UserTable.Lname
           from Testimonials
           left join UserTable on Testimonials.Start = UserTable.Id
           where End=$mpage->IdNum AND Approved=1";
   $m = $mpage->DoQuery($sql,1);


?>

<? if ($msg) { ?>


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

<? } ?>



<BR>
<table cellspacing=0 width=400 align=center>
<tr><td align=center class=stdtable colspan=2>
<B>Your Testimonials</b>
</td></tr>

<? if (!sizeof($m)) { ?>

<tr><td align=center class=stdfilling colspan=2>
  You currently have no testimonials.
</td></tr>

<? } ?>


<? foreach ($m as $n) { ?>

<tr><td align=center valign=top class=stdfilling width=100>
<a href="user.php?id=<?= $n[Start] ?>"><img border=0 src="userpics/<?= $mpage->PicPr($n[PicDefault], $n[Start]) 
?>-b.jpg"></a>
<BR><small><a href="user.php?id=<?= $n[Start] ?>"><?= $n[Fname] ?> <?= substr($n[Lname],0,1) 
?></a></small>

<? if ($delete == $n[Id]) { ?>

<BR><BR>
<span style="color:red;"><B>Delete?</b></span>

<? } ?>

</td><td class=stdfilling>
<?= str_replace("\r\n", "<BR>", htmlentities($n[Txt])) ?>

<BR><BR>
&nbsp;<small>[<a href="edittestimonials.php?delete=<?= $n[Id] ?>">Delete this 
Testimonial</a>]</small>
<BR><BR>

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


</table>
<BR><BR>





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

Return current item: Slashster