If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > MYSQL -PHP login page?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-02-03, 02:34
t0asinkkonen t0asinkkonen is offline
Registered User
 
Join Date: Dec 2003
Posts: 2
MYSQL -PHP login page?

Hello!

I were just asking help if somebody could help me with this problem...
I would like to create login page before my home page and I would like make it with PHP. Passworw should be asked and confirmed from MySQL dataBase...
Thank for any help!!!
Reply With Quote
  #2 (permalink)  
Old 12-02-03, 04:30
ika ika is offline
Registered User
 
Join Date: Oct 2003
Location: Slovakia
Posts: 482
Re: MYSQL -PHP login page?

Quote:
Originally posted by t0asinkkonen
Hello!

I were just asking help if somebody could help me with this problem...
I would like to create login page before my home page and I would like make it with PHP. Passworw should be asked and confirmed from MySQL dataBase...
Thank for any help!!!
http://www.phpbuilder.com
http://www.php.net (section mysql in doc)
Reply With Quote
  #3 (permalink)  
Old 12-02-03, 06:14
deRusett deRusett is offline
Registered User
 
Join Date: Nov 2003
Posts: 8
make a config file
config.php
PHP Code:
<?php
mysql_pconnect
("host","name","pass");
mysql_select_db("dbname");
?>
then your index.php page should contain the log in form

PHP Code:
<?php include("config.php"); ?>

bunch of HTML or what ever you have coded in

in this bunch you need to have a 
log in form that looks something like this


<table cellpadding=0 cellspacing=0 width=50%>
<form method=post action=login.php>
<tr><td width="67" with=10>Email:</td>
<td width="145"><input type=text name=email></td></tr>
<tr><td with=10>Password:</td><td><input type=password name=pass></td></tr>
<tr><td colspan=2 align=center><input type=submit value=Login></td></tr></table></form>

then you need a login page
PHP Code:
<?php
if (!$email || !$pass) {
    include(
"config.php");
    print 
"Please fill out all fields.";
    exit;
}
include(
"config");
$sql mysql_query("select * from dbname where email='$email' and pass='$pass'");
$logres mysql_num_rows($sql);
if (
$logres <= 0) {
    print 
"Login failed.";
    exit;
} else {
    
session_register("email");
    
session_register("pass");
    print 
"&nbsp;<br>Welcome back. Please click 
                <a href=membersonly.php>here</a> to continue.."
;
}
?>
you might consider a register page as well
you should beable to figure out how to make it after seeing this post and looking at the sites mentioned above

Last edited by deRusett; 12-02-03 at 06:17.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On