'-----------------------------------------------------------------
Property Get getname
getname=bname
End Property
Property Let getname(nameid)
bname=nameid
If nameid="" Then
bname="没注册用户"
End If
End Property
'------------------------------------------------------------------
Property Get getsex
getsex=bsex
End Property
Property Let getsex(sex)
bsex=killint(sex,0,0)
If bsex=0 Then
bsex="男"
Else
bsex="女"
End if
End Property
'------------------------------------------------------------------
Property Get getpoint
getpoint=bpoint
End Property
Property Let getpoint(point)
bpoint=killint(point,0,0)
End Property
'------------------------------------------------------------------
这里有个killint函数,是判断数据合法性的,它的原形是:
Private Function killint(i,killstr,killsub)
If Not IsNumeric(i) Then
i=killstr
ElseIf i<=0 Then
i=killsub
End if
killint=Int(Left(i,5))
End Function
该函数功能很明确,不再繁琐说。
由于我们要通过积分判断用户级别,这里定义了一个私有函数:
Private Function getlevel()
bpoint=killint(bpoint,0,0)
If bpoint<500 Then
blevel="初级会员"
ElseIf bpoint>=500 And bpoint<=100 Then
blevel="高级会员"
Else
blevel="终极会员"
End If
Getlevel=blevel
End Function
我们要得是回送用户的信息,必须定义一个public公用函数,显示信息:
Public Function showuser()
response.write("<h5>以下显示<font color=red>"&bname&"</font>的资料:</h5>")
response.write("<h5>性别:<font color=red>"&bsex&"</font></h5>")
response.write("<h5>积分:<font color=red>"&bpoint&"</font></h5>")
getlevel
response.write("<h5>级别:<font color=red>"&blevel&"</font></h5>")
End Function
End class
使用这个类的时候这样使用:(我在这里写了一个表单处理的)
Set blueideauser=new blueidea
blueideauser.getname=Trim(request("id"))
blueideauser.getsex=request("sex")
blueideauser.getpoint=request("point")
blueideauser.showuser