[development] Minimum required for a login

Alexandru Badiu alex at 417.ro
Fri Jul 21 11:52:59 UTC 2006

I used curl (but you could use snoopy or the built in php functions) to 
login a user and create nodes programatically. Maybe it helps:

$crl = curl_init();
curl_setopt($crl, CURLOPT_URL, "http://www.site.ro/user/login");
curl_setopt($crl, CURLOPT_COOKIEFILE, "/tmp/cookie.txt");
curl_setopt($crl, CURLOPT_COOKIEJAR, "/tmp/cookie.txt");
curl_setopt($crl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($crl, CURLOPT_POST, 1);
$postdata=array("edit[name]"=>"user", "edit[pass]"=>"pass",
        "edit[form_id]"=>"user_login", "op"=>"Log in");
curl_setopt ($crl, CURLOPT_POSTFIELDS, $postdata);

Alexandru Badiu

Chris Puzio wrote:

> I need to be able to manually force a login without using the login 
> subsystem. I was wondering if anyone knew the minimum needed to 
> consider a user 'logged in'. It looked to me that setting the $user 
> variable was key but I wasn't sure what else was necessary - and if 
> its possible to do outside of the framework just by setting certain 
> variables.
> Chris Puzio

More information about the development mailing list