Bu derste Php ve Mysql kullanarak çok basit üyelik scripti yazımını görelim. Php ile çok basit bir üyelik scripti yazımı dersidir.
İnşallah faydalı olur.
Gözümden kaçan bir hata varsa konu altından bildirebilirsiniz
ayar.php Dosyası
<?php $host= "localhost"; $ad = "root"; $pw =""; $wt ="denemelerim"; $baglanti = mysql_connect($host,$ad,$pw) or die (mysql_error()); mysql_select_db($wt,$baglanti) or die (mysql_error()); ?>
-----------------------------------------------------------------------
kyt.php Dosyası
<div id="kform"> <p><b>Kullanici Kayit Formu! <form action="" method="post"> <strong>Kullanici Adi:</strong><br /> <input type="text" name="kadi" /><br /> <strong>Sifre:</strong> <br /> <input type="password" name="sifre" /><br /> <button>Kayit Ol!</button> </form> </div> <?php include "ayar.php"; $kadi = @$_POST['kadi']; $sifre = @$_POST['sifre']; $sifre = md5($sifre); if($_POST){ if($kadi =="" || $sifre ==""){echo "bos alan birakmayin";} else{ $insert = mysql_query("INSERT INTO uyelik (kadi,sifre) VALUES ('$kadi','$sifre') "); if($insert){ echo "<font color=green>Basari Ile Kayit Oldunuz </font>"."<br />"; echo "<font color=green>Giris yapmak icin <a href='girisyap.php'>tiklayin </font></a>"; }else{echo "Uzgunuz Bir Hata Ile Karsilastik !!";} } } ?> <style type="text/css"> #kform{padding:0;margin:0;display:block;background-color:pink; width:300px; height:200px;} strong{color:black;} button{margin-top:15px;background-color:black; color:white;width:80px;height:25px; cursor:pointer} a{text-decoration:none;} </style>
------------------------------------------------------------
girisyap.php Dosyası
<div id="gform"> <p><b>Kullanici Giris Formu <form action="" method="post"> <strong>Kullanici Adi:</strong><br /> <input type="text" name="kadi" /><br /> <strong>Sifre:</strong> <br /> <input type="password" name="sifre" /><br /> <button>Giris Yap!</button> </form> </div> <?php session_start(); include "ayar.php"; $kadi = mysql_real_escape_string(@$_POST['kadi']); $sifre = mysql_real_escape_string(@$_POST['sifre']); $sifre = md5($sifre); if($_POST){ if($sifre=="" || $kadi==""){echo "<font color=red><b>Lutfen Bos Alan Birakmayin</font>";} else{ $sorgula = mysql_query("SELECT * FROM uyelik WHERE kadi='$kadi' and sifre='$sifre'"); $verisay = mysql_num_rows($sorgula); if ($verisay >0){ $_SESSION['kadi'] = $kadi; echo "Basarili Bir Sekilde Giris Yaptiniz"."<br />"; echo "Profilinize Ulasmak Icin <a href='profil.php'>Tiklayiniz</a>"; }else{ echo "<font color=red><b>Yanlis kullanici adi veya sifre girdiniz lutfen kontrol ediniz!!</font>"; } } } ?> <style type="text/css"> #gform{padding:0;margin:0;display:block;background-color:green; width:300px; height:200px;} strong{color:white;} button{margin-top:15px;background-color:black; color:white;width:80px;height:25px; cursor:pointer} a{text-decoration:none;} p{color:white} </style>
-----------------------------------------------------
profil.php Dosyası
<?php session_start(); $kadi =$_SESSION['kadi']; echo "<div class='basarili'>Hosgeldiniz Sayin <strong>$kadi</strong> </div>"."<br />"; echo "<strong>$kadi</strong> Burasi senin profilin burada profilini duzenleyebilirsin!!"; ?> <style type="text/css"> .basarili{font:15px tahoma;} strong{color:green;} </style>
0 yorum:
Yorum Gönder