Skip to content

Instantly share code, notes, and snippets.

Created December 19, 2012 20:33
Show Gist options
  • Save anonymous/4340203 to your computer and use it in GitHub Desktop.
Save anonymous/4340203 to your computer and use it in GitHub Desktop.
if(isset($_POST['username'])){
$username = $_POST['username'];
$password = $_POST['password'];
$title = $_POST['title'];
$body = $_POST['body'];
$connect = mysql_connect("localhost","fatihdur_deneme","110303");
if (!$connect)
{
die('Bağlantı Kurulamadı: ' . mysql_error());
}
mysql_select_db("_deneme",$connect);
$sql = "select * from users where username = '$username' and password='$password'";
if(!mysql_query($sql, $connect)) //İLK HATAN BURADA
{
die('Hata: ' . mysql_error());
}
$sonuc = mysql_affected_rows();
if($sonuc > 1)
{
$sql2 = "INSERT INTO posts (title, body)
VALUES ('$title','$body')";
if(!mysql_query($sql2, $connect)) //İLK HATAN BURADA
{
die('Hata: ' . mysql_error());
}
echo 'Yazı Kaydedildi';
mysql_close($connect);
}
else{
echo 'Kullanıcı Adı/Şifre Hatalı';
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment