Search code examples
phpattachmentvbulletin

download attachment file in vbulletin for unregistered user


I have a side script in my forums that allows to my users to upload some stuff from my forums.

I wanted to allow my users to upload attachment file from the forums, but vbulletin always show unregistered form.

So i'm asking is there a way that i can send username and password with attachment link, so vbulletin can identity my user and allow to download that attachment file?

I tried this:

$link = 'http://localhost/vb/attachment.php?attachmentid=2';
$username = 'admin';
$password = '1111';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $link);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
echo '<pre>';
print_r($info);
print_r($output);

But as i said, unregistered form show up!


Solution

  • I found a solution for my problem. since both of my script are in one host, i used copy to copy my attachment file across my host. By this way i don't need to deal with vbulletin.