Location: PHPKode > projects > Slashster > slashster/html/confirmtestimonial.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 Testimonials where Id = \"$id\" AND End=$mpage->IdNum AND Approved=0";
        $g = $mpage->DoQuery($sql);

        if (sizeof($g))
        {
           $confdeny = ($op == "c") ? 1 : 0;

           if ($confdeny)
           {
              $sql = "update Testimonials set Approved=1 where Id = \"$id\" ";
              $msg = "This testimonial has been added";
           }
           else
           {
              $sql = "delete from Testimonials where Id = \"$id\" ";
              $msg = "Testimonial denied and deleted.";
           }
           $mpage->DoQuery($sql);
        }
        else
        {
           $msg = "No such pending testimonial";
        }
    }

    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.*, Testimonials.txt, Testimonials.Id as Id, UserTable.Id as uid
            from Testimonials
            left join UserTable on UserTable.Id = Testimonials.Start
            where Testimonials.End = $mpage->IdNum AND Approved=0";
    $r = $mpage->DoQuery($sql,1);

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


?>

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

<form method=post>

<b class="title1">Your Pending Testimonials</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[uid]) ?>-b.jpg" width=80 height=60>
</td><td width=400>

<table cellspacing=0>
<tr><td class="stdtable"><B>Name</b>:</td>
    <td class="stdaltfilling"> <?= $s[Fname] ?> <?= $s[Lname] ?></td></tr>
<tr><td class="stdtable"><B>Email</b>:</td>
    <td class="stdaltfilling"> <?= $s[Email] ?> </td></tr>
<tr><td class="stdtable" valign=top><B>Text</b>:</td>
    <td class="stdaltfilling"><?= str_replace("\r\n", "<BR>", htmlentities($s[txt])) ?></td></tr>
<tr><td class="stdtable">&nbsp;</td>
    <td class="stdtable">

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

</td></tr>

</table>
<BR>

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

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

Return current item: Slashster