Status
Not open for further replies.

skinner

Active Member
739
2010
59
5,220
Hi,

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
 
11 comments
Is this your own code?
What I do when faceing such task is to go to the site, and do a login while logging everything sent and received by the browser with Firebug or Chrome's developer tools, then I recreate that stuff with curl.
 
if that forum host enable php curl then you can't login
the php curl must be disable then you can use your curl script
 
hi, i just found this post and your code is interesting as i am trying to do something similar. My guess is that its not working because you don't provide salted password. VB stores password in md5 with salt.
 
hi, i just found this post and your code is interesting as i am trying to do something similar. My guess is that its not working because you don't provide salted password. VB stores password in md5 with salt.

My problem was that forum was not in english so I had to change some variables..
 
maybe missing the GET do=login?

curl_setopt($ch, CURLOPT_URL, "http://www.domain.com/forums/login.php?do=login");
 
Status
Not open for further replies.
Back
Top