Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

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, 03: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, 05: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, 07: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 07: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

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