62,614
社区成员
发帖
与我相关
我的任务
分享
<title></title>
<style>
body {
MARGIN: 0 0 0 0;
background-color: #e1e9f4;
}
</style>
<META content="MSHTML 6.00.2800.1625" name=GENERATOR>
</head>
<body onload="init()" topmargin="0" leftmargin="0" bgcolor="#e1e9f4">
<form name="login" action="redirct_index.htm" method="post" onsubmit="return formSubmit2(this);">
<input type=hidden name=rtime>
<SCRIPT language=javascript>
dis_login();
</SCRIPT>
</form>
</body>
<SCRIPT language=JavaScript>
</SCRIPT>
</html>
function dis_login()
{
document.write("<table width=100% height=90% border=0><tr><td align=center style='font-family: verdana,arial,sans-serif; font-size: 12px ;COLOR: #333333'><DIV class=da_width >"+
"<DIV style='BACKGROUND: url(images/back.jpg); HEIGHT: 214px' id=dl_margin>"+
"<DIV style='font-size: 14px; WIDTH: 280px; MARGIN-TOP: 0px; PADDING-TOP: 25px' align=center><b>"+productInfo+"</b></DIV>"+
"<DIV style='MARGIN-TOP: 43px; FLOAT: left; WIDTH: 250px' align=right><IMG src='images/h3c_logo.jpg'> </DIV>"+
"<DIV style='HEIGHT: 20px;WIDTH: 480px'></DIV>"+
"<DIV align=left> 用户名 <INPUT TabIndex=1 style='BORDER-RIGHT: #87a6c3 1px solid; BORDER-TOP: #87a6c3 1px solid; BACKGROUND: #edeced; BORDER-LEFT: #87a6c3 1px solid; WIDTH: 115px; BORDER-BOTTOM: #87a6c3 1px solid; HEIGHT: 19px' "+
"id='userName' name='userName' size='16' maxlength='32' onkeypress=\"move(event,'password');if(event.keyCode=='13'){return false;}\"></DIV>");
if (0 == vldcode_en)
{
document.write('<DIV> </DIV>');
}
document.write("<DIV align=left> 密 码 ");
if (1 == vldcode_en)
{
document.write('<input TabIndex=2 id="password" name="password" size="16" maxlength="32" type="password" onkeypress="move(event,\'vldcode\');if(event.keyCode==13){return false;}" ');
}
else
{
document.write('<input TabIndex=2 id="password" name="password" size="16" maxlength="32" type="password" onkeypress="onEnterSub(event)" ');
}
document.write("style='BORDER-RIGHT: #87a6c3 1px solid; BORDER-TOP: #87a6c3 1px solid; BACKGROUND: #edeced; BORDER-LEFT: #87a6c3 1px solid; WIDTH: 115px; BORDER-BOTTOM: #87a6c3 1px solid; HEIGHT: 19px'>");
document.write('<a href=javascript:void(0) onclick=popUserFaq("user_faq.htm?#_Toc286769551")> 忘记密码</a></DIV>');
if (1 == vldcode_en)
{
document.write("<DIV align=left> 验证码 <INPUT TabIndex=3 style='BORDER-RIGHT: #87a6c3 1px solid; BORDER-TOP: #87a6c3 1px solid; BACKGROUND: #edeced; BORDER-LEFT: #87a6c3 1px solid; WIDTH: 115px; BORDER-BOTTOM: #87a6c3 1px solid; HEIGHT: 19px'");
document.write('id="vldcode" name="vldcode" size="16" maxlength="4" type="text" onkeypress="onEnterSub(event)" >');
document.write('<img id=vldimp src="images/vld.bmp" alt="刷新验证码" onclick=get_vldbmp() style="cursor:pointer"/></DIV>');
}
document.write("<span name='messages' id=messages style='HEIGHT:3px; MARGIN-TOP: 0px; MARGIN-LEFT: 20px; WIDTH: 200px; PADDING-TOP: 8px; FLOAT: left;'></span>"+
"<br><br>");
if (1 == vldcode_en)
{
document.write("<DIV style='WIDTH: 80px; MARGIN-TOP: 0px; PADDING-TOP: 12px;'><input TabIndex=4 type='submit' value=' 登录 '></DIV>");
}
else
{
document.write("<DIV style='WIDTH: 80px; MARGIN-TOP: 0px; PADDING-TOP: 20px;'><input TabIndex=3 type='submit' value=' 登录 '></DIV>");
}
document.write("<DIV align=center> </DIV>"+
"<DIV align=center>推荐分辨率1024*768</DIV>"+
"<DIV class=lclear></DIV>"+
"</DIV></DIV></td></tr></table>");
}
</SCRIPT>
function formSubmit2()
{
var oUserName = document.getElementById("userName");
var oPassword = document.getElementById("password");
if (1 == vldcode_en)
{
var oVldcode = document.getElementById("vldcode");
}
if (0 == oUserName.value.length)
{
document.getElementById("messages").innerHTML="请输入用户名!";
oUserName.focus();
return false;
}
/*
if (0 == oPassword.value.length)
{
document.getElementById("messages").innerHTML="请输入密码!";
oPassword.focus();
return false;
}
*/
if(!checkStringChar(oPassword,' '))
{
document.getElementById("messages").innerHTML="密码不能包含空格!";
oPassword.focus();
return false;
}
oUserName.value = trim(oUserName.value);
//oPassword.value = trim(oPassword.value);
if (1 == vldcode_en)
{
oVldcode.value = trim(oVldcode.value);
if ( oVldcode.value == "" )
{
document.getElementById("messages").innerHTML="请输入验证码!";
if (1 == mapOvertime)
{
get_vldbmp();
}
else
{
oVldcode.focus();
}
return false;
}
else if (1 == mapOvertime)
{
document.getElementById("messages").innerHTML="验证码已超时,请重新输入!";
get_vldbmp();
return false;
}
else if (!/(^[a-zA-Z0-9]{4}$)/.test(oVldcode.value))
{
document.getElementById("messages").innerHTML="验证码错误!";
return false;
}
}
set_cookie("userName", escape(oUserName.value), null, "/");
set_cookie("password", oPassword.value, null, "/");
if (1 == vldcode_en)
{
set_cookie("vldcode", oVldcode.value, null, "/");
}
var d = new Date;
document.login.rtime.value = (d.getTime() / 500);
return true;
}
try {
String surl = "http://192.168.0.234/";
/**
* 首先要和URL下的URLConnection对话。 URLConnection可以很容易的从URL得到。比如: // Using
* java.net.URL and //java.net.URLConnection
*/
URL url = new URL(surl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("User-Agent",
"Internet Explorer");
/**
* 然后把连接设为输出模式。URLConnection通常作为输入来使用,比如下载一个Web页。
* 通过把URLConnection设为输出,你可以把数据向你个Web页传送。下面是如何做:
*/
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("POST");
/**
* 最后,为了得到OutputStream,简单起见,把它约束在Writer并且放入POST信息中,例如: ...
*/
OutputStreamWriter out = new OutputStreamWriter(connection
.getOutputStream(), "GBK");
//其中的memberName和password也是阅读html代码得知的,即为表单中对应的参数名称
out.write("userName=admin&password=admin"); // post的关键所在!
// remember to clean up
out.flush();
out.close();
// 取得cookie,相当于记录了身份,供下次访问时使用
String cookieVal = connection.getHeaderField("Set-Cookie");
System.out.println(cookieVal);
InputStream urlStream = connection.getInputStream();
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(urlStream));
String ss = null;
// String total = "";
while ((ss = bufferedReader.readLine()) != null) {
// total += ss;
System.out.println(ss);
}
bufferedReader.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}