English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I've created a registration form in golive. I've named the textfields "loginname" "password" etc. I have arough idea of php. I created my database with fields named like in my form. Someone said to use $post, but I don't understand, do I need to specify the name of the database in the

2006-10-23 05:14:07 · 1 answers · asked by author 2 in Computers & Internet Programming & Design

1 answers

First of all, this is not really specific to GoLive. GoLive will help you with the form and HTML, but not the login code. So my answer would work with any site, regardless of the design software.

Your form does not need to be in PHP, regular HTML will do. Then the POST action for the form can be a PHP script to log in. A good example would be the WordPress login web page and wp-login.php script. They do what you want.

The login form just has this:



and wp-login.php has all the code for checking the database for the correct userid / password info. In wp-login.php, it gets the database configuration information using this command:

require( dirname(__FILE__) . '/wp-config.php' );

because the database information (e.g. database name, db userid/password, etc.) is in wp-config.php and is shared between all WordPress php scripts. Then look for this code in wp-login.php to see how they query the database:

case 'login' :

They have a lot of helper functions you can study to learn about how to do this. Notice that at the end, they redirect to the site's web page after putting together a session, so this PHP script doesn't really output a web page the user will see. It is just code for handling the login form and redirecting to the site or an error message.

2006-10-25 10:29:30 · answer #1 · answered by Anonymous · 0 0

fedest.com, questions and answers