注册 登录
编程论坛 ASP技术论坛

太难了,请教一下

hp3325 发布于 2011-01-11 09:16, 511 次点击
<?php
$users = array("sd110","wk110","hr110");
$user = $_REQUEST["u"];
$is_exsit = false;

if($user == ""){
    echo "该用户不能为空!";
    return;
}

foreach ($users as $u) {
    if($u == $user){
        $is_exsit = true;
    break;
    }
}

if($is_exsit){
   echo "该用户已注册";
}else{
   echo "success";
}
?>
以上如何转ASP?
3 回复
#2
gupiao1752011-01-11 22:56
<%
 dim asparray,user,u,isexsit,i
asparray = Array("sd110","wk110","hr110")
user=request("u")
isexsit=false
if user="" then
 response.write "该用户不能为空!"
 response.end
end if
for i=0 to ubound(asparray)-1
    if(asparray(i)=user) then
       response.write "该用户已注册!"
    else
       response.write "success!"
    end if
next
%>
拿这个去试试,如果有问题再反馈!

#3
gupiao1752011-01-11 23:00
不好意思,漏写一段,更正一下!
程序代码:
<%
dim asparray,user,u,isexsit,i
asparray
= Array("sd110","wk110","hr110")
user
=request("u")
isexsit
=false
if user="" then
response.write
"该用户不能为空!"
response.end
end if
for i=0 to ubound(asparray)-1
   
if(asparray(i)=user) then
     isexsit
=true
     
exit for
   
end if

 
next
if (isexsit=true)
   response.write
"该用户已注册!"
else
   response.write
"success!"
end if
%>

#4
hp33252011-01-21 11:49
回复 3楼 gupiao175
不知为何还是不行
只有本站会员才能查看附件,请 登录
特打包,还请多指教,这个问题搞得头都大了,哎,谁让我喜欢ASP呢
1