Merhaba arkadaşlar,
Aşağıdaki formu kullanarak farklı sitelerden kendi siteme form almak istiyorum.
<form action="run.php" method="POST" class="form">
<input type="hidden" name="api_key" value="98932rfwgaj309370vvaq">
<input type="hidden" name="domain" value="www.websitesi.com">
<input type="hidden" name="urun" value="Ürün">
<input type="hidden" name="fiyat" value="159.00">
<input type="hidden" name="zaman" >
<input type="text" name="adisoyadi" placeholder="Adı Soyadı">
<input type="text" name="telefon" placeholder="Telefon">
<input type="text" name="il" placeholder="İl">
<input type="text" name="ilce" placeholder="İlçe">
<input type="text" name="adres" placeholder="Adres">
<input type="text" name="adet" placeholder="Adet">
<input type="text" name="odeme" placeholder="Ödeme">
<button type="submit" name="siparisgonder">Gönder</button>
</form>
if (isset($_POST['siparisgonder'])) {
if( isset($_POST['api_key']) ){
$api_key = trim($_POST['api_key']);
}else{
$api_key = '';
}
$sorgu = $db->prepare('SELECT user_id AS id FROM kullanicilar WHERE api_key = ? LIMIT 1');
$sorgu->execute([$api_key]);
$sonuc = $sorgu->fetchAll(PDO::FETCH_ASSOC);
$id = 1;
if( isset($sonuc[1]) ){
$id = $sonuc[1]['id'];
}else{
$id = 1;
}
if($id === 1){
Header("Location:index.php?durum=no");
}
$kaydet=$db->prepare("INSERT into siparisler set
user_id=:user_id,
id=:id,
adisoyadi=:adisoyadi,
telefon=:telefon,
adres=:adres,
ilce=:ilce,
il=:il,
urun=:urun,
adet=:adet,
fiyat=:fiyat,
odeme=:odeme,
domain=:domain,
ip=:ip,
zaman = NOW(),
durum=1
");
$id = $_POST['id'];
$adisoyadi = $_POST['adisoyadi'];
$telefon = $_POST['telefon'];
$adres = $_POST['adres'];
$ilce = $_POST['ilce'];
$il = $_POST['il'];
$urun = $_POST['urun'];
$adet = $_POST['adet'];
$odeme = $_POST['odeme'];
$domain = $_POST['domain'];
$ip = $_POST['ip'];
$zaman = $_POST['zaman'];
if( empty($adisoyadi) ) { $adisoyadi = ''; }
if( empty($telefon) ) { $telefon = ''; }
if( empty($adres) ) { $adres = ''; }
if( empty($ilce) ) { $ilce = ''; }
if( empty($il) ) { $il = ''; }
if( empty($urun) ) { $urun = ''; }
if( empty($adet) ) { $adet = ''; }
if( empty($odeme) ) { $odeme = ''; }
if( empty($domain) ) { $domain = ''; }
if( empty($ip) ) { $ip = ''; }
if( empty($zaman) ) { $zaman = ''; }
$insert=$kaydet->execute(array(
'user_id' => $user_id,
'id' => $id,
'adisoyadi' => $adisoyadi,
'telefon' => $telefon,
'adres' => $adres,
'ilce' => $ilce,
'il' => $il,
'urun' => $urun,
'adet' => $adet,
'odeme' => $odeme,
'domain' => $domain,
'ip' => $ip,
'zaman' => $zaman
));
if ($insert) {
//echo "kayıt başarılı";
Header("Location:tesekkurler.php?durum=ok");
exit;
} else {
// print_r($db->errorInfo());exit();
//echo "kayıt başarısız";
Header("Location:index.php?durum=no");
exit;
}
}burası da run.php dosyam, fakat dısarıdan form almak ıstedıgımde kendi siteme yönleniyor ama giriş yapılmasını istiyor. Bu durum neyden kaynaklı olabilir birde veriler doğru gelmediği için olabilir mi?