I tried to login curl using this code
PHP Code:
$urlroot = 'http://robert.deveon/forum/login.php';
$vbulletin1 = array(
'vb_login_username' => 'mirek2',
'vb_login_password'=> '123qwe',
's' => '',
'securitytoken' => 'guest',
'do'=> 'login',
'cookieuser' => '1',
'vb_login_md5password' => md5('123qwe'),
'vb_login_md5password_utf' => md5('123qwe')
);
$this->do_vbulletin_login($urlroot, $vbulletin1);
where
PHP Code:
function do_vbulletin_login($url, $post) {
$curl=curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12');
curl_setopt($curl, CURLOPT_COOKIEFILE, dirname(__FILE__) . '/cookies.txt');
curl_setopt($curl, CURLOPT_COOKIEJAR, dirname(__FILE__) . '/cookies.txt');
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_HEADER, 0);
//if(strlen($post)>0){
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
//}
$strona=curl_exec($curl);
echo $strona;
curl_close($curl);
die();
}
mirek2 is a login and 123qwe a password. I get a message "wrong login and/or password".
What do I do wrong?
--------------- Added [DATE]1290511593[/DATE] at [TIME]1290511593[/TIME] ---------------
and this is a standard form
PHP Code:
<form action="login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">
<input type="hidden" name="do" value="login" />
<input type="hidden" name="url" value="/forum/newreply.php?do=newreply&noquote=1&p=3" />
<input type="hidden" name="vb_login_md5password" />
<input type="hidden" name="vb_login_md5password_utf" />
<input type="hidden" name="s" value="" />
<input type="hidden" name="securitytoken" value="guest" />
<!-- permission error message - user not logged in -->
<div class="smallfont">Nie jesteś zalogowany lub nie masz dostępu do tej strony. Prawdopodobne powody to:</div>
<ol>
<li class="smallfont">Nie jesteś zalogowany.</li>
<li class="smallfont">Nie masz wystarczających uprawnień aby otworzyć stronę.</li>
<li class="smallfont">Twoje konto czeka na aktywację lub zostało wyłączone przez administratora forum.</li>
</ol>
<fieldset class="fieldset">
<legend>Zaloguj się</legend>
<table cellpadding="0" cellspacing="3" border="0" align="center">
<tr>
<td>Nazwa użytkownika:<br /><input type="text" class="bginput" name="vb_login_username" size="50" accesskey="u" tabindex="1" /></td>
</tr>
<tr>
<td>Hasło:<br /><input type="password" class="bginput" name="vb_login_password" size="50" tabindex="1" /></td>
</tr>
<tr>
<td>
<span style="float:right"><a href="login.php?do=lostpw">Zapomniałeś hasła?</a></span>
<label for="cb_cookieuser"><input type="checkbox" name="cookieuser" value="1" id="cb_cookieuser" tabindex="1" />Zapamiętaj mnie</label>
</td>
</tr>
<tr>
<td align="right">
<input type="submit" class="button" value="Zaloguj się" accesskey="s" tabindex="1" />
<input type="reset" class="button" value="Wyczyść" accesskey="r" tabindex="1" />
</td>
</tr>
</table>
</fieldset>
<div class="smallfont">Aby przeglądać to forum musisz się najpierw <a href="register.php?do=signup">ZAREJESTROWAĆ</a>.</div>
</form>