Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hello,

 

I'm editing my previous post.  Still much to learn in this chapter, but making my way through it.  I was having a difficult time connecting each of the individual pages (e.g., login_page.inc.php, login.php, etc.).  Great book though.

 

K

Share this post


Link to post
Share on other sites

Think of the login.php as a container or box. Inside that box at the bottom is an include statement for the login_page.inc.php. At the top of the login.php is an include for the login_functions.inc.php page.

 

Entering login.php loads that and everything else inside that box. Because of the beauty of this, it's now all available for use.

 

Now that we have that, you'll notice that the < forms > action tag, reloads the page on submitting. Again, at the top, you'll see it going through the page top to bottom, left to right. This time the $_POST is true and because of that check, the function is called.

 

When your first load login,php, that $_POST call is false, so the code is bypassed and the login pages forms loads instead.

 

As a tip: One of the wonderful things you can to to help yourself, is to indent in a proper way all the coding. It makes it MUCH easier to read and very clean to look at.

 

Hope this helps you.

 

Richard

Share this post


Link to post
Share on other sites

By way of example of that tip:

 

<?php

    include ('foo.bar');

 

    if ($x == $something) {

        let's do something if this is true;

    } else {

        let's do some else instead;

    }

?>

 

This looks much cleaner and easier to read especially when you have over 100 lines of this type of coding. I've seen it look like this before.

 

<?php

include ('foo.bar');

if ($x == $something) {

let's do something if this is true;

} else {

let's do some else instead;

}

?>

 

Now that is to me harder to read and follow, don't you agree.

 

Have a prosporous day.

 

Richard

 

?>

Share this post


Link to post
Share on other sites

Thanks for the nice words on the book! In the future, please don't edit your original post. It makes the subsequent replies seem very out of context. 

Share this post


Link to post
Share on other sites

Hi Larry,

 

I hadn't edited my post. That editing comment was from kamaboko. I received in email his original post. That is what I was replying to. I'll put it here for you. This is the only time I'll copy/paste in a forum.

 

[ START ]

 

rdburbridgesr,

kamaboko has just posted a new topic entitled "Chapter 12. Do Not Understand Login Process" in forum "PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)".

----------------------------------------------------------------------

Hello,

I've been at this for some time now, and cannot seem to draw a connection as to how login_page.inc.php, login_functions.inc.php, and login.php all work together.

For instance, when I go to the URL and type in login.php, it pulls up the content coded in page login_page.inc.php.  In this case, the input for the email address and the password.  How?  I don't see an include or a funciton call in login.php that specifically pulls in login_page.inc.php.  This is all very confusing to me.  A diagram showing the chain of events would be fantastically useful. For instance, what line of code on which page is affecting another page and some other line of code.

Up to this point, I feel pretty good about what I've covered in the book, but now I'm utterly confused.

Thanks in advance for your input.

K
 
[ END ]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×