?php
//通过用户名获得用户ID
function nametext($name){
$str = strstr($name,"'");
if($str){return}//过滤'号,防止注入
$db = MySql::getInstance();
$sql = "SELECT * FROM " . DB_PREFIX . "user WHERE username='".$name."' or nickname='".$name."'";
$strs = $db->query($sql);
while($row = $db->fetch_array($strs)){
$str= $row['uid'];
//$str = print_r($str);
}
return $str;
}
?>