PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 11th, 2005, 04:40 PM
bituthomas bituthomas is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 5 bituthomas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
php logging in

Hi I have a problem. I am starting my PHP website and I have a login page and email. I also have a database in mySql.I am able to insert records through a form, but now I want to type in an email on the front page and I want the same e-mail to be retrieved from my database.

So I don't know how to match the email address on the page to the one in the database. please help.
This is the code and the page to which I have directed the home page on which email and password fields are present.

<html>

<head> This is a new page</head>
<body>
<?php
$db = mysql_connect("studb.cms.gre.ac.uk","****","****");
$rec = mysql_select_db("mdb_tb405");


$password=$HTTP_POST_VARS["frmpassword"];
$query="select * from jobseeker where password='$password'";
$result=mysql_query($query,$db);
$nmb=mysql_num_rows($result);// number of rows..in this case 1
if($nmb==1)
alert("This is valid");
$data=mysql_fetch_array($result);
<!-- echo $nmb; -->
<!-- header("Location : file.php");-->
?>
</body>
</html>

Reply With Quote
  #2  
Old January 13th, 2005, 09:35 AM
ramz ramz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Juiz de Fora - MG- Brazil
Posts: 93 ramz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to ramz Send a message via MSN to ramz
Try this

I saw your post, but need more info to help you out. I need to know if you're using the PASSWORD() function of MySQL to store the passwords at your database. If yes, try the code below.

<html>

<head> This is a new page</head>
<body>
<?php
$db = mysql_connect("studb.cms.gre.ac.uk","****","****");
$rec = mysql_select_db("mdb_tb405");

$password = $_POST['frmpassword'];
$query = "select * from jobseeker where password = PASSWORD('$password')";
$result = mysql_query($query,$db);
$nmb = mysql_num_rows($result);
if($nmb) {
alert("This is valid");
$data = mysql_fetch_array($result);
<!-- echo $nmb; -->
<!-- header("Location : file.php");-->
}
?>
</body>
</html>

Regards,
Ramiro
__________________
Regards,
Ramiro Varandas Jr.

Reply With Quote
  #3  
Old January 14th, 2005, 06:56 AM
bituthomas bituthomas is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 5 bituthomas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile thanx

Thanks so much i have been waiting for a reply for three days but I finally figured out a way to do it. Thanks Ramiro.

Reply With Quote
  #4  
Old January 14th, 2005, 07:29 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
bituthomas,

How did you end up solving the problem?

Reply With Quote
  #5  
Old January 14th, 2005, 08:09 AM
bituthomas bituthomas is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 5 bituthomas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile solution

I used this code


<html>
<head>
<title>
Employement for You
</title>
</head>
<body>
<?php

$db = mysql_connect("studb.cms.gre.ac.uk","****","****");
$rec = mysql_select_db("mdb_tb405",$db);

$post_vars = $HTTP_POST_VARS;
$pwd = $HTTP_POST_VARS['pass'];
$email = $HTTP_POST_VARS['email'];


$result = mysql_query("SELECT email FROM userslist2 WHERE password ='$pwd' and email='$email'",$db);
$pno=mysql_numrows($result);

if ($pno >0)
{
header("Locationptions.php?email=$email");
}
else
{
$msg="incorrect email or password";
header("Location:login.php?msg=$msg");
}
?>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > php logging in


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT