<table width="100%" height="100%">
<tr>
<td align="center" valign="middle"><?php
/*Config başlar */
$sitename = '3Desktop.Net'; // Site ismi
$url = ''; // site url'si
$webmasterEmail = ''; // sizin mail adresiniz
$receiveNotifications = 1; // eğer 1 yaparsanız kimin kime msj gönderdiği konusunda uyarı msjı alacaksınız
$errorstyleclass = 'error';
$numberofrecipients = 4; // gösterilcek mail alan sayısı
$emailsubject = 'Website tavsiye [name] ([email])'; //email konusu
$emailmessage = "Hello,\n\r[name] link is: [url]"; //gönderilecek msj.
/*Config biter */
$mailsent = false;
$errormessages = array();
$errorfields = array();
if(count($_POST) > 0) {
if(get_magic_quotes_gpc()) $_POST = strip_magic_quotes($_POST);
if(empty($_POST['name'])) {
$errormessages[] = 'Lütfen isim giriniz.';
$errorfields[] = 'name';
}
if(empty($_POST['email'])) {
$errormessages[] = 'Lütfen mail adresi giriniz.';
$errorfields[] = 'email';
} else {
if(!eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$", $_POST['email'])) {
$errormessages[] = 'Lütfen doğru dürüst bir mail adresi girin';
$errorfields[] = 'email';
}
}
for($i=1, $count=count($_POST['to']); $i<=$count; $i++) {
if(empty($_POST['to'][$i])) unset($_POST['to'][$i]);
}
if(empty($_POST['to'])) {
$errormessages[] = 'En az 1 arkadasinizin mail adresini yaziniz';
$errorfields[] = 'to[1]';
} else {
foreach($_POST['to'] as $key=>$value) {
if(!empty($value)) {
if(!eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$", $value)) {
$errormessages[] = 'Please enter email address #' . $key . ' proper.';
$errorfields[] = "to[$key]";
}
}
}
}
// Now if there are no errors, send the message.
if(empty($errormessages)) {
$emailsubject = str_replace('[name]', $_POST['name'], $emailsubject);
$emailsubject = str_replace('[email]', $_POST['email'], $emailsubject);
$emailmessage = str_replace('[name]', $_POST['name'], $emailmessage);
$emailmessage = str_replace('[url]', $url, $emailmessage);
$emailmessage .= "\r\n\n" .
$_POST['message'] .
"\n\n\n\nNote: This message was not sent unsolicited. It was sent through a form located at $url. " .
"If you believe this message was received on error, please disregard it.";
$emailheader = "From: " . $_POST['email'] . "\r\n" .
"Reply-To: " . $_POST['email'] . "\r\n" .
"X-Mailer: Site tavsiye\r\n";
$sent = array();
foreach($_POST['to'] as $key=>$value) {
if(mail($value, $emailsubject, $emailmessage, $emailheader)) {
$sent[] = $value;
}
}
$failed = array_diff($_POST['to'], $sent);
$mailsent = true;
if($receiveNotifications) {
$subject = 'Someone recommended your site';
$message = 'This is a message to tell you that ' . $_POST['name'] . ' (' . $_POST['email'] .')' .
' sent a website recommendation to ' . implode(', ', $sent) .
"\n\nMessage: " . $_POST['message'];
$headers = 'From: ' . $webmasterEmail . "\r\n" .
'X-Mailer: Site tavsiye';
@mail($webmasterEmail, $subject, $message, $headers);
}
}
}
?>
<?php
if($mailsent) {
echo empty($sent) ? '' : '<span class=\"footer\"><p>Mesaj başarıyla gönderildi ' . implode(', ', $sent) . '</p></span>';
echo empty($failed) ? '' : '<span class=\"footer\"><p>Mesaj gönderilemedi ' . implode(', ', $failed) . '<br />Please try again later!</p></span>';
echo '<span class=\"footer\"><p>Sitemizi tavsiye ettiğiniz için teşekkür ederiz ' , $sitename , '</p></span>';
} else {
if(count($_POST) > 0 && !empty($errormessages)) {
echo '<table><tr><td><span class="' , $errorstyleclass , '">';
echo '<span class=\"footer\">The following error(s) occured:<br />';
foreach($errormessages as $value) {
echo ' » ' ,$value , '<br />';
}
echo '</span></span><br /></td></tr></table>';
}
?>
<table>
<form method="post" action="">
<tr>
<td class="formtexttitle" colspan="2">Tavsiye <?php echo $sitename; ?></td>
</tr>
<tr>
<td class="formtext"><span class="footer">Adınız:</span></td>
<td><input type="text" name="name" value="<?php echo isset($_POST['name']) ? $_POST['name'] : '';?>" class="<?php echo in_array('name', $errorfields) ? $errorstyleclass : ''; ?>" onfocus="this.style.borderColor='#0072BC';" onblur="this.style.borderColor='silver';" />
</td>
</tr>
<tr>
<td class="formtext"><span class="footer">Email adresiniz:</span></td>
<td><input type="text" name="email" value="<?php echo isset($_POST['email']) ? $_POST['email'] : '';?>" class="<?php echo in_array('email', $errorfields) ? $errorstyleclass : ''; ?>" onfocus="this.style.borderColor='#0072BC';" onblur="this.style.borderColor='silver';" />
</td>
</tr>
<tr>
<td colspan="2"><span class="footer">Gönderilecek adresler ºen az 1 tane </span> º<br />
<br /></td>
</tr>
<tr>
<td class="formtext">1.</td>
<td><input type="text" name="to[1]" value="" class="" onfocus="this.style.borderColor='#0072BC';" onblur="this.style.borderColor='silver';" /></td>
</tr>
<?php
for($i=2; $i<=$numberofrecipients; $i++) {
$value = isset($_POST['to'][$i]) ? $_POST['to'][$i] : '';
$class = in_array("to[$i]", $errorfields) ? $errorstyleclass : '';
echo " <tr>\n";
echo ' <td class="formtext">' , $i , ".</td>\n";
echo ' <td><input type="text" name="to[', $i ,']" value="', $value ,'" class="', $class ,"\" onfocus=\"this.style.borderColor='#0072BC';\" onblur=\"this.style.borderColor='silver';\"></td>\n";
echo " </tr>\n";
}
?>
<tr>
<td colspan="2"><span class="footer">Mesajınız º Opsiyonel </span> º<br />
<textarea name="message" rows="5" cols="31" class="<?php echo in_array('messsage', $errorfields) ? $errorstyleclass : ''; ?>" onfocus="this.style.borderColor='#0072BC';" onblur="this.style.borderColor='silver';"><?php echo isset($_POST['message']) ? $_POST['message'] : '';?></textarea>
</td>
</tr>
<tr>
<td colspan="2"><table>
<tr>
<td><input name="submit" type="submit" class="send" value="Send Message" /></td>
<td class="formtext"> </td>
<td><input name="reset" type="reset" class="reset" value="Reset Form" /></td>
<br />
</tr>
</table></td>
</tr>
</form>
</table>
<?php
}
?>
<?php
function strip_magic_quotes($arr) {
foreach($arr as $k => $v) {
if(is_array($v)) {
$arr[$k] = strip_magic_quotes($v);
} else {
$arr[$k] = stripslashes($v);
}
}
return $arr;
}
?>
</td>
</tr>
</table>