472,353 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

How to check whether the username and password entered in a login php form are valid

Could anyone please tel me in detail ... How to check whether the username and password entered by user in a login php form are valid ... I have not created any database ...

I already have created a registration form , in which user enters his details ... But how can i make sure that in login form, he enters the same id and password ....

Regards,
Shwetha
Sep 18 '08 #1
3 4128
dlite922
1,584 Expert 1GB
you get the the record in the database for the username he's giving you, if any exist.

Then get the stored password and compare it to the one he entered. If they are the same, he's validated.

Are you talking about some other validation?



Dan
Sep 18 '08 #2
divyac
40
Hi shwetha,
First you must send all the values from the registration form to the database and try out the below code...
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. if(isset($_POST['<submit button name>']))
  4. {
  5.  
  6.        $result=mysql_query("SELECT * FROM tablename WHERE <name field from database>='$_POST[<textbox name of name>]' and <password field from database>='$_POST[<textbox name of password>]'");
  7.  
  8. $row=mysql_num_rows($result);
  9.  
  10. if($row>0)
  11. {
  12.     header('location:<specifipage>.php');
  13. }
  14. else
  15. {
  16.     alert(Incorrect username and password);
  17. }
  18. }
  19. ?>
  20.  
Hope this works....
Sep 18 '08 #3
Markus
6,050 Expert 4TB
First of all you're going to have to create a database table. You could use flat files... but that's more effort than what's required.
Sep 18 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: carr4895 | last post by:
Hello. I was wondering if someone could help me too with a login form. Upon startup, I have to display a password screen and it should accept a...
0
by: None | last post by:
Hi, I have written a c# code to find the given username and password is correct or not. (i.e the given username and password will be checked...
10
by: priyakollu | last post by:
hi guyz! please help me in sorting out error as im unable to find it... my requirement is there will be userid field and password field and...
2
by: sweatha | last post by:
I have created a login form in asp.net web page.Just like that I have created a table named login which has 2 fields as username & password in SQL...
8
by: Mai Le | last post by:
Hello, I used Microsoft Access to create a login form with Name Password Access Level Admin and User I would like to let Admin login and open...
1
by: geetamadhavi | last post by:
Hi All, I have developed a php applciaiton where a new window is opening on checking the whether valid user orntot how to make that in same window...
5
by: Sudhir123 | last post by:
Hi.. I need to find out whether user has entered only black spaces or some text which might have some spaces.. But i more interested to check for...
6
by: amd321 | last post by:
i want to make a site that can check if some password that i have is good. the software need to go to the site. and check whether the password is...
1
by: amd321 | last post by:
i want to make a site that can check if some password that i have is good. the software need to go to the site. and check whether the password is...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.