Hi,
I'm trying to login with my php page to 1 forum vbulletin 4.2.
I use that code:
But it won't work. What do I write wrong?
Thanks
I'm trying to login with my php page to 1 forum vbulletin 4.2.
I use that code:
PHP:
function vBulletinLogin($user, $pass) {
$md5Pass = md5($pass);
$data = "?do=login&url=%2Findex.php&securitytoken=guest&vb_login_md5password=$md5Pass&vb_login_md5password_utf=$md5Pass&vb_login_username=$user&cookieuser=1";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.domain.com/forums/login.php");
curl_setopt($ch, CURLOPT_REFERER, 'http://www.domain.comt/forums/index.php');
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_TIMEOUT, '40');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_COOKIEJAR, "temp/codecall_$user.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "temp/codecall_$user.txt");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
curl_close($ch);
//echo $store;
$pos = strpos($store, "Thank you for Logging in");
if ($pos === FALSE) {
return 0;
} else {
return 1;
}
}
if (vBulletinLogin("username","password")) {
echo "Logged In";
} else {
echo "Failed to Login check User / Pass";
}
But it won't work. What do I write wrong?
Thanks