Location: PHPKode > projects > Slashster > slashster/html/addtestimonial.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
# 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



    $mpage = new PageClass("authonly");  

    if ($mpage->UserDistance($id) != 1)
        echo "This person is not your friend";

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

    $errmsg = ""; 
    if ($submit)
        $txt = trim($txt);
        if (strlen($txt) < 50)
            $errmsg = "Please enter in at least 50 characters for a testimonial";

        if (!$errmsg)
            $sql = "select * from Testimonials where 
                     Start = $mpage->IdNum AND
                     End = \"$id\" AND date_sub(NOW(), interval 1 day) < Dte";
            $sv = $mpage->DoQuery($sql);

            if (sizeof($sv))
                $errmsg = "You already submitted a testimonial less than
                           24 hours ago";


    if ($submit && !$errmsg)
         $mpage->TestimonialRequest($mpage->IdNum, $id, $txt);
         echo "<P class=title1>Thank You</p>";
         echo "<P>Your request to be this person's ";
         echo "friend has been sent and is now pending.";


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

<form method=post>

<b class="title1">Create Testimonial for <?= $r[Fname] ?> 
<?= substr($r[Lname],0,1) ?>.</b>

<? if ($errmsg) { ?>

<table border=4 bordercolor=red cellspacing=0 cellpadding=5px>
<tr><td style="font: bold 16px arial; color:red;">
Error: <?= $errmsg ?>

<? } ?>

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

You are about to create a testimonial for 
<B><?= $r[Fname] ?> <?= substr($r[Lname], 0, 1) ?>.</b>

<P><B><?= $r[Fname] ?></b> will be notified, and has the option to either approve
or reject the testimonial you create for him/her.

<BR><B>Your testimonial</b><BR>
<textarea name="txt" style="width:500" rows=7>
<?= htmlentities($txt) ?>
<div style="width:500" align=center>
<B>(Sorry, no HTML allowed)</b>


<table width=100%>
<tr><td width=200>

<table class="submit"><tr><td>
 <a href="user.php?id=<?= $r[Id] ?>">Cancel</a>

 <input type="submit" class="submit" name="submit" value="Add Testimonial">


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

Return current item: Slashster