View file script/mailto.php

File size: 3.41Kb
<?php
/*-----------------------------------------------------------------------------------------
mcGalleryPRO
All code is © 2003 Marc Cagninacci.
No files may be redistributed in whole or significant part.
----------------- mcgalleryPRO IS NOT FREE SOFTWARE -------------------
You should have receive a file called license.txt in this package
--------------------------------------------------------------------------------------------*/

include './header_pop.php';

if (!empty($to))
{
$connect = mysql_connect($host,$login,$pass);
mysql_select_db($base, $connect);

$query = "SELECT author, email FROM mcgallery_comment WHERE id = $to";
$res = mysql_query($query);
$row = mysql_fetch_array($res);
$titlepop = $l_To.' <b> '.stripslashes($row['author']).'</b>';
$email_dest = $row['email'];
}
elseif (!empty($for))
{
	if ($wh == 'P') $table = 'mcgallery_photo';
	if ($wh == 'V') $table = 'mcgallery_video';
	if ($wh == 'F') $table = 'mcgallery_flash';

$connect = mysql_connect($host,$login,$pass);
mysql_select_db($base, $connect);

$query = "SELECT author, email FROM $table WHERE id = $for";
$res = mysql_query($query);
$row = mysql_fetch_array($res);
$titlepop = $l_To.' <b> '.stripslashes($row['author']).'</b>';
$email_dest = $row['email'];
}
else
{
$email_dest = $email_admin;
$titlepop = 'Contact us';
}

if ($submit == 'OK')
{
		$email_ok = eregi("^[_\.0-9a-z-]+@([0-9a-z-]+\.)+[a-z]{2,4}$", $email_exp);
		if (!$email_ok )
		{
		$bad_email = '<br>'.$l_EmailNo;
		}

  if ($nom_exp == '' || $email_exp == '' || $text == '' || $bad_email != '')
  {
  $titlepop = $l_ecard_verif . $bad_email;
  }
  else
  {
   $mod = 'N';
   $text = stripslashes($text);
     if ($mail_function == 1)
     {
     email("mcgallerypro", $email_dest,"Contact","\n$l_Auteur: $nom_exp - $email_exp\n$l_Message:\n $text");
     }
     else
     {
     mail($email_dest, "Contact", "\n$l_Auteur: $nom_exp - $email_exp\n$l_Message:\n $text", "From: $email_exp");
     }

  echo '<p align="center"><br><br><br><br><font size="2">Message sent</font></p>';
  echo '<p align="center"><a href="#" onclick="javascript:window.close()" class="lien1"><b>OK</b></a></p>';
  echo '</body></html>';
  exit();
  }
}
?>

<form method="post" action="mailto.php">
<table border="0" align="center" class="td1"><tr><td>
<table border="0" cellspacing="0" align="center">
<tr>
<td align="center" class="td0" colspan="2"><font size="2"><?php echo $titlepop; ?></font></td>
</tr>
<tr>
<td align="right" class="td2"><font size="1"><?php echo $l_your_name; ?>&nbsp;</font></td>
<td class="td2"><input type="text" size="22" name="nom_exp" value="<?php echo $nom_exp; ?>"></td>
</tr>
<tr>
<td align="right" class="td2"><font size="1"><?php echo $l_your_email; ?>&nbsp;</font></td>
<td class="td2"><input type="text" size="22" name="email_exp" value="<?php echo $email_exp; ?>"></td>
</tr>
<tr>
<td align="right" class="td2"><font size="1"><?php echo$l_your_message; ?></font></td>
<td class="td2">&nbsp;</td>
</tr>
<tr>
<td align="center" class="td2" colspan="2"><textarea cols="30" rows="12" name="text"><?php echo $text; ?></textarea></td>
</tr>
<tr>
<td align="center" class="td1" colspan="2">
<input type="hidden" name="to" value="<?php echo $to; ?>">
<input type="submit" name="submit" value="OK">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" class="td0">&nbsp;
</td></tr></table>
</form>
</body>
</html>