SQL不是怕 ' 或 "吗?把这个添加到数据库就要出错~~要过滤~~
我用了FCK~,用str_replace()过滤没有效果!!数据添加不进数据库[有单或双引号时候]
不知道问题出那里~~??
我应该怎么办?
代码在下面::
----------------------------------------------------------
<html>
<head>
<title>haha</title>
<script language="javascript">
function buweikong(){
sb1=document.hehe.uid.value
sb2=document.hehe.re.value
if(sb1==""||sb2==""){
alert("sb");
return false;
}
}
</script>
</head>
<body>
<?php
include("../conn.php");
include('fckeditor.php');
$sBasePath = $_SERVER['PHP_SELF'] ; 
$sBasePath = dirname($sBasePath).'/'; 
$ed= new FCKeditor('con');
$ed->BasePath=$sBasePath;
?>
<?php
if($_GET["sumbit"]){ 
$_GET["con"]=str_replace("'","‘",str_replace('"','“',$_GET["con"]));
$sql = "INSERT INTO test ( uid ,regdate,re,mess) VALUES ( '". $_GET["uid"]."',now(), '".$_GET["re"]."','".$_GET["con"]."')"; 
$result = mysql_query($sql);
if(mysql_insert_id()>0)
{
   echo "发表成功!"; 
}
else
{
   echo "发表失败!"; 
}

?> 
<form action="jia.php" method="GET" name="hehe" onSubmit='return buweikong();'>
  用户:
  <input type="text" size="10" name="uid" />
标题:
<input type="text" size="10" name="re" />
<br/>
<?php $ed->Value="haha";?>
<?php $ed->Create();?>
<input type="submit" name="sumbit" value="提交" />
</form>
</body>
</html>