Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
TimeLimits
allo5605cc80189b
diff --git a/htroot/User_p.java b/htroot/User_p.javaindex d6a0b4e5c..cd86a213e 100644--- a/htroot/User_p.java+++ b/htroot/User_p.java@@ -163,7 +163,9 @@ public class User_p {entry = sb.userDB.getEntry(username);if(entry != null){try{- entry.setProperty(userDB.Entry.MD5ENCODED_USERPWD_STRING, serverCodings.encodeMD5Hex(username+":"+pw));+ if(! pw.equals("")){+ entry.setProperty(userDB.Entry.MD5ENCODED_USERPWD_STRING, serverCodings.encodeMD5Hex(username+":"+pw));+ }entry.setProperty(userDB.Entry.USER_FIRSTNAME, firstName);entry.setProperty(userDB.Entry.USER_LASTNAME, lastName);entry.setProperty(userDB.Entry.USER_ADDRESS, address);diff --git a/htroot/proxymsg/error.html b/htroot/proxymsg/error.htmlindex d39e76547..7f4dab6cf 100644--- a/htroot/proxymsg/error.html+++ b/htroot/proxymsg/error.html@@ -9,7 +9,7 @@<meta name="copyright" content="Michael Christen"><base href="http://#[host]#:#[port]#/">-<link rel="stylesheet" media="all" href="/env/style.css">+<link rel="stylesheet" media="all" href="http://#[host]#:#[port]#/env/style.css"><!-- (C), Architecture and Realisation: Michael Peter Christen; Contact: mc <at> anomic.de -->@@ -21,7 +21,7 @@<tr height="36"><td width="240"><a href="http://www.yacy.net">- <img width="52" height="33" border="0" src="/env/grafics/yacy.gif" align="top">+ <img width="52" height="33" border="0" src="http://#[host]#:#[port]#//env/grafics/yacy.gif" align="top"></a></td><td width="50%" align="center">@@ -55,6 +55,8 @@Could not load resource. The file is not available.::<!-- 4 -->#[detailedErrorMsg]#+ ::<!-- 5 -->+ Your Internet-Timelimit is reached.#(/errorMessageType)#</b></p>diff --git a/source/de/anomic/data/userDB.java b/source/de/anomic/data/userDB.javaindex 486caedbc..6c779cb67 100644--- a/source/de/anomic/data/userDB.java+++ b/source/de/anomic/data/userDB.java@@ -240,19 +240,30 @@ public final class userDB {return (this.mem.containsKey(LAST_ACCESS)?Long.valueOf((String)this.mem.get(LAST_ACCESS)):null);}- public long updateLastAccess(long timeStamp, boolean decrementTimeUsed) {+ public boolean canSurf(){+ if(this.updateLastAccess(true) < this.getTimeLimit().longValue() )+ return true;+ else+ return false;+ }+ public long updateLastAccess(boolean incrementTimeUsed) {+ return updateLastAccess(System.currentTimeMillis(), incrementTimeUsed);+ }+ public long updateLastAccess(long timeStamp, boolean incrementTimeUsed) {if (timeStamp < 0) throw new IllegalArgumentException();Long lastAccess = this.getLastAccess();long oldTimeUsed = getTimeUsed();long newTimeUsed = oldTimeUsed;- if (decrementTimeUsed) {+ if (incrementTimeUsed) {if ((lastAccess == null)||((lastAccess != null)&&(timeStamp-lastAccess.longValue()>=1000*60))) {this.mem.put(TIME_USED,Long.toString(newTimeUsed = ++oldTimeUsed));+ this.mem.put(LAST_ACCESS,Long.toString(timeStamp)); //update Timestamp}- }- this.mem.put(LAST_ACCESS,Long.toString(timeStamp));+ }else{+ this.mem.put(LAST_ACCESS,Long.toString(timeStamp)); //update Timestamp+ }try {userDB.this.userTable.set(getUserName(), this.mem);diff --git a/source/de/anomic/http/httpd.java b/source/de/anomic/http/httpd.javaindex e8e576cf3..c32c0192b 100644--- a/source/de/anomic/http/httpd.java+++ b/source/de/anomic/http/httpd.java@@ -323,7 +323,12 @@ public final class httpd implements serverHandler {userDB.Entry entry=switchboard.userDB.getEntry(tmp[0]);if( entry != null && entry.getMD5EncodedUserPwd().equals(serverCodings.encodeMD5Hex(auth)) ){//TODO: Check Timelimits- return true;+ if(entry.canSurf()){+ return true;+ } else {+ sendRespondError(this.prop,this.session.out,5,403,null, "Internet-Timelimit reached", null);+ return false;+ }}}// ask for authenticate@@ -332,14 +337,6 @@ public final class httpd implements serverHandler {this.session.out.write((httpHeader.CONTENT_LENGTH + ": 0\r\n").getBytes());this.session.out.write("\r\n".getBytes());return false;-// if (!this.proxyAccountBase64MD5.equals(serverCodings.encodeMD5Hex(auth.trim().substring(6)))) {-// // ask for authenticate-// this.session.out.write((httpVersion + " 407 Proxy Authentication Required" + serverCore.crlfString +-// httpHeader.PROXY_AUTHENTICATE + ": Basic realm=\"log-in\"" + serverCore.crlfString).getBytes());-// this.session.out.write((httpHeader.CONTENT_LENGTH + ": 0\r\n").getBytes());-// this.session.out.write("\r\n".getBytes());-// return false;-// }}else{return true;}