Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Dec 2008
    Posts
    15
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Submitting Parameters via URL

    Okay, so I know how to pass in parameters to the URL for instance at http://oit.nyls.edu/digitalcommons I can use http://oit.nyls.edu/digitalcommons/i...sword=password. But I am wondering in this case how do I get it to automatically submit those parameters via the URL. Like i want it to automatically login the user in based on their credentials without showing them that actual screen.

    Any help would be appreciate as I have been stuck for a while.

  • #2
    Regular Coder kokjj87's Avatar
    Join Date
    Sep 2008
    Location
    Singapore
    Posts
    279
    Thanks
    1
    Thanked 55 Times in 54 Posts
    Do you mean not showing the credentials on the url?

    If it is.....

    You need to use POST and it will not show up in the url

    Html
    Code:
    <form method="post" action="action.php">
    <!-- form content -->
    Username:
    <input type="text" name="username"/>
    Password:
    <input type="password" name="password"/>
    <input type="submit" name="Login"/>
    </form>
    php page:
    PHP Code:
    <?php
    echo $_POST['username'];
    echo 
    $_POST['password'];
    ?>

  • #3
    New Coder
    Join Date
    Dec 2008
    Posts
    15
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Not exactly. I have it so that it throws the username and the password in the form. For instance if I type in http://oit.nyls.edu/digitalcommons/i...sword=password it throws username under the field Username and password under the field "Password". it doesnt perform the action and submit the form.

  • #4
    New Coder
    Join Date
    Dec 2008
    Posts
    15
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I just want it to submit the form automatically after I pass in the username and password from the URL

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    You'll want to use cookies for this instead.
    Then you need to alter you're authentication handling to check for the existance of the cookies, validate them, and automatically log the user in. There is no way in PHP to force a submit from a browser.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #6
    New Coder
    Join Date
    May 2006
    Posts
    81
    Thanks
    0
    Thanked 11 Times in 11 Posts
    If you are a URL that you are creating with the username/password in it, why send it to the login form. You could simply send it to the form that the login sends its data to and have it read the data from the URL. This is not as secure because you are passing the password in the URL, but depending on what you are doing it may work.

    You may just need to change our form proccessing so as not to check for a posted form, because it wont have been posted. You could instead check to see if both username and password have a value.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •