Jump to content

PHP Image Checking??


olsrey

Recommended Posts

Hey everyone,
Ive got a very big problem with images in html, this is mainly because of the jpg exploit.

I need to know if there is a way of checking to see if an image really is an image or not.

My site has just got hacked due to this as the user was stealing session id's etc and it was down to the use of code inside an image.

So if anyone can help me with this id be very grateful and so will my friend as he got hacked once down to the same thing a while back but he never found out how to stop it.

Oliver
Link to comment
Share on other sites

right this is how i convert a bbcode image into html

[code]$bericht = preg_replace("!\\[img\\](.*)\\[/img\\]!Usi","<img src=\"\\1\" border=0>",$bericht);[/code]

and this is inside a function which i call when ever i need it soo for example for user profiles i do this

[code]$content = htmlentities(nl2br($profile['message']));
$content = maakOp($content);[/code]

maakOp is the bbcode function.

i need someway of the function checking the image before actually displaying it and if its a "hacker" image id like it to display an image on my server.

if you need anymore info please so ask
Link to comment
Share on other sites

Right ive used the getimagesize function but this just makes pages take a very long time to execute what i really need is a function that searches the image headers or something like that but as you can tell i dont really know what im doing lol
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.