This week's giveaways are in the MongoDB and Jobs Discussion forums. We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line! See this thread and this one for details.
hello , i create a desktop application, when user run that, a login screen appears, and only after successful login he will get access to that software.
but i want afetr user logged in, if he again run that application he should not get login screen again.
so what can i do for this, sessions are there in desktop applications??
also i want to know my login code is okay or not, here is my login code:
Thank you.
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
0
also i want to know my login code is okay or not
It's not, it's wide open to SQL injection attacks. Read up on PreparedStatement.
Your login code is very poor. You have declared a PreparedStatement and are calling 'prepareStatement' too, but it is a waste because there is nothing there to prepare in the query.
As for session, I don't think your definition of session is correct. Even in a web app, when I open the browser and log in, my 'session' is alive only till my browser is open. If I close the browser and re-open again, my session is lost and I have to re-login again. So, I think the same would apply to desktop too.
If you want the functionality that you have mentioned, you have to write your own logic, but don't call it a 'session'.
Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Punit Jain
Ranch Hand
Joined: Aug 20, 2011
Posts: 902
posted
0
okay i have done changes to my login code, here is what i changed:
Punit Jain
Ranch Hand
Joined: Aug 20, 2011
Posts: 902
posted
0
also with my earlier login code i just tried for sql injuction with below login id and password:
user:admin
pass:’ or 1=1–
but it showing me exception only, not giving my user id and password.??
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
0
How about this as a password:
'; drop table AdminLogin; --
Punit Jain
Ranch Hand
Joined: Aug 20, 2011
Posts: 902
posted
0
no it's not dropped my table, it showing me one exception:
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
0
Well, just keep at it and eventually you may succeed.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.