php based avatars...

Discussion of general topics related to the new version and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Forum rules
Discussion of general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
FF8Jake
Registered User
Posts: 31
Joined: Wed Jun 11, 2003 2:43 pm
Location: An arrangement of pixels on your screen.
Contact:

php based avatars...

Post by FF8Jake »

Gah! Area51 doesn't support my dynamic avatar. It says that the width/hieght can't be determined from it, even when specifying it manually. Is a php avy a thing of the past, or just something that hasn't been implemented yet?

And this place looks smooooooth. Very good job on the UCP too! :D

Jaeboy
Registered User
Posts: 100
Joined: Tue Mar 11, 2003 10:47 am
Location: HkG SAR
Contact:

Re: php based avatars...

Post by Jaeboy »

php avatars can been dangerous, especially if one of them attachement bad commands that will affect user's pc :D


Savre my posting level please :cry:
Image

2.2 Rocks!

FF8Jake
Registered User
Posts: 31
Joined: Wed Jun 11, 2003 2:43 pm
Location: An arrangement of pixels on your screen.
Contact:

Re: php based avatars...

Post by FF8Jake »

Ahh, but php based signitures are still being used. Doesn't phpbb check the URL to make sure its an image before allowing people to load it in thier profile? :)

Btw, I gave you a good rating, but how did you get such a bad one? :P

User avatar
psoTFX
Registered User
Posts: 1984
Joined: Tue Jul 03, 2001 8:50 pm
Contact:

Re: php based avatars...

Post by psoTFX »

I've not tried a PHP originated avatar ... it should (in theory) work just like any other avatar assuming it returns data in the expected way. That's based on getimagesize() determining the imagetype rather than assuming the extension determines it (I would hope and expect it to be the former).

If you let me have the url to your image I'll check it out.

Adam Atlas
Registered User
Posts: 66
Joined: Fri May 09, 2003 4:31 pm
Contact:

Re: php based avatars...

Post by Adam Atlas »

I don't see how the server could possibly avoid PHP-based images, maybe there's just an incompatibility in how gdlib outputs these things.
Jaeboy wrote:php avatars can been dangerous, especially if one of them attachement bad commands that will affect user's pc
If an avatar is generated dynamically, it is processed on the server on which it's stored, and sent to the client as image data, which in terms of format is indistinguisable from a statically stored image of the same format. PHP code from dynamic avatars/sigs are never sent to the client side, let alone executed there.
fun, sigs work!!!

FF8Jake
Registered User
Posts: 31
Joined: Wed Jun 11, 2003 2:43 pm
Location: An arrangement of pixels on your screen.
Contact:

Re: php based avatars...

Post by FF8Jake »

psoTFX wrote:I've not tried a PHP originated avatar ... it should (in theory) work just like any other avatar assuming it returns data in the expected way. That's based on getimagesize() determining the imagetype rather than assuming the extension determines it (I would hope and expect it to be the former).

If you let me have the url to your image I'll check it out.
http://www.skippercc.com/rand_avy/rand_avy.php is the link to the random avy. Here is it's code also:

Code: Select all

<?php
$online = @fsockopen("X.X.X.X", 80, $errno, $errstr, 30);

if( ! $online )
{
  $avatar = "11.png";
}
else
{
  // online avatar selection
  $avatars[] = '1.png';
  $avatars[] = '2.png';
  $avatars[] = '3.png';
  $avatars[] = '4.png';
  $avatars[] = '5.png';
  $avatars[] = '6.png';
  $avatars[] = '7.png';
  $avatars[] = '8.png';
  $avatars[] = '9.png';
  $avatars[] = '10.png';

  srand ((float) microtime() * 10000000);
  $random_key = array_rand( $avatars );
  $avatar = $avatars[$random_key];
}
header('HTTP/1.0 302');
header('HTTP/1.1 307');
header('Location: http://'" target="_blank .$_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/' . $avatar);

?>
It says its unable to get a specified size from it, even when I enter 64x64 in my profile. Hope that helps. :)

Edited by psoTFX to remove IP

User avatar
psoTFX
Registered User
Posts: 1984
Joined: Tue Jul 03, 2001 8:50 pm
Contact:

Re: php based avatars...

Post by psoTFX »

That's really not a good way of doing this ... and it's no surprise it won't work. You don't need nor should you redirect to the image. Just use passthru(); to send the image data straight to the browser after sending an appropriate content-type header (image/png in this case).

FF8Jake
Registered User
Posts: 31
Joined: Wed Jun 11, 2003 2:43 pm
Location: An arrangement of pixels on your screen.
Contact:

Re: php based avatars...

Post by FF8Jake »

Ahh okay. I'll look into that function, thanks. :)

Board looks great!

Adam Atlas
Registered User
Posts: 66
Joined: Fri May 09, 2003 4:31 pm
Contact:

Re: php based avatars...

Post by Adam Atlas »

psoTFX wrote:Just use passthru(); to send the image data straight to the browser after sending an appropriate content-type header (image/png in this case).
FF8Jake wrote:Ahh okay. I'll look into that function, thanks. :)
Actually, I think it would make more sense to use readfile(); instead of passthru();
fun, sigs work!!!

FF8Jake
Registered User
Posts: 31
Joined: Wed Jun 11, 2003 2:43 pm
Location: An arrangement of pixels on your screen.
Contact:

Re: php based avatars...

Post by FF8Jake »

@Adam: Readfile worked great! The reason a redirect was used, was so the browser could cache the avy and save on bandwidth, but as small as my avy is it should work fine. Thanks!

Post Reply