Merhaba arkadaşlar ;
mysql_query("SELECT * FROM uye where nick='.$uyenick.' ")
şeklinde kodları girdim ve profil.php?nick=AntiPity yada profil.php?nick=R10 denildiği zaman o nickin profilini açmasını istiyorum bu yüzden $uyenick in karşlığı ne olmalı ?
$uyenick = ???
profil.php?nick= ....
2
●721
- 19-04-2007, 20:05:15sadece böyle kullanırsan hacklenirsin.
sana bir fonksiyon ve örnek kullanımını veriyorum, güvenlik sorunu yaşamazsın.
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; }kullanım:
$sql = mysql_query(sprintf("SELECT * FROM uye where nick=%s", GetSQLValueString($_GET['nick'], "text")));