程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> JSP編程 >> 關於JSP >> 邀請QQ好友-QQ聯系人導入(下)

邀請QQ好友-QQ聯系人導入(下)

編輯:關於JSP

Jsp代碼

<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="qq.QQContactsService"%>
<%@page import="qq.RSAInfo"%>
<% 
QQContactsService service = QQContactsService.getInstance();
RSAInfo rsa = service.getRSAInfo();

request.setAttribute("domain", rsa.getDomain());
request.setAttribute("publicKey", rsa.getPublicKey());
request.setAttribute("ts", rsa.getTs());
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>QQ Import Contact</title>
<script language="JavaScript" src="js/auth.js"></script>
</head>

<body>
<form name="form1" action="action.jsp" onsubmit="ras()" method="post">
QQ : 
<input type="text" name="uin" id="uin">
<br>
PWD: 
<input type="password" name="pp" id="pp">
<br>
verify: 
<input type="text" name="verifycode" id="verifycode">
<img src="code.jsp">
<br>

<input type="hidden" name="domain" id="domain" value="${domain}">
<input type="hidden" name="ts" id="ts">
<input type="hidden" name="starttime" id="starttime">
<input type="hidden" name="p" id="p">

<input type="submit" name="login">
<br>
</form>

<script type="text/javascript">
var S = function( object ) {
return document.getElementById( object );
};

function ras(){

var PublicKey = "${publicKey}";
var RSA = new RSAKey();
RSA.setPublic(PublicKey, "10001");
var PublicTs="${ts}";

var Res = RSA.encrypt(S("pp").value + '\n' + PublicTs + '\n');
if (Res){
document.form1.p.value = hex2b64(Res);
}
var MaskValue = "";
for (var Loop = 0; Loop < S("pp").value.length; Loop++, MaskValue += "0");

document.form1.pp.value = MaskValue;
document.form1.starttime.value = (new Date()).valueOf();
}


</script>
</body>
</html> 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved