软件艺术思考者  
混沌,彷徨,立志,蓄势...
公告
日历
<2024年12月>
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

导航

随笔分类(86)

随笔档案(85)

搜索

  •  

最新评论

阅读排行榜

评论排行榜

 

1.js StringUtil
它是标准的base64编码,解码.

var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var base64DecodeChars = new Array(
    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
    52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
    -1,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14,
    15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
    -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
    41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
//客户端Base64编码
function base64encode(str) {
    var out, i, len;
    var c1, c2, c3;

    len = str.length;
    i = 0;
    out = "";
    while(i < len) {
 c1 = str.charCodeAt(i++) & 0xff;
 if(i == len)
 {
     out += base64EncodeChars.charAt(c1 >> 2);
     out += base64EncodeChars.charAt((c1 & 0x3) << 4);
     out += "==";
     break;
 }
 c2 = str.charCodeAt(i++);
 if(i == len)
 {
     out += base64EncodeChars.charAt(c1 >> 2);
     out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
     out += base64EncodeChars.charAt((c2 & 0xF) << 2);
     out += "=";
     break;
 }
 c3 = str.charCodeAt(i++);
 out += base64EncodeChars.charAt(c1 >> 2);
 out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
 out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6));
 out += base64EncodeChars.charAt(c3 & 0x3F);
    }
    return out;
}

 

//客户端Base64解码
function base64decode(str) {
    var c1, c2, c3, c4;
    var i, len, out;

    len = str.length;
    i = 0;
    out = "";
    while(i < len) {
 /* c1 */
 do {
     c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
 } while(i < len && c1 == -1);
 if(c1 == -1)
     break;

 /* c2 */
 do {
     c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
 } while(i < len && c2 == -1);
 if(c2 == -1)
     break;

 out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));

 /* c3 */
 do {
     c3 = str.charCodeAt(i++) & 0xff;
     if(c3 == 61)
  return out;
     c3 = base64DecodeChars[c3];
 } while(i < len && c3 == -1);
 if(c3 == -1)
     break;

 out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));

 /* c4 */
 do {
     c4 = str.charCodeAt(i++) & 0xff;
     if(c4 == 61)
  return out;
     c4 = base64DecodeChars[c4];
 } while(i < len && c4 == -1);
 if(c4 == -1)
     break;
 out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
    }
    return out;
}

 2.使用。

<script>

function writeCookie_bak(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire+";path=/movo/";
}

function readCookie_bak(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  {
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    {
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

 var blogerNick = readCookie_bak('blogerNick');
     alert("blogerNick::"+base64decode(blogerNick));

</script>

2.

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="/webwork" prefix="ww"%>
<%@ taglib uri="/compass" prefix="compass"%>
<%@taglib uri="/jstl/c" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
String contextPath = request.getContextPath();
%>
 <%--<meta http-equiv="pragma" content="no-cache">
 <meta http-equiv="cache-control" content="no-cache">
 <meta http-equiv="expires" content="0">    --%>
 <meta name="keywords" content="夜店,酒吧,夜店网站,夜店视频,跨语平台,夜店生活,夜店美女"/>
    <meta name="description" content="什么是夜店,北京夜店,夜店美女,酒吧,全球跨语种夜店,夜店酒吧,北京后海酒吧,三里屯酒吧,后海酒吧"/>
 <%--<%  response.setHeader("Pragma","No-cache"); 
  response.setHeader("Cache-Control","no-cache"); 
  response.setDateHeader("Expires", 0);
 %>--%>
<script language="javascript" src="<%=contextPath %>/js/jquery.js"></script>
<script type="text/javascript" SRC="<%=contextPath %>/js/store.js"></script>
<script type="text/JavaScript" src="<%=contextPath%>/js/compassReg.js"></script>
<script type="text/javascript">
function login_head(contextPath){
  var email       = document.getElementById('email_head');
  var psw         = document.getElementById('passWord1_head');
  
  $.ajax({
   type : "POST",
   data : "email="+email.value+"&passWord="+psw.value,
   url  : contextPath + "/index!login.do",
   success : function (resMsg) {
    if (resMsg.indexOf("success") != -1) {
        var msg = resMsg.split(":");
        alert("登陆成功");
     window.location.reload();
        document.getElementById("login_head").innerHTML= msg[1];
     
    var loginafter= document.getElementById("login_head");
        loginafter.innerHTML="<span style='color:#ffffff'>欢迎您:"+email.value+"</span>";
        loginafter.style.display="block";
     //loginbbs();
     //$("#in a")
     
    } else {   
     alert('用户名或密码错误');
    }
   }   
  });
 } 
function changeLanguage(language){

  $.ajax({
            type: "GET",
            data: "currentLanguage="+language,
            url: "<%=contextPath%>" + "/base!changeLanguageForYeDian.do",
            success: function(res){
    window.location.reload(); 
            }
        });
        }
    function bookmarkSite(title, url)
{
    if (document.all)
    window.external.AddFavorite(url, title);
    else if (window.sidebar)
    window.sidebar.addPanel(title, url, "")
}
</script>

<!-- top -->
<div id="header" class="heasssder mainwidth">
  <div class="left"><A href="http://www.clubfun.cn"><IMG class=left src="images/clubfun_01.gif"></A><A href="http://www.movo.tv" target="_blank"><IMG class=left src="images/clubfun_02.gif"></A></div>
  <div class="logoright right">
    <ul class="logorighttop">
      <li style="margin-right:5px;"><a href="javascript:bookmarkSite('movo','http://www.movo.tv')"><ww:text name="yhead.shoucangbenzhan">收藏本站</ww:text></a></li>
      <li class="language"><a name="lan" href="<%=contextPath%>/base!changeLanguage.do?currentLanguage=zh&reqUrl="><img src="http://images.movo.tv/clubfun/images/zh.gif" alt="" /></a>
      <a name="lan" href="<%=contextPath%>/base!changeLanguage.do?currentLanguage=en&reqUrl="><img src="http://images.movo.tv/clubfun/images/en.gif" alt="" /></a>
      <a name="lan" href="<%=contextPath%>/base!changeLanguage.do?currentLanguage=ko&reqUrl="><img src="http://images.movo.tv/clubfun/images/ko.gif" alt="" /></a>
      <a name="lan" href="<%=contextPath%>/base!changeLanguage.do?currentLanguage=ja&reqUrl="><img src="http://images.movo.tv/clubfun/images/ja.gif" alt="" /></a></li>
    </ul>
    <ul class="clear"></ul>
    <ul class="logorightbottom">
     <li>
     <ww:if test="${sessionsuser==null}"><span id="pleaselogin_head"></span>
     <a href="<%=contextPath %>/redianreg!reg.do"><ww:text name="yhead.mashang">马上注册</ww:text></a></ww:if>
     <ww:else>
     <ww:if test="${sessionsuser.type==3 &&sessioncompass.status==1}"><a href="<%=contextPath %>/huodong!dianZhuIndex.do">店主管理</a></ww:if>
     <ww:else><a href="<%=contextPath %>/huodong!geRenIndex.do">个人夜店管理</a></ww:else>
     </ww:else>
     <a href="<%=contextPath %>/redianreg!resetPassword.do"><ww:text name="yhead.wangji">忘记密码?</ww:text></a></li>
    </ul>
  </div>
  <div class="clear"></div>
</div>
<!-- End top -->
<!-- Nav -->
<div id="nav" class="nav mainwidth">
  <div class="navlist left">
    <ul>
      <li  class="lihove"><a href="<%=contextPath %>/ystore!index.do" style="cursor: pointer;"><span><ww:text name="yhead.shouye">首页</ww:text></span></a></li>
      <li><a href="<%=contextPath %>/ystore!allStores.do"><span><ww:text name="yhead.yedian">夜店</ww:text></span></a></li>
      <li><a href="<%=contextPath %>/huodong1!allManageActivate.do"><span><ww:text name="yhead.huodong">活动</ww:text></span></a></li>
      <li><a href="<%=contextPath %>/ystore!photosets.do?photosetType=3"><span><ww:text name="yhead.xiangce">相册</ww:text></span></a></li>
      <li><a href="<%=contextPath %>/huodong1!videosInit.do"><span><ww:text name="yhead.shipin">视频</ww:text></span></a></li>
    </ul>
  </div>
  <ww:if test="${ empty sessionsuser }">
  <div class="login right" id="login_head">
    <ul>
   
      <li class="loginid"><input type="text"id="email_head" name="textfield" /></li>
      <li class="loginpw"><input type="password"id="passWord1_head" name="textfield2" /></li>
      <li class="loginsub"><input type="submit" name="Submit" value='<ww:text name="yhead.denglu">登录</ww:text>' onclick="login_head('<%=contextPath %>');"/></li>
    </ul>
  </div>
 </ww:if> <ww:else>
 <div class="login right" id="login_head">
   <ul>
    <li class="login"style="color:#ffffff"><ww:text name="yhead.nihao">你好:</ww:text>${sessionsuser.nickName }||<a href="javascript:loginout('<%=contextPath %>');"><font color="#FFFFFF">安全退出</font></a></li>
    </ul>
      </div>
 </ww:else>
  <div class="clear"></div>
</div>
<!-- End Nav -->
<!-- Search -->
<div id="search" class="search mainwidth mainbottom">
  <div class="searchkeyword right"><ww:text name="yhead.guanjianci">关键词:</ww:text><c:forEach items="${guanJianciList}" var="guanjianci"><a href="${guanjianci.YRecommend.detailUrl }">${guanjianci.keycontext }</a></c:forEach></div>
  <div class="searchlogin">
    <form id="form11" name="form11" method="post" action="<%=contextPath %>/huodong1!searchInit.do">
      <input type="text" name="searchName" class="searchinputkey" />
      <select name="searchType" class="searchinputqy">
        <option value="1"><ww:text name="yhead.yedian">夜店</ww:text></option>
        <option value="2"><ww:text name="yhead.huodong">活动</ww:text></option>
        <option value="3"><ww:text name="yhead.xiangce">相册</ww:text></option>
      </select>
      <input type="submit" name="Submit" value='<ww:text name="yhead.tijiao">提交</ww:text>' class="button" />
    </form>
  </div>
</div>
<div class="clear"></div>
<script type="text/javascript">
  var lans = document.getElementsByName("lan");
    for(var i=0 ; i < lans.length; i++){
     lans[i].href = lans[i].href + location.href.replace(/\&/g,'|');
    }
</script>
<!--

//-->
</script>
<!-- End Search -->

 

posted on 2008-08-20 19:49 智者无疆 阅读(501) 评论(0)  编辑  收藏 所属分类: about java

只有注册用户登录后才能发表评论。


网站导航:
 
 
Copyright © 智者无疆 Powered by: 博客园 模板提供:沪江博客


   观音菩萨赞