1

I am trying to fully understand what is happening with pset7 and I had some general questions.

  1. How does login_form.php (in views) know where (or send the information to) login.php is (under /public/js). What if i had multiple files called login.php.
  2. ../ means go to parent directory of current directory right. register.php is in JS directory who’s parent is public? Doesn’t it need to go to public’s parent directory to then go into includes. But right now, register.php is (require("../includes/config.php");
  3. After watching a few videos, it seems that a configuration file allows users to change/manipulate variables without using a source file. So it makes it easier for users. So why is config.php a configuration file?

Thanks!

1
  1. According to w3schools.com, the action attribute in the form in your login_form.php, cat be two things:

    • An absolute URL - points to another web site (like action="http://www.example.com/example.htm")
    • A relative URL - points to a file within a web site (like action="example.htm")


    In our case, use a relative URL, and it's relative to your public directory (denoted as /), and since you can't have more than one file with the same name in the same directory, it will search for login.php in your public directory.

  2. register.php should not be in your js directory. As the name js implies, this directory will contain only JavaScript files. All your worker files (register.php, login.php etc.) should be in your public directory, and not one of its sub-folders. So ../ is the pset7 directory and then you can go into includes/config.php.
  3. I don't know exactly where you saw the the config.php lets user change variables, but that would break the encapsulation we use throughout this pset, i.e. letting the user see only what (s)he has to see, and not do with our code as (s)he wishes. Other than that, config.php just requires the constants.php and functions.php so that they are available to your code. (and setting/starting some other things too. You can open the file and check for yourself)

Hope these answer your questions! If you have more post a comment bellow! Till then, Happy Coding! :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .