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

    $r = $r[0];


    $errmsg = "";

    if ($submit)
    {
         if (!$txt)
         {
             $errmsg = "No text for your bug report";
         }
    }


    if (!$errmsg && $submit && !$mpage->LoggedIn)
    {
         if (!$name)
         {
             $errmsg = "Please enter your name";
         }

         $vml = (!preg_match ("/^[\w\.\-]+\@[\w\.\-]+\.[a-z]{2,4}$/i", $email));

         if (!$errmsg && $vml)
         {
             $errmsg = "Please enter a valid email address";
         }
    }
    elseif ($mpage->LoggedIn)
    {
         $name = $mpage->user[Fname] . " " . $mpage->user[Lname];
         $email = $mpage->user[Email];
    }



    if ($submit && !$errmsg)
    {
          $tx  = "Report:\n\n";
          $tx .= "Name  : $name\n";
          $tx .= "Email : $email\n";  

          $tx .= "Description:\n\n$txt";

          mail($mpage->adm[email], $mpage->sys[sitename] ." Report", $tx);

          $mpage->Initialize("authremainder");

          echo "<P class=\"title1\">Thank You</p>";
          echo "<P>Your bug report has been sent and will be dealt with accordingly.";
          $mpage->ClosePage();
    }


    $mpage->Initialize("authremainder"); 

?>




<form method=post>

<table width=600 align=center><tr><td>

<? if ($errmsg) { ?>


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

<? } ?>



<span class="title1">Bug Reporting</span>

<P>
Help!  <?= $mpage->sys[sitename] ?> is by no means a complete site.  If you see any kind of errors appear 
on the site,
please feel free to tell us.

<P><B>What's the nature of this bug report?</b>
<P>

<? if ($mpage->LoggedIn) { ?>

<table>
  <tr><td>Name</td>
  <td><?= $mpage->user[Fname] ?> <?= $mpage->user[Lname] ?></td>
  <tr><td>Your Email</td>
      <td><?= $mpage->user[Email] ?></td>
  </tr>
</table>

<? } else { ?>

<table>
  <tr><td>Name</td>      <td><input name="name" value="<?= htmlentities($name) ?>"></td></tr>
  <tr><td>Your Email</td><td><input name="email" value="<?= htmlentities($email) ?>"></tr>
</table>



<? } ?>



<P>

<textarea name="txt" cols=50 rows=5>
<?= htmlentities($_POST[txt]) ?>
</textarea>

<P>

<input type="submit" class="submit" name="submit" value="Report">
<BR>

<BR>
 <a class="submit" href="user.php?id=<?= $r[Id] ?>">&nbsp;&nbsp;Cancel&nbsp;&nbsp;</a>
<BR><BR>

</td></tr></table>
</form>



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

Return current item: Slashster