CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Java

 How to allow only Users from specific IP address

Print topic Send  topic

Author Message
dkartik

Posts: 1
Posted: 09/26/2005, 8:11 AM

Hi to all,

I need coding in JSP for allowing only users from particular IP address list which is stored in database.The code must first get the User IP address and compare it the IP List in database and should allow user only if the user IP is listed in database IP list.

Thanks in advance..
_________________
Love,
Karthi
View profile  Send private message
awalland

Posts: 7
Posted: 10/02/2005, 8:42 PM

if(Integer.parseInt(DBTools.dLookUp("count(*)", "table", "ip_address = '"+e.getPage().getRequest().getRemoteAddr().toString()+"'", "Connection1")) == 0){
e.getPage().setRedirect("access_denied_page.jsp");
}


hth, armin
View profile  Send private message
newbie
Posted: 10/10/2005, 7:52 AM

Hey,
I am getting this error. Any ideas?

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 6 in the jsp file: /MERCHANT_maintHandlers.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\ocg\org\apache\jsp\MERCHANT_005fmaint_jsp.java:469: cannot resolve symbol
symbol : method parseInt (java.lang.Object)
location: class java.lang.Integer
if(Integer.parseInt(DBTools.dLookUp("count(*)", "useraccount", "username="+userName, "ocgdb")) > 0){
^
1 error
miko

Posts: 50
Posted: 10/10/2005, 11:38 PM

You can try the following code:
if(Utils.convertToLong(DBTools.dLookUp("count(*)", "useraccount", "username="+userName, "ocgdb")).intValue() > 0){
_________________
Regards,
Michael
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.