#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    120
    Rep Power
    2

    Transfer login info to another page


    I'm trying to figure out how to transfer the username and password entered into a form on the home page and when clicking submit, transferring the username and password to the login page and have it send automatically. Pretty much I want to have it setup this way because when I submit the form on the home page, its in a drop down menu and the page refreshes and if there is an error, the error shows up in the header and not in the drop down so I want it so if the login is successful it just goes through the login page to the account page and if there is errors then the errors of the login shows up on the login page because the login page has the form directly on the page instead of in a drop down in the header.
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Hi,

    I can barely understand you, becauseyouarejustwritingdownwordswithoutanyperiodsandcommas.

    OK, so you have a login page and an account page. And there's a small login form somewhere on the home page. Right?

    Now you want to send the data from the small login form to the login page and have the login page automatically submit it. Why? If the login page processes the data, why don't you simply use that page as the target of the small login form? The login page will treat this exactly like a submission from its own form. If the login is successful, you'll be redirected to the account page. Otherwise, you'll see the login page with the errors.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    120
    Rep Power
    2
    Ya thats wht id like to do is have the login form on the login page be the target. So when entering the username and password in the login for
    On the home page and then clicking submit, have the username and password be retrieved from the login form on the login page and have it pass the variables without pressing submit on the form of the login page. Im not sure how to have the variables posted from the form on the home page post through the form on the login page. Its hard to explain but a good example is on siteground.com. They have a login dropdown and if there is an error either in the username or password, your automatically directed to their login page where the login form is on the page instead of in the dropdown and the errors are shown on the login page.
    Last edited by andy1212; October 5th, 2013 at 06:29 PM.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    120
    Rep Power
    2
    Im not looking for code or anything just the logic behind how the form will work
  8. #5
  9. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    I repeat: All you have to do is put the URL of the login page into the action parameter of the small login form. This will have the same effect as submitting the data from the big form of the login page itself.

    The login page contains the authentication logic, right? Then simply have the small login form post to that page. The login page will take care of the rest.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    120
    Rep Power
    2
    Ok thanks!
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    120
    Rep Power
    2
    Ok so it isn't working. Should this method still work even if the login page is in another folder that is https encrypted and the home page is in the public_html folder?
  14. #8
  15. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Originally Posted by andy1212
    Ok so it isn't working.
    That doesn't tell us anything. And you should know that after more than 100 posts.

    What is the problem? If you want us to help you, then you need to tell us exactly what's going on. Remember that we're normal people just like you. We cannot read your mind, and we can't access your server through telekinesis. All we know about the problem is what you've told us -- and that's zero right now.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    120
    Rep Power
    2
    Sorry, I do really appreciate your help and I apologize for being vague. Ok so when I don't enter a username or password into the form on the home page that's in a drop down, and click submit, the form directs to the login page but no errors show up. When I enter in a correct username or password on the form on the home page, I'm sent to the login page but the username and password had no effect on the form on the login page.

    The login page is in it's own folder, here is the setup,

    public_html

    header.php (included in the login and index pages)
    index.php

    secure

    login.php

    So the login page is in it's own folder and is encrypted with SSL. I'm not sure if that is what's effecting what I'm trying to do but could possibly have something to do with it.

    So I also have a search form in the header as well in a drop down menu, and when I enter something into the keywords input field and submit, it sends the data to the search.php page and the data actually gets processed in the form. and the search.php page is also in the public_html folder of the server.
  18. #10
  19. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    The question is: Which script processes the login data? You must have one script which takes the username and password through a POST request and then decidedes what to do.

    You know, something like this:

    PHP Code:
    <?php

    if ( isset($_POST['username'], $_POST['password']) ) {

        
    // look up credentials in database etc.

    }
    Which script does that? Your login.php? Or some other script?
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".

IMN logo majestic logo threadwatch logo seochat tools logo