Tumgik
phplive-blog · 5 years
Text
İndirimli Fiyat ve Tabloya Listeleme İşlemi
<?php              $urun=$db->query("SELECT * FROM urun");              while ($ozellik=$urun->fetch()) {               if ($ozellik['urun_indirim']>0)               {                 $indirimlifiyat=$ozellik['urun_fiyat']-($ozellik['urun_fiyat']*$ozellik['urun_indirim']/100);
              }               if ($ozellik['urun_indirim']>0)               {                 $ozellik['urun_fiyat']="<del>".number_format($ozellik['urun_fiyat'],2,",",".")."TL"."</del>"."<br>".number_format($indirimlifiyat,2,",",".")."TL";               }               else               {                $ozellik['urun_fiyat']=number_format($ozellik['urun_fiyat'],2,",",".")."TL";              }
             ?>              <tr>                <td></td>                <td><?php echo $ozellik['urun_adi']; ?></td>                <td><?php echo $ozellik['urun_aciklama']; ?></td>                <td><?php echo $ozellik['urun_fiyat']; ?></td>                <td><?php echo $ozellik['urun_indirim']; ?></td>                <td><?php echo $ozellik['urun_vitrin']; ?></td>                <td><?php echo $ozellik['goster']; ?></td>                <td></td>              </tr>            <?php } ?>
0 notes
phplive-blog · 5 years
Text
checked kullanımı
<td><input type="checkbox" name=""<?php echo ($uruncek['urun_vitrin']?'checked="checked"':''); ?>></td>
0 notes
phplive-blog · 5 years
Text
İntvall İşlemi
<?php include"ust.php"; $uruncek=$db->prepare("SELECT * from urun where urun_id=?"); $uruncek->execute(array(intval($_GET['id']))); if ($uruncek->Rowcount()==1) { $uruncek=$uruncek->fetch(); $goster=$db->query("UPDATE urun set goster=(goster+1) where urun_id=".$uruncek['urun_id']); } else{
header("location:./"); exit; } ?>
0 notes
phplive-blog · 5 years
Text
Fonksiyon Tanımı
function yeniurun($urun) { ?>
<div class="product-item"> <a href="urun_datay.php?<?php echo $urun['urun_id']; ?>"> <div class="pi-pic"> <img src="./img/product/1.jpg" alt=""> <div class="pi-links"> <a href="#" class="add-card"><i class="flaticon-bag"></i><span>Sepete Ekle</span></a> <a href="#" class="wishlist-btn"><i class="flaticon-heart"></i></a> </div> </div> <div class="pi-text"> <h6><?php echo number_format($urun['urun_fiyat'],2,",",".")."TL"; ?></h6> <p><?php echo $urun['urun_adi']; ?> </p> </div> </a> </div> <?php }
0 notes
phplive-blog · 5 years
Text
Silme İşlemi
<?php include"../fonksiyon.php";
if(isset($_GET['id'])) { $Sil=$db->prepare("DELETE FROM urun WHERE urun_id=?"); $Durum=$Sil->execute(array(intval($_GET['id'])));
header("Location:UrunleriListele.php?Durum=$Durum"); exit; }
?>
0 notes
phplive-blog · 5 years
Text
Kullanıcı Giriş
<?php include"../fonksiyon.php";
if(isset($_POST['kadi']) && isset($_POST['sifre'])) { if($_POST['kadi']!="" && $_POST['sifre']!="") { $kullanici=$db->prepare(" SELECT kullanici_id,kullanici_mail,kullanici_adi FROM kullanici WHERE kullanici_mail=? AND kullanici_sifre=? AND kullanici_yetki=1"); $kullanici->execute(array( $_POST['kadi'], $_POST['sifre'] ));
if($kullanici->rowCount()==1) { $kullanici=$kullanici->fetch(); $_SESSION['kullanici_id']=$kullanici['kullanici_id']; $_SESSION['kullanici_mail']=$kullanici['kullanici_mail']; $_SESSION['kullanici_adi']=$kullanici['kullanici_adi'];
header("Location:./"); } else { $kullanici=$db->prepare(" SELECT kullanici_id,kullanici_mail,kullanici_adi FROM kullanici WHERE kullanici_mail=? AND kullanici_sifre_unuttum=? AND kullanici_yetki=1"); $kullanici->execute(array( $_POST['kadi'], $_POST['sifre'] )); if($kullanici->rowCount()==1) { $kullanici=$kullanici->fetch(); $_SESSION['kullanici_id']=$kullanici['kullanici_id']; $_SESSION['kullanici_mail']=$kullanici['kullanici_mail']; $_SESSION['kullanici_adi']=$kullanici['kullanici_adi'];
$db->query(" UPDATE kullanici SET kullanici_sifre=kullanici_sifre_unuttum, kullanici_sifre_unuttum='' WHERE kullanici_id=".$kullanici['kullanici_id'] );
header("Location:./"); } else { header("Location:login.php?hata"); } } if(isset($kullanici['kullanici_id'])) $db->query("UPDATE kullanici SET kullanici_songiris=CURRENT_TIMESTAMP WHERE kullanici_id=".$kullanici['kullanici_id']); } } ?>
0 notes
phplive-blog · 5 years
Text
fonksiyon kullanımı
<?php ob_start(); session_start(); try{ $db=new PDO("mysql:host=localhost;dbname=eticaret;charset=utf8","root","root"); //echo "Basarili"; } catch(PDOExpception $e) { echo "Baglantı yapılamadı"; echo $e->getMessage(); exit; } /* echo "<pre>"; print_r($_SERVER); echo "</pre>"; */
if(strpos($_SERVER['SCRIPT_NAME'],"yonet/") && substr($_SERVER['SCRIPT_NAME'], -9)!="login.php" && substr($_SERVER['SCRIPT_NAME'], -17)!="login_kontrol.php") { if(!isset($_SESSION['kullanici_id'])) { header("Location:login.php"); exit; } }
function AyarlariCek(){ global $db; $sorgu=$db->prepare("SELECT * FROM ayar"); $sorgu->execute(); return($sorgu->fetch(PDO::FETCH_ASSOC)); }
?>
0 notes
phplive-blog · 5 years
Text
PHP’de Ayar Güncelleme
<?php include"../baglan.php"; if (isset($_POST['ayar_baslik'])) { $guncelle=$db->prepare("UPDATE ayar SET ayar_baslik=:ayar_baslik, ayar_description=:ayar_description, ayar_keywords=:ayar_keywords, ayar_facebook=:ayar_facebook, ayar_twitter=:ayar_twitter, ayar_youtube=:ayar_youtube, ayar_instagram=:ayar_instagram, ayar_msunucu=:ayar_msunucu, ayar_mport=:ayar_mport, ayar_mkadi=:ayar_mkadi, ayar_msifre=:ayar_msifre WHERE ayar_id=1 "); $durum=$guncelle->execute( array( 'ayar_baslik'=>$_POST['ayar_baslik'], 'ayar_description'=>$_POST['ayar_description'], 'ayar_keywords'=>$_POST['ayar_keywords'], 'ayar_facebook'=>$_POST['ayar_facebook'], 'ayar_twitter'=>$_POST['ayar_twitter'], 'ayar_youtube'=>$_POST['ayar_youtube'], 'ayar_instagram'=>$_POST['ayar_instagram'], 'ayar_msunucu'=>$_POST['ayar_msunucu'], 'ayar_mport'=>$_POST['ayar_mport'], 'ayar_mkadi'=>$_POST['ayar_mkadi'], 'ayar_msifre'=>$_POST['ayar_msifre']
)); header("location:ayar.php?durum=$durum"); }
?>
1 note · View note