Java»ñÈ¡¿Í»§¶ËÕæʵIPµØÖ·µÄÁ½ÖÖ·½·¨
ÔÚJSPÀ»ñÈ¡¿Í»§¶ËµÄIPµØÖ·µÄ·½·¨ÊÇ£ºrequest.getRemoteAddr£¨£©£¬ÕâÖÖ·½·¨Ôڴ󲿷ÖÇé¿ö϶¼ÊÇÓÐЧµÄ¡£µ«ÊÇÔÚͨ¹ýÁËApache£¬SquidµÈ·´Ïò´úÀíÈí¼þ¾Í²»ÄÜ»ñÈ¡µ½¿Í»§¶ËµÄÕæʵIPµØÖ·ÁË¡£
Èç¹ûʹÓÃÁË·´Ïò´úÀíÈí¼þ£¬½«http://192.168.1.110£º2046/ µÄURL·´Ïò´úÀíΪ http://www.javapeixun.com.cn / µÄURLʱ£¬ÓÃrequest.getRemoteAddr£¨£©·½·¨»ñÈ¡µÄIPµØÖ·ÊÇ£º127.0.0.1¡¡»ò¡¡192.168.1.110£¬¶ø²¢²»ÊÇ¿Í»§¶ËµÄÕæʵIP¡£
¾¹ý´úÀíÒÔºó£¬ÓÉÓÚÔÚ¿Í»§¶ËºÍ·þÎñÖ®¼äÔö¼ÓÁËÖмä²ã£¬Òò´Ë·þÎñÆ÷ÎÞ·¨Ö±½ÓÄõ½¿Í»§¶ËµÄIP£¬·þÎñÆ÷¶ËÓ¦ÓÃÒ²ÎÞ·¨Ö±½Óͨ¹ýת·¢ÇëÇóµÄµØÖ··µ»Ø¸ø¿Í»§¶Ë¡£µ«ÊÇÔÚת·¢ÇëÇóµÄHTTPÍ·ÐÅÏ¢ÖУ¬Ôö¼ÓÁËX£FORWARDED£FORÐÅÏ¢¡£ÓÃÒÔ¸ú×ÙÔÓеĿͻ§¶ËIPµØÖ·ºÍÔÀ´¿Í»§¶ËÇëÇóµÄ·þÎñÆ÷µØÖ·¡£µ±ÎÒÃÇ·ÃÎÊhttp://www.javapeixun.com.cn /index.jsp/ ʱ£¬Æäʵ²¢²»ÊÇÎÒÃÇä¯ÀÀÆ÷ÕæÕý·ÃÎʵ½ÁË·þÎñÆ÷ÉϵÄindex.jspÎļþ£¬¶øÊÇÏÈÓÉ´úÀí·þÎñÆ÷È¥·ÃÎÊhttp://192.168.1.110£º2046/index.jsp £¬´úÀí·þÎñÆ÷ÔÙ½«·ÃÎʵ½µÄ½á¹û·µ»Ø¸øÎÒÃǵÄä¯ÀÀÆ÷£¬ÒòΪÊÇ´úÀí·þÎñÆ÷È¥·ÃÎÊindex.jspµÄ£¬ËùÒÔindex.jspÖÐͨ¹ýrequest.getRemoteAddr£¨£©µÄ·½·¨»ñÈ¡µÄIPʵ¼ÊÉÏÊÇ´úÀí·þÎñÆ÷µÄµØÖ·£¬²¢²»ÊÇ¿Í»§¶ËµÄIPµØÖ·¡£
ÓÚÊǿɵóö»ñµÃ¿Í»§¶ËÕæʵIPµØÖ·µÄ·½·¨Ò»£º
public String getRemortIP(HttpServletRequest request) {
if (request.getHeader("x-forwarded-for") == null) {
return request.getRemoteAddr();
}
return request.getHeader("x-forwarded-for");
}
¿ÉÊǵ±ÎÒ·ÃÎÊhttp://www.5a520.cn /index.jsp/ ʱ£¬·µ»ØµÄIPµØַʼÖÕÊÇunknown£¬Ò²²¢²»ÊÇÈçÉÏËùʾµÄ127.0.0.1¡¡»ò¡¡192.168.1.110ÁË£¬¶øÎÒ·ÃÎÊhttp://192.168.1.110£º2046/index.jsp ʱ£¬ÔòÄÜ·µ»Ø¿Í»§¶ËµÄÕæʵIPµØÖ·£¬Ð´Á˸ö·½·¨È¥ÑéÖ¤¡£ÔÒò³öÔÚÁËSquidÉÏ¡£squid.conf µÄÅäÖÆÎļþ¡¡forwarded_for ÏîĬÈÏÊÇΪon£¬Èç¹û forwarded_for Éè³ÉÁË off ¡¡Ôò£ºX-Forwarded-For£º unknown
ÓÚÊǿɵóö»ñµÃ¿Í»§¶ËÕæʵIPµØÖ·µÄ·½·¨¶þ£º
public String getIpAddr(HttpServletRequest request) {
String ip = request.getHeader("x-forwarded-for");
if(ip == null || ip.length() == 0 || "unkn
Ïà¹ØÎĵµ£º
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyÄêMMÔÂddÈÕ HH:mm:ss");
System.out.println(sdf.format(date));
SimpleDateFormat sdf2 = new SimpleDateFormat("MM");
System.out.println(sdf2.format(date));
Calendar c = Calendar.getInstance();
System.out.println(c.get(C ......
import java.awt.*;
import java.awt.event.*;
//¶íÂÞ˹·½¿éÀà
public class ERS_Block extends Frame{
public static boolean isPlay=false;
public static int level=1,score=0;
public static TextField scoreField,levelField;
public static MyTimer timer;
Ga ......
0
£®ÒýÑÔ
ÔÚChinaITLAB
µ¼Ê¦ÖƸ¨µ¼ÖУ¬±ÊÕß·¢ÏÖÎʵÃ×î¶àµÄÎÊÌâĪ¹ýÓÚ"
ÈçºÎѧϰ±à³Ì£¿Java
¸ÃÈçºÎѧϰ£¿"
¡£ÀàËƵÄÎÊÌâ»Ø´ð¶àÁË£¬ÄÑÃâ»á¸Ð¾õÑá·³£¬¾ÍÃÈÉúÁËдϱ¾ÎĵÄÏë·¨¡£µ½Ê±ºòÔÙÓÐÈËÎÊÆðÀàËƵÄÎÊÌ⣬ÎÒ¿ÉÒÔ¸æËßËû£¨Ëý£©£¬ÇëÄãÈ¥¿´¿´¡¶Java
ѧϰ֮·¡·¡£°Ý¶Á¹ý̨Íå²ÌѧïÞÏÈÉúµÄ¡¶Java
ҹδÃß¡·£¬ÓÐ ......
package zzq.main;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
/************************************************************************
* CÓïÑÔȤζ³ÌÐò£¨²»µ½£©°ÙÀý-Ö®JavaʵÏÖ
*
* 0 ......
ÏÖÔÚÊг¡ÉϵÄoa»ù±¾ÉϿɹé½áΪÁ½´óÕóÓª£¬¼´phpÕóÓªºÍjavaÕóÓª¡£µ«¶Ô½Ó´¥oa²»¾ÃµÄÓû§À´Ëµ£¬¿´µ½µÄÍùÍùÖ»ÊÇËüÃǵıíÏֻ࣬ÊÇÃ÷ÏԵļ۸ñ²îÒ죬ȴºÜÄÑ¿´³öËüÃÇÖ®¼äµÄʵ¼Ê²îÒì¡£Æäʵ£¬ PHP + MYSQL ²»ÖµÇ®²»½ö½ö¾ÖÏÞÓÚoaÈí¼þ£¬¶øÊÇÕûÌåÉÏPHP + MYSQL¿ª·¢µÄÈí¼þ¶¼²»Èçjava¿ª·¢µÄÈí¼þֵǮ¡£ÎªÊ²Ã´PHP + MYSQL µÄOAΪʲô²»ÖµÇ®Ä ......