<?php

$theme = $settings["theme"];

if (isset($_POST['yayinakisiekle'])) {
	$seourl=seo($_POST['yayinakisi']);
	$image = new Upload( $_FILES['image']);
	$upload= PATH . "/public/{$theme}/images/yayinakisi/";
	$s1=rand(1000,3200);
	$s2=rand(1000,3200);
	$s3=rand(1000,3200);
	$s4=rand(1000,3200);
	$names=$s1.$s2.$s3.$s4;
	$image->image_resize = true;
	$image->image_ratio_crop = true;
	$image->image_x = 400;
	$image->image_y = 400;
	$name=$image->file_new_name_body = $names;
	$uzantiss=$image->file_src_name;
	$uzantis=ext($uzantiss);
	$uzanti=$image->image_convert = $uzantis;
	$image->Process($upload);
	$image->allowed = array ('image/*');
	$image="images/yayinakisi/".$name.".".$uzanti;
	$kaydet=$db->prepare("INSERT INTO yayinakisi SET
		programci=:programci,
		program=:program,
		gunler=:gunler,
		yayin_saat=:yayin_saat,
		yayin_bitisi=:yayin_bitisi,
		image=:image, 
		durum=:durum
		");
	$insert=$kaydet->execute(array(
		'programci' => $_POST['programci'],
		'program' => $_POST['program'],
		'gunler' => $_POST['gunler'],
		'yayin_saat' => $_POST['yayin_saat'], 
		'yayin_bitisi' => $_POST['yayin_bitisi'], 
		'image' => $image, 
		'durum' => $_POST['durum']
	));
	if ($insert) {
		$success = 'İşlem başarıyla gerçekleşti.';
	} else {
		$error = 'Bir hata oluştu.';
	}
}

require admin_view('yakis-ekle');