User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 373,939 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,623 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 681 | Replies: 1 | Solved
Reply
Join Date: Mar 2007
Posts: 13
Reputation: roby4eldiablo is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
roby4eldiablo roby4eldiablo is offline Offline
Newbie Poster

Login and check password from Database

  #1  
Apr 30th, 2008
Hi all. I have a login Form where user can insert Nickname & Password.
I have a database where i have listed new registered user and store their information.
The problem is when I control the Form data "pass" and check if it's equal to the rst("pwd")
into the database.
It never match....
The 2 password are equal but it look like if they are different.
Someone can help me please?

  1. var con;
  2. var conString;
  3. con = Server.CreateObject("ADODB.Connection");
  4. conString = "Provider=Microsoft.Jet.OLEDB.4.0; "+ "Data Source= " + Server.MapPath("/negozio.mdb");
  5. con.Open(conString);
  6. var n, p, q;
  7. n=Request.Form("nick");
  8. p=Request.Form("pass");
  9. var sSQLString;
  10. var rst;
  11. rst = Server.CreateObject("ADODB.Recordset");
  12. sSQLString = "SELECT pwd FROM utenti WHERE nick='"+n+"';";
  13. rst = con.Execute(sSQLString);
  14. q=rst("pwd");
  15. if (p != q)
  16. {Response.write ("Password errata, reinserire la password corretta");
  17. Response.AddHeader ("Refresh", "5;URL=login.asp");
  18. con.Close( );
  19. con = null;
  20. }
  21. else {Response.write ("Salve " + n + " benvenuto, tra un attimo potra accedere alle opzioni del sito");
  22. Response.AddHeader ("Refresh", "5;URL=home.asp");
  23. con.Close( );
  24. con = null;
  25. }
Last edited by roby4eldiablo : Apr 30th, 2008 at 9:51 am.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2007
Posts: 13
Reputation: roby4eldiablo is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
roby4eldiablo roby4eldiablo is offline Offline
Newbie Poster

Re: Login and check password from Database

  #2  
May 2nd, 2008
I modify the sql string and the condition and all work properly.
I hope that someone can benefit from this article.


  1. var con;
  2. var conString;
  3. con = Server.CreateObject("ADODB.Connection");
  4. conString = "Provider=Microsoft.Jet.OLEDB.4.0; "+ "Data Source= " + Server.MapPath("/negozio.mdb");
  5. con.Open(conString);
  6. var n, p;
  7. n=Request.Form("nick");
  8. p=Request.Form("pass");
  9. var sSQLString;
  10. Response.write (" "+n+"</br>");
  11. Response.write (" "+p+"</br>");
  12. var rst;
  13. var sSQLString;
  14. rst = Server.CreateObject("ADODB.Recordset");
  15. sSQLString = "SELECT * FROM utenti WHERE nick='"+n+"' AND pwd='"+p+"';";
  16. Response.write (" "+sSQLString+"</br>");
  17. rst = con.Execute(sSQLString);
  18. if(rst.EOF)
  19. {Response.write ("Password errata, reinserire la password corretta");
  20. Response.AddHeader ("Refresh", "5;URL=login.asp");
  21. con.Close( );
  22. con = null;
  23. }
  24. else {Response.write ("Salve " + n + " benvenuto, tra un attimo potra accedere alle opzioni del sito");
  25. Response.AddHeader ("Refresh", "5;URL=home.asp");
  26. con.Close( );
  27. con = null;
  28. }
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ASP Forum

All times are GMT -4. The time now is 6:50 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC