Website help needed? RE: Images & coding

SkylineObsession

Expert daydreamer
Premium
4,274
New Zealand
New Zealand
SkylineObsession
Mangosaurus
Hey all.

My brother designed the webpage for our Skyline site (link below) and it has a background image that changes to another one every time you refresh the page. It changes at random though, so could stay the same the next time you refresh, or could take a while to see every pic that it can change to.

Still with me?

http://www.southernskylines.com/

Unfortunately he's said that this isn't 'secure' and has dropped it for his next design (launching hopefully when i've taken over the club).

I notice it works fine here on GTP up the top there ^^^, so does anyone know how to get it to work?

He's actually designed the new page in PHP (self taught) even though it looks like a normal page, so is it possible to get in to work on a PHP page?
 
Last edited:
This appears to be the code used for the header.
Code:
<script>
	/* header image rotation */
	var headerCars = ['1','2','3','4','5','6','8','9','10','11','12','13','14','15','16'];
	document.getElementById('page_header_container').style.backgroundImage =
		'url(http://cache.gtpla.net/assets/11/images/cars/' + headerCars[Math.floor(Math.random() * headerCars.length)] + '.jpg)';
</script>
If you can edit it to make it work for you, I don't know.
 
Oh okay, thanks. :)

Showed that to my brother today and he said it appears to only be part of the code?

And was wondering if it would just work in vBulletin or on PHP pages/forums too.

Anyone else familiar with this sort of thing?
 
Oh okay, thanks. :)

Showed that to my brother today and he said it appears to only be part of the code?

And was wondering if it would just work in vBulletin or on PHP pages/forums too.

Anyone else familiar with this sort of thing?

It should work on those as well. Just about anything that will use javascript anyhow. Though I'm not sure how it is exploitable like your brother is claiming, because no user inputs should be involved so it wouldn't be like a SQL injection or such.

See if he can provide the code from the previous setup.

Honestly, I feel if he digs around a bit, a pure CSS solution might exist as well.
 
I haven't actually taken a stab at it, but seems to me a cookie/PHP solution shouldn't be terribly difficult either.
 
TB
This appears to be the code used for the header...
Thanks for reminding me of that admittedly sloppy bit of JavaScript, TB. :P

Anyways, I just had a look at your page template there, Skyline, and it seems that you guys are accomplishing this random image rotation using a JavaScript technique similar to my own. That's the only way I would recommend doing it, and there is no security risk. You can also continue to use that code on a page generated by PHP; it doesn't matter, just include it in the header or footer.

The one thing I would recommend changing is the file types and sizes of those rotating images; they're huge PNG files and take a long time to download. Convert them to JPEGs with reasonable compression instead. 👍
 
Back