驗證密碼的代碼
㈠ 用戶登錄驗證的代碼怎麼寫
<br>
<%
//接受參數,request.getParameter("參數名稱"),此方法返回String類型
String name = request.getParameter("username");
String password = request.getParameter("userpassword");
%>
<%
if(name.equals("handson")&&password.equals("handson")){
//合法用戶
%>
<%@include file = "login_success.jsp" %>
<%
} else{
%>
<%@include file = "login_failure.jsp" %>
<%
}
%>
</center>
㈡ 匯編語言 密碼驗證代碼怎麼寫
;密碼驗證代碼
;
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
start: MOV AX,CODE
MOV DS,AX
cld
AGAIN: MOV AX,3
INT 10H
lea dx,MENU ;主菜單
mov ah,9
int 21h
input:
mov ah,0
int 16h
cmp al,'1'
jnz cp2
call sub01 ;輸入一個字元串
jmp AGAIN
cp2:cmp al,'2'
jnz cp3
call sub02 ;字元串左右移動
jc exit
jmp AGAIN ;返回到主菜單
cp3:cmp al,'3' ;返回DOS
jnz input
exit:
lea dx,MESG
mov ah,9
int 21h
mov ah,1
int 21h
MOV AH,4CH
INT 21H
sub01:
mov ax,3
int 10h
lea dx,tips
mov ah,9
int 21h
lea dx,msg1
mov ah,0ah
int 21h ;輸入一個字元串
mov ax,0e0dh
int 10h
mov al,0ah
int 10h
ret
sub02:
mov ax,3
int 10h
clc
push ds
pop es
mov bp,3
sss:
lea dx,Pass
mov ah,9
int 21h
lea dx,msg2
mov ah,0ah
int 21h
lea si,buf1
lea di,buf2
mov ch,0
mov cl,msg1+1
cmp cl,msg2+1
jnz cuowu
repz cmpsb
jcxz right
cuowu:
lea dx,no
mov ah,9
int 21h
dec bp
jnz sss
stc
jmp ok
right:
lea dx,yes
mov ah,9
int 21h
ok:
mov ah,1
int 21h
ret
MENU DB 5 DUP(0AH)
DB 31 DUP(' '),'MAIN MENU',0DH,0AH
DB 25 DUP(' '),201,21 DUP(205),187,0DH,0AH
DB 25 DUP(' '),186,' 1.Shuru Mima',8 p (20h),186,0DH,0AH
DB 25 DUP(' '),186,' 2.Jiaoyan Mima',6 p (20h),186,0DH,0AH
DB 25 DUP(' '),186,' 3.Return to DOS ... ',186,0DH,0AH
DB 25 DUP(' '),200,21 DUP(205),188,0DH,0AH
DB 28 DUP(' '),'Choice(1,2,3):$'
MESG DB 0dh,0ah,0dh,0ah,9,'Press any key to exit ...$'
Pass db 0dh,0ah,9,'Enter your password: $'
yes db 0dh,0ah,9,'password correct$'
no db 0dh,0ah,9,'password error$'
tips db 0dh,0ah,9,'Input a string: $'
msg1 db 255,0
buf1 db 255 p(0)
msg2 db 255,0
buf2 db 255 p(0)
CODE ENDS
END start
㈢ php中驗證賬號密碼的代碼
<?php
session_start();
if($_POST['name']&&$_POST['pass'])
{
$name=$_POST['name']; //接受傳遞值
$pass=$_POST['pass'];
}
else
{
echo '用戶名或密碼不能為空';//當然也可以進行其他操作,比如使用header('Location:error.php')來把用戶重定向到一個錯誤提示頁
exit;
}
include_once('mysql_connect.php');//連接資料庫
$name=mysql_real_escape_string($name); //過濾信息
$pass=mysql_real_escape_string($pass);
$sql='select username,userpass from userdata where username="$name"';//從資料庫中取出用戶信息
$r=mysql_query($sql);
if(mysql_num_rows==0)
{
echo '用戶名不存在';
exit;
}
else
{
$row=mysql_fetch_assoc($r);
if($pass!=$row['userpass'])
{
echo '用戶密碼錯誤';
exit;
}
esle
{
$_SESSION['user']=$name; //創建SESSION
}
}
?>
㈣ html密碼驗證
用JS驗證的?怎麼驗證的噢?你是說驗證密碼長度之類、 還是說登陸噢?
㈤ 如圖,驗證賬號密碼的VB代碼怎麼寫呢
下面代碼是我自己寫的,自己做學生管理用到的。你可以借鑒一下。
ExecuteSQL是另外建的模塊,另起回復。
Private Sub Cmd_ok_Click()
Dim txtSQL As String
Dim mrc As ADODB.Recordset
Dim MsgText As String
Dim UserName As String
miCount = miCount + 1
UserName = ""
If Trim(Txt_yhm.Text = "") Then
MsgBox "請輸入用戶名!", vbOKOnly + vbExclamation, "警告"
YZ = YZ + 1
Txt_yhm.SetFocus
Else
txtSQL = "select * from user_Info where user_ID = '" & Txt_yhm & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF Then
MsgBox "沒有這個用戶,請重新輸入用戶名!", vbOKOnly + vbExclamation, "警告"
YZ = YZ + 1
Txt_yhm.SetFocus
Else
If Trim(mrc.Fields(1)) = Trim(Txt_Mm.Text) Then
MFrm_Main.Show
OK = True
mrc.Close
Me.Hide
UserName = Trim(Txt_yhm.Text)
Else
MsgBox "輸入密碼不正確,請重新輸入!", vbOKOnly + vbExclamation, "警告"
YZ = YZ + 1
Txt_Mm.SetFocus
Txt_Mm.Text = ""
End If
End If
End If
If miCount = 3 Then
If miCount = YZ Then
MsgBox "!", vbOKOnly + vbExclamation, "警告"
Me.Hide
Unload Me
Else
MFrm_Main.Show
End If
End If
Exit Sub
End Sub
------------------------------------------------------------------------------------------
Public FmainForm As MFrm_Main
Public UserName As String
Public Function ConnectString() As String
ConnectString = "FileDSN=student.dsn;UID=sa;PWD=19970807"
End Function
Sub main()
Dim flogin As New Frm_Login '顯示登錄船窗體實例
flogin.Show vbModal
If Not flogin.OK Then
End
End If
Unload flogin
Set FmainForm = New MFrm_Main
FmainForm.Show
End Sub
Public Function ExecuteSQL(ByVal SQL As String, MsgString As String) As ADODB.Recordset
'executes SQL and returns Recordset
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim sTokens() As String
'On Error GoTo ExecuteSQL_Error
sTokens = Split(SQL)
Set cnn = New ADODB.Connection
cnn.Open ConnectString
If InStr("INSERT,DELETE,UPDATE", UCase$(sTokens(0))) Then '非Select語句
cnn.ExecuteSQL '數據量不大時,可以在連接上,直接執行SQL語句
MsgString = sTokens(0) & " query successful"
'雖然MsgString不是返回值,但傳遞方式是ByRef,實參地址和這個地址相同
Else 'Select語句
Set rst = New ADODB.Recordset
rst.Open Trim$(SQL), cnn, adOpenKeyset, adLockOptimistic
'得到臨時表,游標指向第一條記錄
'get RecordCount,
Set ExecuteSQL = rst
MsgString = "查詢到" & rst.RecordCount & _
" 條記錄 "
End If
ExecuteSQL_Exit:
Set rst = Nothing
Set cnn = Nothing
Exit Function
'ExecuteSQL_Error:
MsgString = "查詢錯誤: " & _
Err.Description
Resume ExecuteSQL_Exit
End Function
Public Function Testtxt(txt As String) As Boolean
If Trim(txt) = "" Then
Testtxt = False
Else
Testtxt = True
End If
End Function
㈥ 跪求一個:c語言密碼驗證程序的源代碼
#include<stdio.h>
#include<conio.h>
#include<string.h>
char password[10]="hunter";
typedef struct
{
char data[6];
int top;
}stacktype;
void initstack(stacktype *s)
{
s->top=-1;
}
void push(stacktype *s,char x)
{
if(s->top==6)
printf( "stack is full");
else
{
s->top++;
s->data[s->top]=x;
}
}
int pop(stacktype *s)
{
if(s->top==-1) return(0);
else s->top--;return(1);
}
char stacktop(stacktype *s)
{
char x;
if(s->top==-10) return(0);
else x=s->data[s->top];return(x);
}
void programme(stacktype *s)
{
char a;
char b[5];
int i,j,c;
printf( "請輸入一個六位數的密碼,你只有三次機會:\n");
for(i=0;i<=2;i++)
{
for(j=0;j<=5;j++)
{
c=j;
a=getch();
if((int)a!=8)
{
printf( "*");
push(s,a);
}
else
{
printf("\b \b");
j=c-2;
pop(s);
}
}
for(j=5;j>=0;j--)
{
pop(s);
b[j]=stacktop(s);
}
b[6]='\0';
printf( "\n");
if(strcmp(password,b)==0)
{
printf( "密碼正確\n");
break;
}
else
{
printf("密碼錯誤,請再試一次!\n");
continue;
}
}
if(i==3)
printf("密碼錯誤,即刻退出\n");
}
void main()
{
stacktype s;
initstack(&s);
programme(&s);
}
這是個範例,你自己研究研究
㈦ C#中驗證賬號密碼的代碼怎麼寫
<%
string username = "長沙極度信息"
string password = "0731icom"
string requestUsername = text1.value;
string requestPassword = text2.value;
if(requestUsername ==username && password ==requestPassword )
{
MessageBox.Show("用戶名和密碼驗證成功!");
}
else
{
MessageBox.Show("用戶名或密碼不正確!");
}
%>
㈧ 誰能給一個網頁驗證密碼登陸的代碼
<html>
<head>
<title>惡搞網抄頁</title>
<script language="vbscript">
sub button1_onclick
r=inputbox("請輸入網頁訪問密碼","密碼輸入框")
if r = "123456" then
window.location.replace("http://www..com")
else
msgbox "密碼錯誤" ,vbcritical + vbokonly + vbdefautbutton1, "錯誤"
end if
end sub
</script>
</head>
<body>
<form><input name="button1" type="button" value="點擊輸入密碼"></form>
</body>
</html>
照例多寫幾個,就可以登陸不同的網站了
㈨ 急求一個VB密碼輸入的驗證程序編寫代碼!
剛剛寫過了類似的代碼,算了再寫下
PrivateSubCommand1_Click()
StaticiAsInteger'說明下,假設用戶名、密碼分別是yutian8802和123456
Ifi>2Then
MsgBox"您已登錄三次了。。。程序將結束!"
End
Else
IfText1.Text="yutian8802"Then
IfText2.Text="123456"Then
MsgBox"登陸成功"
Else
MsgBox"密碼錯,請重新輸入!"
EndIf
Else
MsgBox"用戶名錯,請重新輸入!"
EndIf
i=i+1
EndIf
EndSub
測試了沒問題了你試試!有什麼問題一起探討~