<?php
	if($_POST){
		$islem = $db->prepare("UPDATE mail_ayar SET host = ?, mail = ?, sifre = ?");
		$islem = $islem->execute(array($_POST['host'],$_POST['email'],$_POST['sifre']));
		if($islem){
			echo b();
		}else{
			echo h();
		}
	}
	$duzenle = $db->query("SELECT * FROM mail_ayar")->fetch(PDO::FETCH_ASSOC);
?>

<div class="page-header">
	<div class="page-leftheader">
		<h4 class="page-title">Email Ayarı</h4>
	</div>
	<div class="page-rightheader ml-auto d-lg-flex d-none">
		<ol class="breadcrumb">
			<li class="breadcrumb-item"><a href="index.php">Anasayfa</a></li>
			<li class="breadcrumb-item active" aria-current="page">Email Ayarı</li>
		</ol>
	</div>
</div>
						
<div class="row">
	
	<div class="col-md-12">
		<div class="card">
			<div class="card-body">
				<div class="row">
					<div class="col-md-12">
						
						<form class="form-horizontal" method="post" action="">

							<div class="form-group row">
								<label class="col-md-3 form-label">Email Host</label>
								<div class="col-md-9">
									<input type="text" class="form-control" name="host" value="<?php echo @$duzenle['host']; ?>">
								</div>
							</div>

							<div class="form-group row">
								<label class="col-md-3 form-label">Email Adres</label>
								<div class="col-md-9">
									<input type="email" class="form-control" name="email" value="<?php echo @$duzenle['mail']; ?>">
								</div>
							</div>

							<div class="form-group row">
								<label class="col-md-3 form-label">Email Şifre</label>
								<div class="col-md-9">
									<input type="text" class="form-control" name="sifre" value="<?php echo @$duzenle['sifre']; ?>">
								</div>
							</div>


							<div class="form-group row">
								<div class="col-md-12"><center><button type="submit" class="btn btn-info">Kaydet</button></center></div>
							</div>

						</form>

					</div>
				</div>
			</div>
		</div>
	</div>
</div>