2 formu birleştirdim ama dosya uploadda sorun yaşıyorum dosya 20 mb sınır var 19 mb lık dosya attıgımda dosya sunucuya gidiyor ama eksik alanları doldurunuz die uyarı alıyorum. ufak dosya upload yaptıgım zaman sorun yok
yardımcı olurmusunuz yada bildiğiniz dosya uploadlı iletişim formu varmı.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>My Email Form</title>
</head>
<body>
<?php
// OPTIONS - PLEASE CONFIGURE THESE BEFORE USE!
$yourEmail = "admin@r10.net"; // the email address you wish to receive these mails through
$yourWebsite = "https://www.r10.net/"; // the name of your website
$maxPoints = 4; // max points a person can hit before it refuses to submit - recommend 4
function isBot() {
$bots = array("Indy", "Blaiz", "Java", "libwww-perl", "Python", "OutfoxBot", "User-Agent", "PycURL", "AlphaServer",
"T8Abot", "Syntryx", "WinHttp", "WebBandit", "nicebot");
$isBot = false;
foreach ($bots as $bot)
if (strpos($_SERVER['HTTP_USER_AGENT'], $bot) !== false)
$isBot = true;
if (empty($_SERVER['HTTP_USER_AGENT']) || $_SERVER['HTTP_USER_AGENT'] == " ")
$isBot = true;
return $isBot;
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
if (isBot())
exit("Bots not allowed.</p>");
function clean($data) {
$data = trim(stripslashes(strip_tags($data)));
return $data;
}
// lets check a few things - not enough to trigger an error on their own, but worth assigning a spam score..
// score quickly adds up therefore allowing genuine users with 'accidental' score through but cutting out real spam
$points = (int)0;
$badwords = array("*****", "beastial", "bestial", "blowjob", "clit", "cum", "cunilingus", "cunillingus",
"cunnilingus", "cunt", "ejaculate", "fag", "felatio", "fellatio", "fuck", "fuk", "fuks", "gangbang", "gangbanged",
"gangbangs", "hotsex", "hardcode", "jism", "jiz", "orgasim", "orgasims", "orgasm", "orgasms", "phonesex", "phuk", "phuq",
"****", "pussies", "pussy", "spunk", "xxx", "viagra", "phentermine", "tramadol", "adipex", "advai", "alprazolam", "ambien",
"ambian", "amoxicillin", "antivert", "blackjack", "backgammon", "texas", "holdem", "poker", "carisoprodol", "ciara",
"ciprofloxacin", "debt", "dating", "****", "link=", "voyeur");
$exploits = array("content-type", "bcc:", "cc:", "document.cookie", "onclick", "onload", "javascript");
foreach ($badwords as $word)
if (strpos($_POST['comments'], $word) !== false)
$points += 2;
foreach ($exploits as $exploit)
if (strpos($_POST['comments'], $exploit) !== false)
$points += 2;
if (strpos($_POST['comments'], "http://") === true || strpos($_POST['comments'], "www.") === true)
$points += 2;
if (isset($_POST['nojs']))
$points += 1;
if (preg_match("/(<.*>)/i", $_POST['comments']))
$points += 2;
if (strlen($_POST['name']) < 3)
$points += 1;
if (strlen($_POST['comments']) < 15 || strlen($_POST['comments'] > 1500))
$points += 2;
// end score assignments
if (empty($_POST['agree'] )) {
$error_msg .= "Lütfen şartnameyi okuyup onaylayınız. \n"; }
if (empty($_POST['glogin'] )) {
$error_msg .= "Lütfen R10.net kullanıcı adınızı giriniz. \n"; }
if (empty($_POST['name']) || empty($_POST['email']) || empty($_POST['tc']) || empty($_POST['dogumt'] )) {
$error_msg .= "Eksik bilgi. Lütfen istenilen tüm bilgileri giriniz. \n";
} elseif (!ereg("^[0-9']*$", $_POST['tc'])) {
$error_msg .= "Tc kimlik numaranızı yanlış yazdınız. \n";
} elseif (!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$",strtolower($_POST['email'])))
{
$error_msg .= "That is not a valid e-mail address. \n";
} elseif (!empty($_POST['url']) &&
!preg_match('/^(http|https):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i', $_POST['url']))
$error_msg .= "Invalid website url.";
// dosya upload sistemi ba?ang??
$path = "dosyalar/"; //T? Haklar?Sakl??...
//fotonun kapladığı boyutuna bak
$boyut = $_FILES['userfile']['size'];
//boyut 2 mb dan büyükse uyar
if($boyut > '2000000'){ //boyut kontrol if başla
echo "<center><br><br><br>Dosya Boyutunuz Sınırı Aşıyor. Max Dosya Boyutu: 2.00 (İki) Mb<br><br><a href='javascript:history.back(1);'>«Geri</a></center>";
}elseif($boyut < '2000000'){ //boyut kontrol elseif başla
}
//resim 2 mb dan kuçukse işleme başla
if($_FILES['userfile']['name']){ //resim if başla
$filename=$_FILES['userfile']['name'];
$efilename = explode('.', $filename);
$uzanti = $efilename[count($efilename) - 1];
$uzantilar=array('zip','ZİP','ZIP','rar','RAR');
//uzantı jpeg yada gif değilse uploadı durdur ve uyarı ver
if(!in_array($uzanti,$uzantilar)){
echo "<center><br><br><br>Geçersiz Fotoğraf Uzantısı. Lütfen Jpeg ve Gif Formatında Fotoğraf Yükleyiniz!<br><br><a href='javascript:history.back(1);'>«Geri</a></center>";
exit;
}
//uzantı uygunsa yeni isim ver ve upload yap
$res = copy($HTTP_POST_FILES['userfile']['tmp_name'], $path .
$HTTP_POST_FILES['userfile']['name']);
if (!$res){
echo "Upload Failed!<br>";
exit;
}
else{
//echo "Dosya Yüklendi!<br>";
}
}//resim if bitir
if ($error_msg == NULL && $points <= $maxPoints) {
$subject = "Automatic Form Email";
$message = "You received this e-mail message through your website: \n\n";
foreach ($_POST as $key => $val) {
$message .= ucwords($key) . ": $val \r\n";
}
$message .= 'IP: '.$_SERVER['REMOTE_ADDR']."\r\n";
$message .= 'Browser: '.$_SERVER['HTTP_USER_AGENT']."\r\n";
$message .= 'Points: '.$points."\r\n";
$message .= 'Dosya : '.$HTTP_POST_FILES['userfile']['name']."\r\n";
if (strstr($_SERVER['SERVER_SOFTWARE'], "Win")) {
$headers = "From: $yourEmail \r\n";
$headers .= "Reply-To: {$_POST['email']}";
} else {
$headers = "From: $yourWebsite <$yourEmail> \r\n";
$headers .= "Reply-To: {$_POST['email']}";
}
if (mail($yourEmail,$subject,$message,$headers)) {
echo '<p>Çalışmanız başarıyla yüklendi!.</p>';
//echo "<meta content='3; URL=http://www.grafikerler.net' http-equiv='refresh'>";
} else {
echo '<p>Your mail could not be sent this time.</p>';
}
}
}
function get_data($var) {
if (isset($_POST[$var]))
echo htmlspecialchars($_POST[$var]);
}
if ($error_msg != NULL) {
echo '<p><strong style="color: red;">HATA!:</strong><br />';
echo nl2br($error_msg) . "</p>";
}
?>
<form enctype="multipart/form-data" action="mail.php" method="post">
<noscript>
<p><input type="hidden" name="nojs" id="nojs" /></p>
</noscript>
<p>
<table border="0" width="556" cellspacing="0" cellpadding="0">
<tr>
<td width="114"> <label for="tc">T.C. Kimlik No</label>
</td>
<td width="442" colspan="2"><input type="text" name="tc" id="tc" value="<?php get_data("tc"); ?>" /></td>
</tr>
<tr>
<td width="114" height="22"> <label for="name">Adı soyadı</label>
</td>
<td width="442" height="22" colspan="2"><input type="text" name="name" id="name" value="<?php
get_data("name"); ?>" /></td>
</tr>
<tr>
<td width="114" height="22"> <label for="glogin">Kullanıcı Adı</label>
</td>
<td width="442" height="22" colspan="2"><input type="text" name="glogin" id="glogin" value="<?php
get_data("glogin"); ?>" /></td>
</tr>
<tr>
<td width="114"> <label for="dogumt">Doğum Yılı</label></td>
<td width="442" colspan="2"><input type="text" name="dogumt" id="dogumt" value="<?php get_data("dogumt"); ?>"
/></td>
</tr>
<tr>
<td width="114">Meslek</td>
<td width="442" colspan="2"><input type="text" name="meslek" id="meslek" value="<?php get_data("meslek"); ?>"
/></td>
</tr>
<tr>
<td width="114">Tel No</td>
<td width="442" colspan="2"><input type="text" name="telno" id="telno" value="<?php get_data("telno"); ?>"
/></td>
</tr>
<tr>
<td width="114">E-mail</td>
<td width="442" colspan="2"><input type="text" name="email" id="email" value="<?php get_data("email"); ?>"
/></td>
</tr>
<tr>
<td width="114">İkamet Adresi</td>
<td width="442" colspan="2">
<input type="text" name="adres" id="adres" value="<?php get_data("adres"); ?>" /></td>
</tr>
<tr>
<td width="114"> <label for="il">İl</label></td>
<td width="442" colspan="2"><input type="text" name="il" id="il" value="<?php get_data("il"); ?>" /></td>
</tr>
<tr>
<td width="114"> <label for="ilce">İlçe</label>
</td>
<td width="442" colspan="2"><input type="text" name="ilce" id="ilce" value="<?php get_data("ilce"); ?>"
/></td>
</tr>
<tr>
<td width="114">Eser Adı</td>
<td width="442" colspan="2"><input type="text" name="eseradi" id="eseradi" value="<?php get_data("eseradi");
?>" /></td>
</tr>
<tr>
<td width="114">Dosya</td>
<td width="442" colspan="2"><input type="file" name="userfile" id="userfile" value="<?php
get_data("userfile"); ?>" /></td>
</tr>
<tr>
<td width="479" colspan="2"><label for="agree"><a target="_blank" href="http://www.grafikerler.net">
<span style="text-decoration: none">R10.net yarışma
kurallarını okudum ve şartları kabul ediyorum.</span></a></label></td>
<td width="77"><input type="checkbox" name="agree" id="agree" value="Kabul Ediyorum" ></td>
</tr>
<tr>
<td width="114">
<input type="submit" name="submit" id="submit" value="Gönder" /></td>
<td width="365"> </td>
<td width="77"> </td>
</tr>
</table>
</form>
<?php
//
exit;
//
?>
</body>
</html>