<?

  require '../config.inc.php';
  if (!($result1 = mysql_query ('select * from properties')))
  {
    exit ('<b>Error:</b>' . mysql_error ());
    ;
  }

  $row1 = mysql_fetch_row ($result1);
  for ($i = 0; $i < sizeof ($row1); $i++)
  {
    define (mysql_field_name ($result1, $i), $row1[$i]);
  }

  if (txt_direction == 'LTR')
  {
    echo '<html>';
  }
  else
  {
    echo '<html dir="rtl">';
  }

  echo '<body><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

';
  if ($_POST['submit'])
  {
    $body = $_POST['name'] . ' has sent this website to you

URL: ' . $_POST['URL'] . '

Sender\'s comments: ' . $_POST['yourmessage'] . ('' . '


------------------------------------------------------------------------
' . $HTTP_SERVER_VARS['SERVER_NAME'] . '
' . $properties['email'] . '
');
    if (mail ($_POST['emailaddress'], 'website to you', $body, 'From: ' . $_POST['youremail']))
    {
      echo '<BR><BR><BR><CENTER>Your information has been sent<BR><BR><A href=javascript:self.close()>Close this Window!</A></CENTER>';
    }
    else
    {
      echo '<BR><BR><BR><CENTER>Invalid e-mail address or Internal error!<BR><BR><A href="javascript:history.go(-1)" STYLE="color: maroon; text-decoration: none;">go back</a> and try again...</CENTER>';
    }
  }
  else
  {
    echo '<FONT style="color:red;font-family:tahoma;font-size:13";><U>Send this article to a friend</U></FONT><BR><br>

<FONT style="color:navy;font-family:tahoma;font-size:11";>
Our site has taken a strong public stance against the practice of sending unsolicited commercial e-mails, also known as "spam." Please send these e-mails only to people you know who would be interested in the item. If someone asks you ';
    echo 'not to send these e-mails to them, please comply.
</FONT>

<form action="mail2friend.php" method="post">
<FONT style="color:navy;font-family:tahoma;font-size:11";>
Your Name:<BR><input type="text" name="name" size="40" maxlength="100"><BR>
Your E-mail:<BR><input type="text" name="youremail" size="40" maxlength="100"><BR>
Your Friend\'s E-mail:<BR><input type="text" name="emailaddress" size="40" maxleng';
    echo 'th="100"><BR>
Your Comments:<BR><textarea name="yourmessage" cols="31" rows="5" wrap="soft"></textarea><BR><br>
<input type="submit" name="submit" value="  Send  ">
<input type="hidden" name="URL" value="';
    echo 'http://' . $_SERVER['SERVER_NAME'] . $_GET['url'];
    echo '">
</FONT>
</form>';
  }

  echo '</body></html>';
?>
