Skip to content

Instantly share code, notes, and snippets.

@midorikocak
Created December 2, 2012 19:15
Show Gist options
  • Save midorikocak/4190517 to your computer and use it in GitHub Desktop.
Save midorikocak/4190517 to your computer and use it in GitHub Desktop.
fatih
<html>
<head>
<title>Yazı yollama ekranı</title>
</head>
<body>
<form action="<?php echo $_SERVER [ 'PHP_SELF' ];?>" method="post">
Kullanıcı Adı: <input type="text" name="username"><br>
Şifre: <input type="password" name="password"><br>
Başlık: <input type="text" name="title"><br>
<textarea name="body" rows="4" cols="50" >Bu alan yazı gir
</textarea><br>
<input type="submit">
</form>
</body>
</html>
<?php
if(isset($_POST['username'])){
$username = $_POST['username'];
$password = $_POST['password'];
$title = $_POST['title'];
$body = $_POST['body'];
if(($username == 'fatih') && ($password == '12579521'))
{
$connect = mysql_connect("localhost","fatihdur_deneme","110303");
if (!$connect)
{
die('Bağlantı Kurulamadı: ' . mysql_error());
}
mysql_select_db("_deneme",$connect);
$sql = "INSERT INTO posts (title, body)
VALUES ('$title','$body')";
if(!mysql_query($sql, $connect)) //İLK HATAN BURADA
{
die('Hata: ' . mysql_error());
}
echo 'Yazı Kaydedildi';
mysql_close($connect);
}
else{
echo 'Hata oldu';
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment