Hello Everyone i need your help in making this code

kindly help

<img src="http://i45.expamle.com/35i4o5t.gif">

i want this image to load in a page by calling it like

http://www.example.com/tp.php?code=35i4o5t.gif

but the problem making area is that the server information changes on every image can someone make it for me ......

<img src="http://[php code for this].expamle.com/[and here]">

Thanks In Advance:)

Do you mean like this?

<?php
$variable='i45';
echo '<img src="http://'.$variable.'.expamle.com/'.urlencode($_GET['code']).'">';
?>

No i mean like this ...

<img src="http://<?php echo $_GET['code']; ?>.example.com/<?php echo $_GET['id']; ?>">

Any Other suggestions

If your going to do that then I would suggest the following:

<img src="http://<?php echo urlencode($_GET['code']); ?>.example.com/<?php echo urlencode($_GET['id']); ?>">

That will stop xss attacks.

Can you please tell me whats type of attacks they are

Can you please tell me whats type of attacks they are

Basically xss attacks are when a user tries to inject code into a webpage. For example, the following is an xss attack.

URL=http://example.com/index.php?code="><script>alert("xss attack");</script>&id=1

<img src="http://<?php echo $_GET['code']; ?>.example.com/<?php echo $_GET['id']; ?>">

As you can see they put html code into the url and it made that html code appear into the webpage. This can cause security problems which is why url data should always be filtered.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.