-
Notifications
You must be signed in to change notification settings - Fork 0
/
hesabimyorumyapsonuc.php
48 lines (45 loc) · 1.38 KB
/
hesabimyorumyapsonuc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
if(isset($_SESSION["Kullanici"])){
if(isset($_GET["UrunID"])){
$GelenUrunID = Guvenlik($_GET["UrunID"]);
}else{
$GelenUrunID = "";
}
if(isset($_POST["Puan"])){
$GelenPuan = Guvenlik($_POST["Puan"]);
}else{
$GelenPuan = "";
}
if(isset($_POST["Yorum"])){
$GelenYorum = Guvenlik($_POST["Yorum"]);
}else{
$GelenYorum = "";
}
if(($GelenUrunID!="") and ($GelenPuan!="") and ($GelenYorum!="")){
$YorumKayitSorgusu = $VeritabaniBaglantisi->prepare("INSERT INTO yorumlar (UrunId, UyeId, Puan, YorumMetni, YorumTarihi, YorumIpAdresi) values (?, ?, ?, ?, ?, ?)");
$YorumKayitSorgusu->execute([$GelenUrunID, $KullaniciID, $GelenPuan, $GelenYorum, $ZamanDamgasi, $IPAdresi]);
$YorumKayitKontrol = $YorumKayitSorgusu->rowCount();
if($YorumKayitKontrol>0){
$UrunGuncellemeSorgusu = $VeritabaniBaglantisi->prepare("UPDATE urunler SET YorumSayisi=YorumSayisi+1, ToplamYorumPuani=ToplamYorumPuani+? WHERE id = ? LIMIT 1");
$UrunGuncellemeSorgusu->execute([$GelenPuan, $GelenUrunID]);
$UrunGuncellemeKontrol = $UrunGuncellemeSorgusu->rowCount();
if($UrunGuncellemeKontrol>0){
header("Location:index.php?SK=77");
exit();
}else{
header("Location:index.php?SK=78");
exit();
}
}else{
header("Location:index.php?SK=78");
exit();
}
}else{
header("Location:index.php?SK=79");
exit();
}
}else{
header("Location:index.php");
exit();
}
?>