[ PHPXref.com ] [ Generated: Sun Jul 20 17:50:08 2008 ] [ Flip 3.0 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> contact.php (source)

   1  <?php
   2  
   3  # Flip 3 (Flatfile PHP Weblog)

   4  # copyright 2002-2003, Adam Scheinberg

   5  # http://flipsource.org

   6  # http://www.sourceforge.net/projects/flipsource

   7  
   8  # This is free software.  

   9  # You may use this software however you wish, provided you leave 

  10  # the above copyright notices intact. 

  11  
  12  # contact.php

  13      
  14      require ("config.php");
  15      require_once($header);
  16  
  17  $redirect = $newshome;    //URL user is sent to after submit

  18  
  19  //preset some vars 

  20  $incomplete = FALSE;
  21  
  22  if(!empty($_GET['author'])) { $author = $_GET['author']; $showauth = "yes"; }
  23  if(!empty($_GET['subj'])) { $subject = htmlspecialchars(urldecode($_GET['subj'])); $showsubj = "yes";}
  24  if(!empty($_POST['author'])) { $author = $_POST['author']; } 
  25  if(!empty($_POST['subject'])) { $subject = $_POST['subject']; }
  26  if(!empty($_POST['Name'])) { $Name = $_POST['Name']; }
  27  if(!empty($_POST['Comments'])) { $Comments = $_POST['Comments']; }
  28  if(!empty($_POST['Email'])) { $Email = $_POST['Email']; }
  29  
  30  if($author) { $author = urldecode($author); }
  31  
  32  foreach($_POST as $pstyle => $postval) { 
  33      if(trim($postval) == "") { 
  34          $styleF[$pstyle] = "red"; 
  35          $styleW[$pstyle] = "bold"; 
  36      } else { 
  37          $styleF[$pstyle] = "black"; 
  38          $styleW[$pstyle] = "normal";
  39      }
  40  }
  41  
  42  if((isset($author)) && (!isUsername($author))) { 
  43      echo "There is no user " . trim($author) . " who you can contact via this form.<br /><br />\n";
  44      echo "<a href=\"" . $self . "\">Try Again</a>";
  45      include($footer); 
  46      exit;
  47      }
  48  
  49  
  50  
  51  //this gets some info to send along with the form...

  52  
  53    $ip = getenv('REMOTE_HOST'); 
  54    if(!$ip){ 
  55      $ip = getenv('REMOTE_ADDR'); 
  56    } 
  57    if(!$ip){ 
  58      $ip = $REMOTE_ADDR; 
  59    } 
  60    if(!$ip){ 
  61      $ip = $REMOTE_HOST; 
  62    } 
  63  
  64    $real_host = @GetHostByAddr($ip); 
  65  
  66        if($real_host){ 
  67          $host_arr=explode(".", $real_host); 
  68          $count=count($host_arr); 
  69          if($count > 1){ 
  70            if(intval($host_arr[$count-1])!=0){ 
  71              $host=substr($real_host,0,strrpos($real_host,".")).".---"; 
  72            } 
  73            else{ 
  74              $host = "---".strstr($real_host, "."); 
  75            } 
  76          } 
  77          else{ 
  78            $host=$real_host; 
  79          } 
  80        } 
  81        else{ 
  82          $host=""; 
  83        } 
  84  
  85  $ipaddr = getenv("REMOTE_ADDR");       
  86  $now = date("d F Y h:i A");
  87  $browserinfo = getenv("HTTP_USER_AGENT"); 
  88  ?>
  89  
  90  <body bgcolor="<?=$bodybgcolor;?>">
  91  <center>
  92  
  93  <table width="100%" border="0"><tr>
  94  
  95  <td width="<?php echo $sidebarwidth;?>%" valign="top">
  96  <?php if(file_exists($leftnav)) { include($leftnav); } ?>
  97  </td>
  98  <td width="<?php echo $mainbarwidth;?>%" align="center" valign="top">
  99  <br /><br />
 100  <table width="<?=$tablewidth?>"><tr><td width="100%" align="center">
 101  
 102  <br /><br />
 103  <img src="./img/weblog.png" alt="log">&nbsp;
 104  <?php
 105  if(isset($author)) { echo "<br /><span style=\"font-family:tahoma;font-size:10pt;\">generating an e-mail to " . $author . "</span>"; 
 106  echo "<br /><span style=\"font-family:tahoma;font-size:10pt;\">see other items submitted by ";
 107  echo "<a href=\"" . $allnews . "?author=" . urlencode($author) . "\">" . $author . "</a></span>";
 108  }
 109  ?>
 110  <br><br>
 111  
 112  <table border="1" width="85%"><tr>
 113  <td bgcolor="#D3D3D3"><center>
 114  <br />
 115  <?php
 116  
 117  if (($Name == "") || ($Email == "") || ($Comments == "") || ($subject == ""))
 118  {
 119      $incomplete = TRUE; 
 120      echo "<form name=\"form\" method=\"post\" action=\"" . $self . "\">";
 121      echo "<p>All fields of this e-mail are required.</p>";
 122      echo "<p>Empty fields are listed below.</p>\n";
 123      echo "<table border=\"0\" width\"=90%\"><tr>\n";
 124      echo "<tr><td align=left><span style=\"font-family:tahoma,arial;font-size:12px;\">To:</td>";
 125      echo "<td align=\"left\" style=\"font-size:10pt\">";
 126      echo "<select name=\"author\">\n";
 127      $uf = file($userfile) or die("Could not open user database.");
 128      foreach($uf as $userInfo)
 129      {
 130          $usrnfo = explode("][", $userInfo);     
 131          if (trim($usrnfo[4]) > 1) {
 132              $cont_admins[] = $usrnfo[1]; } 
 133          elseif (trim($usrnfo[4]) == 1) {
 134              $cont_mods[] = $usrnfo[1]; }
 135          sort($cont_admins);
 136          sort($cont_mods); 
 137      }
 138          foreach($cont_admins as $ca) {
 139              echo "<option value=\"" . urlencode($ca) . "\"";
 140              if ($ca == $author) { echo " selected=\"selected\""; }
 141              echo ">" . $ca . " (admin)</option>\n";     }
 142          foreach($cont_mods as $cm) {
 143              echo "<option value=\"" . urlencode($cm) . "\"";
 144              if ($cm == $author) { echo " selected=\"selected\""; }
 145              echo ">" . $cm . " (moderator)</option>\n";     }
 146          if( (isset($author)) && (isAdmin($author) < 1) ) { 
 147              echo "<option value=\"" . urlencode($author) . "\"";
 148              echo " selected=\"selected\""; 
 149              echo ">" . $author . " </option>\n";     }
 150      echo "</select>\n";
 151      echo "</td></tr>";
 152  
 153  }
 154  
 155      if($incomplete == TRUE) { 
 156          echo "<tr><td align=\"left\"><span style=\"font-family:tahoma,arial;color:".$styleF['Name'].";font-weight:".$styleW['Name'].";";
 157          echo "font-size:12px;\">Your Name:</td>\n<td align=\"left\">";
 158          echo "<input type=\"text\" name=\"Name\" value=\"" . stripslashes($Name) . "\" size=\"110\">\n";
 159          echo "</td></tr>";
 160      } else {  
 161          echo "<input type=\"hidden\" name=\"Name\" value=\"" . stripslashes($Name) . "\">\n";
 162      }
 163  
 164      if($incomplete == TRUE) { 
 165          echo "<tr><td align=\"left\"><span style=\"font-family:tahoma,arial;color:".$styleF['subject'].";font-weight:".$styleW['subject'].";";
 166          echo "font-size:12px;\">Subject:</td>\n<td align=\"left\">";
 167          echo "<input type=\"text\" name=\"subject\" value=\"" . stripslashes($subject) . "\" size=\"110\">\n";
 168          echo "</td></tr>";
 169      } else {  
 170          echo "<input type=\"hidden\" name=\"subject\" value=\"" . trim(stripslashes($subject)) . "\">\n";
 171      }
 172  
 173  
 174      if($incomplete == TRUE) { 
 175          echo "<tr><td align=\"left\"><span style=\"font-family:tahoma,arial;color:".$styleF['Email'].";font-weight:".$styleW['Email'].";";
 176          echo "font-size:12px;\">Your Email:</td>\n<td align=\"left\">";
 177          echo "<input type=\"text\" name=\"Email\" value=\"" . stripslashes($Email) . "\" size=\"110\">\n";
 178          echo "</td></tr>";
 179      } else {  
 180          echo "<input type=\"hidden\" name=\"Email\" value=\"" . trim(stripslashes($Email)) . "\">\n";
 181      }
 182  
 183  if ($incomplete == TRUE)
 184  {
 185      echo "<tr><td align=\"left\"><span style=\"font-family:tahoma,arial;font-size:12px;\">Header:</td>\n";
 186      echo "<td align=\"left\"><span style=\"font-family:tahoma,arial;font-size:12px;\">$host: $ipaddr ";
 187      echo "[<i>this information will be transmitted to the the author</i>]</td></tr>\n";
 188  }
 189  
 190  if($incomplete == TRUE) { 
 191      echo "<tr><td align=\"center\" colspan=\"2\"><textarea name=\"Comments\" rows=\"5\" ";
 192      echo "cols=\"90\">" . trim(stripslashes($Comments))  . "</textarea></td></tr>\n";
 193      } 
 194  
 195  
 196  if ($incomplete == TRUE)
 197  {
 198  
 199      echo "</b><tr><td colspan=\"2\" align=\"center\"><br><br>\n";
 200      echo "<input type=\"submit\" value=\"Submit Form\" border=\"0\" style=\"background-color:$bodybgcolor;";
 201      echo "color:$bodytextcolor;font-weight:bold;\">";
 202      echo "</form>\n";
 203      echo "</td></tr></table>\n";
 204  }
 205  else
 206  {
 207      srand ((float)microtime()*1000000);
 208      $waittime = rand(501,1999); 
 209      usleep($waittime); 
 210      $headerinfo = "$host, $ipaddr\n$browserinfo";
 211      $fixsubject= stripslashes($subject); 
 212      $Comments = stripslashes($Comments); 
 213      $message = "Name: $Name\nEmail: $Email\nComments: $Comments\nOther: $headerinfo\n";
 214      $extra = "From: $Email\r\nReply-To: $Email\r\n";
 215      
 216      $uinfo = getInfoByUser($author);
 217      $usrnfo = explode("][", $uinfo);
 218      $emailad = $usrnfo[3] . "@" . $usrnfo[2];
 219      mail ($emailad, $fixsubject, $message, $extra);
 220      echo "<title> Feedback from $Name </title>";
 221      echo "<center><p><b>Thanks for your feedback, $Name.</b></p>";
 222      echo "<p><b>A response will be sent to <a href=\"mailto:$Email\">$Email</a>.</b></p>";    
 223       echo "<meta http-equiv='Refresh' content=\"5; url=" . $redirect . "\">";
 224      echo "<a href=\"" . $redirect . "\"><b>Back to $logsitename</b></a>";
 225  }
 226  
 227  ?>
 228  
 229  </td></tr>
 230  </table><br /><br />
 231  
 232  </td></tr></table><br /><br />
 233  </td></tr></table>
 234  <?php if(file_exists($footer)) { include($footer); } ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]