Forum Moderators: coopster
i use a script like this
<?
#gather login information
$string = "\n".$user.":".md5($pass)."\n";
if(eregi($string,$logins)){
header("Location:http://username:password@www.example.com/");
} else {
$error = "invalid login";
}
#yada yada yada
?>
this works for firefox, but not for IE
in firefox, it also displays a box saying "you are about to login in to 'example.com' under the name 'username'" or something to that effect and asks if they would like to proceed.
i don't want them knowing the username, so this is a downside
is there a way to login to a website for a user without them seeing the login information and that will work in all major browsers?
session_start()
if(!isset($_SESSION["user"]))
{
//gather login info
//authenticate (I would use sql to store the user and md5, not file)
if($authentic) $_SESSION["user"] = $user;
else {}//do the login again
}
if($user = $_SESSION["user"])
{
//your code
}
you need to have session_start() at the beginning of a page. If the will be some page without it, the session will disappear.
best regards
Michal Cibor
i know about sessions, but sessions only log you into your own site.
i need to have a login to a remote site.
firefox supports doing this as so
[USERNAME:PASSWORD@website.com...]
i need another way to login to an external page as this doesn't work in IE and also i don't want it to display a dialog box.
i guess i wasn't clear enough, but thanks for trying though
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERPWD, "[USERNAME]:[PASSWORD]");
curl_setopt($ch, CURLOPT_URL, "http://www.example.com");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
?>
but it didn't work, instead it echoed the 404 page of example.com.
any ideas?
[curl.haxx.se...]