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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Sep 2003
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    webmail redirection

    I am attempting to write a simple logon page, consisting of a form containing to input field, email address, and password.
    The script then needs to redirect, and login the user depending on the email address.
    If the email address is someuser@company.com.au, the script needs to send the variables $username and $password to "webmail.company.com.au", but if the domain is anything else the script needs to go to "webmail.$domain" with variables $user and $pass. these all need to go through with the post method.
    these are the steps I have so far...

    1. User inputs data
    2. script processes data, explodes $email
    3. if $email[1] == company.com.au
    $username=$email[0];
    $password=$password;
    else
    $user=$email[0];
    $pass=$password;
    4. Redirect to appropriate page.

    I'm stuck at 4...
    how would i post to another page without user interaction (using the superglobals method).

    If anyone can help I'd greatly appreciate it. hope this isn't to murky a description.

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Welcome here.

    I don't think you can. Well, you could send a form with a javascripts Onload or something, buth thats a bit of a hack.
    Why does it needs to be posted ?

    You could use
    $url = "http://www.rigthdomain.com/page2.php?user=" . $user . "&pwd=" . $pass
    header("Location: $url");

    Then in page2.php you do your stuff (you can get the values with $_GET['user'] ) and depending on the results of your validation or whatever, you redirect the user again
    $url = "http://www.rigthdomain.com/page3.php"
    header("Location: $url");

  • #3
    New to the CF scene
    Join Date
    Sep 2003
    Location
    North Yorkshire, England
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can construct POST requests within a PHP script with CURL if you want to avoid sending user name and password variables in a GET request. This way you can evaluate the submitted email address and then POST to the relevant address. Here's a really good tutorial on CURL:

    http://www.phpfreaks.com/tutorials/49/1.php (note that the emphasis is on merchant transactions but it still shows you how CURL works)

    More here:

    http://uk.php.net/curl

  • #4
    New to the CF scene
    Join Date
    Sep 2003
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In reply to the first question, I need to post to the receiving scripts, as I cannot make changes to them. Using Header Location redirects was what I was first going to do, but I am still left with the dilemma of how to post the variables through.

    I am currently looking at the CURL Tutorial, and I think this is the way I am going to go. It appears that I can do exactly what I need to do with CURL.

    Thanks to you both for replying & helping!!


  •  

    Posting Permissions

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