用php做的留言板,除了中文其他字符都能输入,数据库是mysql5.6,求大神指教。下面是代码。
/**
* 获取表单
*
* @access public
* @param string $type 类型
* @param string $value 值
* @param string $admintype 管理类型
* @return string
*/
function getForm($type = *post*, $value = **, $admintype=*diy*)
{
global $cfg_cookie_encode;
$dtp = new DedeTagParse();
$dtp->SetNameSpace("field","<",">");
$dtp->LoadSource($this->info);
$formstring = **;
$formfields = **;
$func = $type == *post* ? *GetFormItem* : *GetFormItemValue*;
if(is_array($dtp->CTags))
{
foreach($dtp->CTags as $tagid=>$tag)
{
if($tag->GetAtt(*autofield*))
{
if($type == *post*)
{
$formstring .= $func($tag,$admintype);
}
else
{
// $formstring .= $func($tag,htmlspecialchars($value[$tag->GetName()],ENT_QUOTES),$admintype);
$formstring .= $func($tag,htmlspecialchars($value[$tag->GetName()],ENT_QUOTES),$admintype);
}
$formfields .= $formfields == ** ? $tag->GetName().*,*.$tag->GetAtt(*type*) : *;*.$tag->GetName().*,*.$tag->GetAtt(*type*);
}
}
}
$formstring .= "<input type=\"hidden\" name=\"dede_fields\" value=\"".$formfields."\" />\n";
$formstring .= "<input type=\"hidden\" name=\"dede_fieldshash\" value=\"".md5($formfields.$cfg_cookie_encode)."\" />";
return $formstring;
}
/**
* 获取表单
*
* @access public
* @param string $type 类型
* @param string $value 值
* @param string $admintype 管理类型
* @return string
*/
function getForm($type = *post*, $value = **, $admintype=*diy*)
{
global $cfg_cookie_encode;
$dtp = new DedeTagParse();
$dtp->SetNameSpace("field","<",">");
$dtp->LoadSource($this->info);
$formstring = **;
$formfields = **;
$func = $type == *post* ? *GetFormItem* : *GetFormItemValue*;
if(is_array($dtp->CTags))
{
foreach($dtp->CTags as $tagid=>$tag)
{
if($tag->GetAtt(*autofield*))
{
if($type == *post*)
{
$formstring .= $func($tag,$admintype);
}
else
{
// $formstring .= $func($tag,htmlspecialchars($value[$tag->GetName()],ENT_QUOTES),$admintype);
$formstring .= $func($tag,htmlspecialchars($value[$tag->GetName()],ENT_QUOTES),$admintype);
}
$formfields .= $formfields == ** ? $tag->GetName().*,*.$tag->GetAtt(*type*) : *;*.$tag->GetName().*,*.$tag->GetAtt(*type*);
}
}
}
$formstring .= "<input type=\"hidden\" name=\"dede_fields\" value=\"".$formfields."\" />\n";
$formstring .= "<input type=\"hidden\" name=\"dede_fieldshash\" value=\"".md5($formfields.$cfg_cookie_encode)."\" />";
return $formstring;
}



