Creating Login

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2007
Posts: 27
Reputation: eeeman is an unknown quantity at this point 
Solved Threads: 0
eeeman eeeman is offline Offline
Light Poster

Creating Login

 
0
  #1
Mar 25th, 2007
Hi I am having trouble creating a system to log in to a system.

If you look at a picture its like this. User selects thier user name from a dropdown box, and then select thier Picture(instead of typing in a password to login.

There can I get more info on how to make something like this?
Attached Thumbnails
Logindesign.JPG  
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 27
Reputation: eeeman is an unknown quantity at this point 
Solved Threads: 0
eeeman eeeman is offline Offline
Light Poster

Re: Creating Login

 
0
  #2
Mar 26th, 2007
Do I store the usernames in an array lisst and pictures inb and array list and then somehow match them together to allow the user a succesful login>?
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,249
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 540
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: Creating Login

 
0
  #3
Mar 26th, 2007
i would use a database myself
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 539
Reputation: thekashyap will become famous soon enough thekashyap will become famous soon enough 
Solved Threads: 50
thekashyap's Avatar
thekashyap thekashyap is offline Offline
Posting Pro

Re: Creating Login

 
0
  #4
Mar 26th, 2007
What language you wanna use? VB, VC, Java, JSP..
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 539
Reputation: thekashyap will become famous soon enough thekashyap will become famous soon enough 
Solved Threads: 50
thekashyap's Avatar
thekashyap thekashyap is offline Offline
Posting Pro

Re: Creating Login

 
0
  #5
Mar 26th, 2007
Originally Posted by eeeman View Post
Do I store the usernames in an array lisst and pictures inb and array list and then somehow match them together to allow the user a succesful login>?
Now I saw the specific question. In my opinion you don't really need to "store the pictures". You can assign some ID to each picture and store the association of Username vs this ID. Picture could be just shown on the UI and when it's selected appropriate ID along with the username can be given to server for verification. (Point is you don't compare the picture with picture but ID with ID).
The ID can be an int or string or...
Storage of the list of Username vs ID most probably has to be done persistantly. I would recommend not to use DB if this is the only reason you want to use it. Rather go for a simple flat/txt file would be easier.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,433
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 258
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: Creating Login

 
0
  #6
Mar 26th, 2007
Originally Posted by thekashyap View Post
Storage of the list of Username vs ID most probably has to be done persistantly. I would recommend not to use DB if this is the only reason you want to use it. Rather go for a simple flat/txt file would be easier.
I don't know why you feel storing it in a flatfile is better. That requires that you load the entire list while running, or that you write your own search routines to search for the user/id combination. With a DB you simply set of a query with the username as the search string and return the "id". No fuss, no muss. No loading the entire list into main memory, and no self-rigged search routines. And storing new user/id combos is just as easy as finding one. A single statement, and you're done. And this includes the possibility of a new user attempting to use the same name as a current user, when the username is the primary key, as the insert will fail with a primary key validation. With that, you no longer even have to check yourself whether a new username exists or not. Simply try to add it.
Last edited by masijade; Mar 26th, 2007 at 7:49 am. Reason: typo
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 539
Reputation: thekashyap will become famous soon enough thekashyap will become famous soon enough 
Solved Threads: 50
thekashyap's Avatar
thekashyap thekashyap is offline Offline
Posting Pro

Re: Creating Login

 
-1
  #7
Mar 26th, 2007
Originally Posted by masijade View Post
That requires that you load the entire list while running, or that you write your own search routines to search for the user/id combination.
True but I feel that would be easier !

Originally Posted by masijade View Post
With a DB you simply set of a query with the username as the search string and return the "id".
As someone quoted earlier you've deceptively missed a few other things:
1. Installation of DB?
2. Creation of DB table?
3. Code to create the DB connection?
4. Readup how to do step 1, 2 and 3 or ask someone???
I sure agree that once you're done with all this you'll "simply set of a query with the username as the search string and return the id".

Originally Posted by masijade View Post
No fuss, no muss. No loading the entire list into main memory, and no self-rigged search routines. And storing new user/id combos is just as easy as finding one. A single statement, and you're done.
Here is the fuss/muss we'll have to do if we use flat file (see the code at end). Self-regged search routines? std::map gives it. map::find().
Abt the "single stmt and you're done part" as I said earlier, it's not really true.

Originally Posted by masijade View Post
And this includes the possibility of a new user attempting to use the same name as a current user, when the username is the primary key, as the insert will fail with a primary key validation. With that, you no longer even have to check yourself whether a new username exists or not. Simply try to add it.
See the return type of std::map::insert(). It does this for you. Again you don't write no code.

  1. #define MAX_LINE_LEN 100
  2.  
  3. int main()
  4. {
  5. FILE * pFile = fopen ("user_info.txt", "w+");
  6. if( ! pFile )
  7. {
  8. cout << "Could not open file" << endl ;
  9. return 1 ;
  10. }
  11.  
  12. for( int i = 0; i < 10; i++ )
  13. {
  14. char dummy[50] ;
  15. itoa(i, dummy, 10) ;
  16. fprintf (pFile, "%s %d\n", dummy, i);
  17. }
  18.  
  19. rewind (pFile);
  20.  
  21. map< string, int > usrInfMap ;
  22. char str [80];
  23. int j;
  24. while( EOF != fscanf (pFile, "%s %d", str, &j) )
  25. {
  26. usrInfMap[str] = j ;
  27. };
  28.  
  29. fclose (pFile);
  30.  
  31. map< string, int >::iterator it = usrInfMap.begin();
  32. for( ; it != usrInfMap.end(); it++ )
  33. cout << it->first.c_str() << " = " << it->second << endl ;
  34.  
  35. return 0;
  36. }

Now finally remember that I said earlier:
I would recommend not to use DB if this is the only reason you want to use it (=>DB).

Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,433
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 258
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: Creating Login

 
0
  #8
Mar 26th, 2007
Originally Posted by thekashyap View Post
True but I feel that would be easier !


As someone quoted earlier you've deceptively missed a few other things:
1. Installation of DB?
2. Creation of DB table?
3. Code to create the DB connection?
4. Readup how to do step 1, 2 and 3 or ask someone???
I sure agree that once you're done with all this you'll "simply set of a query with the username as the search string and return the id".


Here is the fuss/muss we'll have to do if we use flat file (see the code at end). Self-regged search routines? std::map gives it. map::find().
Abt the "single stmt and you're done part" as I said earlier, it's not really true.


See the return type of std::map::insert(). It does this for you. Again you don't write no code.

  1. #define MAX_LINE_LEN 100
  2.  
  3. int main()
  4. {
  5. FILE * pFile = fopen ("user_info.txt", "w+");
  6. if( ! pFile )
  7. {
  8. cout << "Could not open file" << endl ;
  9. return 1 ;
  10. }
  11.  
  12. for( int i = 0; i < 10; i++ )
  13. {
  14. char dummy[50] ;
  15. itoa(i, dummy, 10) ;
  16. fprintf (pFile, "%s %d\n", dummy, i);
  17. }
  18.  
  19. rewind (pFile);
  20.  
  21. map< string, int > usrInfMap ;
  22. char str [80];
  23. int j;
  24. while( EOF != fscanf (pFile, "%s %d", str, &j) )
  25. {
  26. usrInfMap[str] = j ;
  27. };
  28.  
  29. fclose (pFile);
  30.  
  31. map< string, int >::iterator it = usrInfMap.begin();
  32. for( ; it != usrInfMap.end(); it++ )
  33. cout << it->first.c_str() << " = " << it->second << endl ;
  34.  
  35. return 0;
  36. }

Now finally remember that I said earlier:
I would recommend not to use DB if this is the only reason you want to use it (=>DB).

I did not miss any of those posts, but not asingle one of them is hard, and yna software you get will contain the instructions for doing them, so no, you would not need to "ask someone".

Everything else you wrote is c++ not Java. Go crawl back under the rock you came from.

And, flat file system will never give you the type of security you want for a password system unless you encrypt them as well. Then you also have to self-rigg that encryption system, and even though the "password" here is simply a picture "id" it should still be encrypted. Nearly all mainstream dbs provide an easy way to encrypt entries, so even that is "done for you".

So remember, I say again, why do you think a flat file system is better?
Last edited by masijade; Mar 26th, 2007 at 1:18 pm.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 27
Reputation: eeeman is an unknown quantity at this point 
Solved Threads: 0
eeeman eeeman is offline Offline
Light Poster

Re: Creating Login

 
0
  #9
Mar 26th, 2007
Wow is that coencidence that you both have avatars created by matt groening.

Ok, thnx for the replies aye. To be honest this doesnt even need security, all it really needs is different files stored for different userz.

I don't want to create a database so I like the flat txt file idea:-| .

Ill read through your comments and see if I can code this.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 27
Reputation: eeeman is an unknown quantity at this point 
Solved Threads: 0
eeeman eeeman is offline Offline
Light Poster

Re: Creating Login

 
0
  #10
Mar 27th, 2007
This is what I have so far. Btw im using J builder.

I've created the GUI and now I need to store the data when you Create Account.




  1.  
  2.  
  3. //createAccountBtn pressed
  4. createAccountBtn.addActionListener(new ActionListener(){
  5. public void actionPerformed(ActionEvent e) {
  6. userName = userNameInput.getText();
  7. userBox.addItem(userName);
  8. }
  9. });

So far all I managed was to make the comboBox contain the username.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC