<?php
$theme = $settings["theme"];

if (isset($_POST['banner'])) {
	$seourl=seo($_POST['sponsor']);
	$image = new Upload( $_FILES['image']);
	$upload= PATH . "/public/{$theme}/images/sponsor/";
	$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 = 190;
		$image->image_y = 125;
	$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/sponsor/".$name.".".$uzanti;
	$kaydet=$db->prepare("INSERT INTO sponsor SET
		sponsor=:sponsor, 
		sponsor_url=:sponsor_url, 
		image=:image
		");
	$insert=$kaydet->execute(array(
		'sponsor' => $_POST['sponsor'],
		'sponsor_url' => $_POST['sponsor_url'],
		'image' => $image
	));
	if ($insert) {
		$success = 'İşlem başarıyla gerçekleşti.';
	} else {
		$error = 'Bir hata oluştu.';
	}
}
require admin_view('sponsor-ekle');