Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-17-2012, 06:02 PM   PM User | #1
Real_news
New to the CF scene

 
Join Date: Oct 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Real_news is an unknown quantity at this point
Error with JSP code

Hello,

I have had to take over the duties of our Java/JSP developer and my expertise is really in Php.

So, I have had to add a code to one of our Jsp pages, which the code simply all it does are:
1- get the users IP
2- see if their IP is blocked or not
3- if blocked then redirect them to page that says that they are blocked

However, the Jsp code is not working. Here is the code;


String user_ip = request.getRemoteAddr();
Connection cone_ip = getConnection();
PreparedStatement pse_ip = cone_ip.prepareStatement("SELECT COUNT(id) AS blocked_ip FROM people_news.blocked_ips WHERE '" + user_ip + "' BETWEEN start_ip AND end_ip";
ResultSet rse_ip = pse_ip.executeQuery();
if (rse_ip.getInt("blocked_ip") > 0){
response.sendRedirect("blocked.php");
}
cone_ip.close();


Can you tell me what is wrong with this Jsp code?

Regards,
Real_news is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:25 PM.


Advertisement
Log in to turn off these ads.