mamad_za
دوشنبه 27 مهر 1394, 12:03 عصر
سلام دوستان من با .htaccess آدرس هام رو تغییر دادم آدرسام از این شکل زیر
www.sitename.com/index.php?gilkoi=upload (http://www.sitename.com/index.php?gilkoi=upload)
به این شکل در آوردم
www.sitename.com/upload/ (http://www.sitename.com/upload/)
کدهایی هم که در htaccess استفاده کردم به این شکله:
RewriteRule ^upload/(\w+)/?$ /index.php?gilkoi=upload&message=$1 [L,QSA]
RewriteRule ^upload/ /index.php?gilkoi=upload [NC,L]
اما یه مشکل برام به وجود اومده اینکه دیگه نمی تونم فایل هام رو آپلود کنم و اصلا شرط های داخل برنامه رو تشخیص نمی ده نمی دونم مشکل از Sessione? از چی هست؟
اینم کد برنامه ممنون می شم جواب بدید.
<?php
ob_start(); session_start();
$r1 =showactive1('upload');
$r3 =showactive1('upload');
$count=countr('upload');
if (isset($_POST['submit'])){
echo $_POST["captcha"];
if($_SESSION["captcha"]!= strtolower($_POST["captcha"])){
header("Location: http://www.nassaban.com/upload/err1");
}
else{
$myFile = $_FILES["fileUpload"];
$finfo = new finfo(FILEINFO_MIME_TYPE);
$mime = $finfo->file($myFile["tmp_name"]);
if($myFile["size"]<5000000 && $myFile["size"]>500000){
if($myFile["type"]=='image/jpeg'){
if($mime=='image/jpeg'){
if(isset($_POST['fname']) && $_POST['fname']!="" && strlen($_POST['fname'])<=30){
if(isset($_POST['tel']) && is_numeric($_POST['tel']) && strlen($_POST['tel'])<=11){
$name=htmlspecialchars($_POST['fname']);
$tel = htmlspecialchars((int)$_POST['tel']);
$date= time();
$ip= GetRealIp();
$meghdar=array('UName'=>$name,'UTel'=>$tel,'UDate'=>$date,'UIp'=>$ip);
$result=insertintoo('upload',$meghdar);
if($result=='true'){
$id=findid('upload');
$myFile["name"]=$id.'.jpg';
$image = new SimpleImage();
$image->load($myFile['tmp_name']);
$image->resizeToWidth(500);
$image->save('pic/userupload/'.$myFile["name"]);
header("Location: http://localhost/gilkoy/index.php?gilkoi=upload&message=done");
}else{header("Location: http://localhost/gilkoy/index.php?gilkoi=upload&message=err2");}
}else{header("Location: http://localhost/gilkoy/index.php?gilkoi=upload&message=err3");}
}else{header("Location: http://localhost/gilkoy/index.php?gilkoi=upload&message=err4");}
}else{header("Location: http://localhost/gilkoy/index.php?gilkoi=upload&message=err5");}
}else{header("Location: http://localhost/gilkoy/index.php?gilkoi=upload&message=err6");}
}else{header("Location: http://www.nassaban.com/upload/gilkoi=upload&message=err7");}
}
}
?>
<form action="index.php?gilkoi=upload" method="post" enctype="multipart/form-data">
www.sitename.com/index.php?gilkoi=upload (http://www.sitename.com/index.php?gilkoi=upload)
به این شکل در آوردم
www.sitename.com/upload/ (http://www.sitename.com/upload/)
کدهایی هم که در htaccess استفاده کردم به این شکله:
RewriteRule ^upload/(\w+)/?$ /index.php?gilkoi=upload&message=$1 [L,QSA]
RewriteRule ^upload/ /index.php?gilkoi=upload [NC,L]
اما یه مشکل برام به وجود اومده اینکه دیگه نمی تونم فایل هام رو آپلود کنم و اصلا شرط های داخل برنامه رو تشخیص نمی ده نمی دونم مشکل از Sessione? از چی هست؟
اینم کد برنامه ممنون می شم جواب بدید.
<?php
ob_start(); session_start();
$r1 =showactive1('upload');
$r3 =showactive1('upload');
$count=countr('upload');
if (isset($_POST['submit'])){
echo $_POST["captcha"];
if($_SESSION["captcha"]!= strtolower($_POST["captcha"])){
header("Location: http://www.nassaban.com/upload/err1");
}
else{
$myFile = $_FILES["fileUpload"];
$finfo = new finfo(FILEINFO_MIME_TYPE);
$mime = $finfo->file($myFile["tmp_name"]);
if($myFile["size"]<5000000 && $myFile["size"]>500000){
if($myFile["type"]=='image/jpeg'){
if($mime=='image/jpeg'){
if(isset($_POST['fname']) && $_POST['fname']!="" && strlen($_POST['fname'])<=30){
if(isset($_POST['tel']) && is_numeric($_POST['tel']) && strlen($_POST['tel'])<=11){
$name=htmlspecialchars($_POST['fname']);
$tel = htmlspecialchars((int)$_POST['tel']);
$date= time();
$ip= GetRealIp();
$meghdar=array('UName'=>$name,'UTel'=>$tel,'UDate'=>$date,'UIp'=>$ip);
$result=insertintoo('upload',$meghdar);
if($result=='true'){
$id=findid('upload');
$myFile["name"]=$id.'.jpg';
$image = new SimpleImage();
$image->load($myFile['tmp_name']);
$image->resizeToWidth(500);
$image->save('pic/userupload/'.$myFile["name"]);
header("Location: http://localhost/gilkoy/index.php?gilkoi=upload&message=done");
}else{header("Location: http://localhost/gilkoy/index.php?gilkoi=upload&message=err2");}
}else{header("Location: http://localhost/gilkoy/index.php?gilkoi=upload&message=err3");}
}else{header("Location: http://localhost/gilkoy/index.php?gilkoi=upload&message=err4");}
}else{header("Location: http://localhost/gilkoy/index.php?gilkoi=upload&message=err5");}
}else{header("Location: http://localhost/gilkoy/index.php?gilkoi=upload&message=err6");}
}else{header("Location: http://www.nassaban.com/upload/gilkoi=upload&message=err7");}
}
}
?>
<form action="index.php?gilkoi=upload" method="post" enctype="multipart/form-data">