one login form, many mail servers

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shortcut
Forum Newbie
Posts: 4
Joined: Tue Jun 28, 2005 8:03 am

one login form, many mail servers

Post by shortcut »

Hi.

I'm new to the PHP world and wonder if it is possible to create a login page where users can log in to different mail servers by choosing it in drop down list. The form will have a username field, a password field and a set of 4 mail servers in a drop down list.So, if I introduce sacur, ***** and pick yahoo in the list, I'm supposed to be legged in to my yahoo account.
Does anybody has an idea of how to do it if it is possible at all.
Thanks in advance

sacur
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post by foobar »

You'll need to figure out how the form on the mail provider's login page works. Check the source-code to see where the form gets posted to, and what the fields (usually ID and password) are called. Then, have a page with a drop-down with the webmail sites of your choice. When the user selects an option and clicks the submit button, that form gets submitted to a php page which generates an appropriate form and auto-submits it to the webmail login page.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

http://www.php.net/curl will help you submit form data (unless you're just fowarding them to their account at yahoo), but I assume they will read their email from your site?


It might just be easier to write a pop3 client in that case.
shortcut
Forum Newbie
Posts: 4
Joined: Tue Jun 28, 2005 8:03 am

Post by shortcut »

Thanks everybody.

I already had seen the source code of the target pages. I sent the form information to a php script that generates the appropriate form and autosubmits it.It worked, but I found another way out using javascript function that is called onSubmit. The function determines the action and the names of the login and password fields after reading the selected server in a drop down menu.It also worked.

Cool
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

well what happens if the user disables javascript? gotta think about them! just on the page that it submits to run a switch statment

Code: Select all

switch ($_POST['mail_server'])
{
  case "Google":
    //use curl or whatever to login to google
    break;
  case "Yahoo":
    //use curl or whatever to login to yahoo
    break;
}
Post Reply