Şimdiden teşekkürler.
Hata :
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''AndMex''' at line 1
12
●220
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''AndMex''' at line 1
<?php
try {
$baglanti = new PDO("mysql:host=localhost;dbname=SANSÜR", "SANSÜR", "SANSÜR");
$baglanti->exec("SET NAMES utf8");
$baglanti->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sorgu = $baglanti->query("SELECT * FROM wo_users WHERE username = '".htmlspecialchars($_GET["username"])."'");
$cikti = $sorgu->fetch(PDO::FETCH_ASSOC);
if($cikti == null){
$cikti['avatar'] = "upload/photos/meetweb-circle.png";
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://SANSÜR/".$cikti['avatar']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4389.208 Safari/537.36");
$resim = curl_exec($ch);
curl_close($ch);
header("Content-Type: image/png");
echo $resim;
exit;
} catch (PDOException $e) {
die($e->getMessage());
}
$baglanti = null;
?> <?php
try {
$baglanti = new PDO("mysql:host=localhost;dbname=SANSÜR", "SANSÜR", "SANSÜR");
$baglanti->exec("SET NAMES utf8");
$baglanti->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sorgu = $baglanti->query("SELECT * FROM wo_users WHERE username = '".htmlspecialchars($_GET["username"])."'");
$cikti = $sorgu->fetch(PDO::FETCH_ASSOC);
if($cikti == null){
$cikti['avatar'] = "upload/photos/meetweb-circle.png";
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://SANSÜR/".$cikti['avatar']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4389.208 Safari/537.36");
$resim = curl_exec($ch);
curl_close($ch);
header("Content-Type: image/png");
echo $resim;
exit;
} catch (PDOException $e) {
die($e->getMessage());
}
$baglanti = null;
?> function clean_data($data) {
$data = trim($data);
$data = htmlspecialchars($data);
return $data;
}
$username = clean_data($_GET["username"]);
$sorgu = $baglanti->prepare("SELECT * FROM wo_users WHERE username = :username");
$sorgu->bindParam(':username', $username, PDO::PARAM_STR);
$sorgu->execute();
$cikti = $sorgu->fetch(PDO::FETCH_ASSOC);