Firma rehberinde il bölümü oluşturma.
Merhabalar bizim sitemizde firma rehberi bölümü var fakar il secimi yapılamıyor biz aşagıda ki gibi ekleme yaptık fakar olmadı bu konuda yardımcı olabilecek varmıydı
<?php
$sayfa = $_POST["sayfa"];
$icerik = $_POST['icerik'];
if ($icerik == 'firma') {
if ( is_user_logged_in() ) {
if(empty($_POST["baslik"]) )
{
function geriat($gsure,$sayfa){
$gdeger = "<meta http-equiv=\"refresh\" content=\"0;url=$sayfa\">\n";
return $gdeger;
}
echo geriat(0,"'$sayfa'");
echo "<script>alert('Lüfen Formdaki Tüm Bilgileri Eksiksiz Doldurun - Yönlendiriliyorsunuz');</script>";
die();
}
extract($_FILES["file"],EXTR_PREFIX_ALL,"file");
for ($i = 0; $i < count($file_name); $i++) {
$ka = $file_name[$i];
if ($ka=='') {
$resim[0] = '';
$resim[1] = '';
$resim[2] = '';
$resim[3] = '';
$resim[4] = '';
$resim[5] = '';
$resim[6] = '';
$resim[7] = '';
$resim[8] = '';
$resim[9] = '';
}
else
{
$rastgele = rand(0,10000);
$trsildim=str_replace("ç","c",$file_name[$i]);
$trsildim=str_replace("Ç","c",$trsildim);
$trsildim=str_replace("ğ","g",$trsildim);
$trsildim=str_replace("Ğ","g",$trsildim);
$trsildim=str_replace("ı","i",$trsildim);
$trsildim=str_replace("İ","i",$trsildim);
$trsildim=str_replace("ö","o",$trsildim);
$trsildim=str_replace("Ö","o",$trsildim);
$trsildim=str_replace("ş","s",$trsildim);
$trsildim=str_replace("Ş","s",$trsildim);
$trsildim=str_replace("ü","u",$trsildim);
$trsildim=str_replace("Ü","u",$trsildim);
$trsildim=str_replace(" ","",$trsildim);
$trsildim=str_replace("/","",$trsildim);
$trsildim=str_replace("(","",$trsildim);
$trsildim=str_replace(")","",$trsildim);
$trsildim=str_replace("'","",$trsildim);
$trsildim=str_replace("+","-",$trsildim);
$trsildim=str_replace("[","",$trsildim);
$trsildim=str_replace("]","",$trsildim);
$trsildim=str_replace("JPG","jpg",$trsildim);
$trsildim=str_replace("JPEG","jpeg",$trsildim);
$trsildim=str_replace("PNG","png",$trsildim);
$trsildim=str_replace("GIF","gif",$trsildim);
$file_name[$i] = $trsildim;
$uzanti = strrchr($file_name[$i],".");
$uzanti = strtolower($uzanti);
$uzantilar = array(".gif",".jpg",".jpeg",".bmp",".tiff",".png");
if(!in_array($uzanti,$uzantilar)){
function geriat($gsure,$sayfa){
$gdeger = "<meta http-equiv=\"refresh\" content=\"0;url=$sayfa\">\n";
return $gdeger;
}
echo geriat(0,"'$sayfa'");
echo "<script>alert('Kabul Edilmeyen Dosya Formatı - Yönlendiriliyorsunuz');</script>";
die();
}
$file_name[$i]="fresim/resim".$rastgele.$file_name[$i];
move_uploaded_file( $file_tmp_name[$i], $file_name[$i]);
$resim[0] = $file_name[0];
$resim[1] = $file_name[1];
$resim[2] = $file_name[2];
$resim[3] = $file_name[3];
$resim[4] = $file_name[4];
$resim[5] = $file_name[5];
$resim[6] = $file_name[6];
$resim[7] = $file_name[7];
$resim[8] = $file_name[8];
$resim[9] = $file_name[9];
if ($i == 9) { break; }
}
}
$siteadres = "http://".$_SERVER['HTTP_HOST']."/";
$kategori = htmlspecialchars($_POST['cat']);
$icerik = htmlspecialchars($_POST['icerik']);
$baslik = htmlspecialchars($_POST['baslik']);
$detay = strip_tags($_POST['detay'],'<p><a><img><table><tr><td><th><br><b><i>');
$adres = htmlspecialchars($_POST['adres']);
$il = htmlspecialchars($_POST['il']);
$telefon = htmlspecialchars($_POST['telefon']);
$eposta = htmlspecialchars($_POST['eposta']);
$websitesi = htmlspecialchars($_POST['websitesi']);
$haritax = htmlspecialchars($_POST['x_coor']);
$haritay = htmlspecialchars($_POST['y_coor']);
$ekleyen = htmlspecialchars($_POST['ekleyen']);
$my_post = array();
$my_post['ID'] = $post_id;
$my_post['post_category'] = array($kategori);
$my_post['post_title'] = $baslik;
$my_post['post_content'] = $detay;
$my_post['post_author'] = 1;
$my_post['post_status'] = 'pending';
$my_post_id = wp_insert_post($my_post);
add_post_meta( $my_post_id, 'adres', $adres);
add_post_meta( $my_post_id, 'il', $il);
add_post_meta( $my_post_id, 'telefon', $telefon);
add_post_meta( $my_post_id, 'eposta', $eposta);
add_post_meta( $my_post_id, 'websitesi', $websitesi);
add_post_meta( $my_post_id, 'haritax', $haritax);
add_post_meta( $my_post_id, 'haritay', $haritay);
add_post_meta( $my_post_id, 'ekleyen', $ekleyen);
add_post_meta( $my_post_id, 'icerik', $icerik);
if( ($resim[0] != '') ){ add_post_meta( $my_post_id, 'kapak', $siteadres.$resim[0]); }
if( ($resim[1] != '') ){ add_post_meta( $my_post_id, 'resim2', $siteadres.$resim[1]); }
if( ($resim[2] != '') ){ add_post_meta( $my_post_id, 'resim3', $siteadres.$resim[2]); }
if( ($resim[3] != '') ){ add_post_meta( $my_post_id, 'resim4', $siteadres.$resim[3]); }
if( ($resim[4] != '') ){ add_post_meta( $my_post_id, 'resim5', $siteadres.$resim[4]); }
if( ($resim[5] != '') ){ add_post_meta( $my_post_id, 'resim6', $siteadres.$resim[5]); }
if( ($resim[6] != '') ){ add_post_meta( $my_post_id, 'resim7', $siteadres.$resim[6]); }
if( ($resim[7] != '') ){ add_post_meta( $my_post_id, 'resim8', $siteadres.$resim[7]); }
if( ($resim[8] != '') ){ add_post_meta( $my_post_id, 'resim9', $siteadres.$resim[8]); }
if( ($resim[9] != '') ){ add_post_meta( $my_post_id, 'resim10', $siteadres.$resim[9]); }
function geriat($gsure,$sayfa){
$gdeger = "<meta http-equiv=\"refresh\" content=\"0;url=$sayfa\">\n";
return $gdeger;
}
echo geriat(0,"'$sayfa'");
echo "<script>alert('Firma Eklendi. Onay İçin Bekliyor. Teşekkürler.');</script>";
}
}
else
{
?>
<form method="post" enctype="multipart/form-data" action="">
<?php $k1id = get_option('panel_k1id');
$arama = wp_dropdown_categories('orderby=name&hide_if_empty=true&hierarchical=1&echo=0&hide_empty=0&depth=3&child_of='.$k1id.'');
if ($arama == '') { ?>
<input type="hidden" name="cat" class="cls-input" value="<?php echo $k1id; ?>" /><div class="clr"></div>
<?php } else { ?>
<div class="msgSuccess">Kategori Seçiniz</div>
<div class="kategorisec">
<?php echo $arama; ?>
</div><div class="clr"></div>
<?php } ?>
<div class="msgSuccess">Firma Adınız</div>
<input type="text" name="baslik" class="cls-input" />
<div class="clr"></div>
<div class="msgSuccess">Firma Adresi</div>
<input type="text" name="adres" class="cls-input" />
<div class="clr"></div>
<div class="msgSuccess">Firma İl</div>BU ŞEKİLDE İL BÖLÜMÜ OLUŞTURULABİLİRMİ
<input type="text" name="il" class="cls-input" />
<option value="trabzon">İzmir</option>
<option value="ankara">Ankara</option>
<option value="istanbul">İstanbul</option>
.
.
.
<div class="clr"></div>BU ŞEKİLDE İL BÖLÜMÜ OLUŞTURULABİLİRMİ
<div class="msgSuccess">Firma Telefonu</div>
<input type="text" name="telefon" class="cls-input" />
<div class="clr"></div>
<div class="msgSuccess">Firma Websitesi</div>
<input type="text" name="websitesi" class="cls-input" />
<div class="clr"></div>
<div class="msgSuccess">Firma Mail Adresiniz</div>
<input type="text" name="eposta" class="cls-input" />
<div class="clr"></div>
<div class="msgSuccess">Resimlerinizi Yükleyin ( Maksimum 10 Adet )</div>
<input type="file" name="file[]" multiple size="40" />
<div class="clr"></div><div class="bosluk"></div>
<div class="clr"></div>
<div class="msgSuccess">Firma Hakkında Bilgiler</div>
<textarea name="detay" class="cls-text"></textarea>
<div class="clr"></div>
<div class="msgSuccess">Firma Harita Bilgisi</div>
<div class="clr"></div>
<div class="tamsayfa">
<div class="clr"></div>
<div id="map" style="width: 726px; height: 300px; border:#96cae3 1px solid;"></div>
<script src="<?php bloginfo('template_url'); ?>/js/jquery-1.js"></script>
<input type="hidden" id="lat" name="x_coor" value="39.9476478239225">
<input type="hidden" id="long" name="y_coor" value="32.8546142578125">
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script>
var latlng = new google.maps.LatLng(39.9476478239225, 32.8546142578125);
var options = {
zoom: 5,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
draggableCursor: "crosshair",
scrollwheel: false,
streetViewControl: false
};
var map = new google.maps.Map(document.getElementById("map"), options);
$("#zoom").val(5);
google.maps.event.addListener(map,"click", function(location)
{
GetLocationInfo(location.latLng);
});
google.maps.event.addListener(map,'zoom_changed', function(oldLevel, newLevel)
{
$("#zoom").val(map.getZoom());
});
var initListener;
var marker;
function GetLocationInfo(latlng)
{
if (latlng != null)
{
ShowLatLong(latlng);
UpdateStreetView(latlng);
}
}
function GotoLatLong()
{
if ($("#lat").val() != "" && $("#long").val() != "") {
var lat = $("#lat").val();
var long = $("#long").val();
var latLong = new google.maps.LatLng(lat, long);
ShowLatLong(latLong);
map.setCenter(latLong);
UpdateStreetView(latLong);
}
}
function ShowLink(){
$("#mapLink").html('<a href="ShowMap.php?lat=' + $("#lat").val() +
'&long=' + $("#long").val() + '&zoom=' + $("#zoom").html() + '">Link for this map</a>');
}
function ShowLatLong(latLong)
{
// show the lat/long
if (marker != null) {
marker.setMap(null);
}
marker = new google.maps.Marker({
position: latLong,
map: map});
$("#lat").val(latLong.lat());
$("#long").val(latLong.lng());
$("#address").val((ReverseGeocode(latLong.lat(),latLong.lng(), '#address')));
$("#adresX").val(ReverseGeocode(latLong.lat(),latLong.lng(), '#adresX'));
}
</script>
</div>
<div class="clr"></div>
<input type="hidden" name="ekleyen" value="<?php echo $user_identity; ?>" />
<input type="hidden" name="icerik" value="firma" />
<?php wp_reset_query(); $t2id = get_option('panel_t2id'); ?>
<input type="hidden" name="sayfa" value="<?php echo get_option('home'); ?>/?page_id=<?php echo $t2id;; ?>" />
<input type="submit" value="FİRMA EKLE" class="tamamdir" />
</form>
<?php } ?>
Php
Türkçe karakter içerenlerde sıkıntı yaşamamak için PLAKA numarası ile listelesen daha rahat olur.