I am trying to create a website.The website will have so many gifs/pics and so I have to create php/html file just for showing a gif/pic.So I just have to create so many php/html file or there is any short way.
For ex. I create gif.html and gif1.html , gif10000.html,takes so many times.Thought maybe there is a short way ?
Pass an element to display in GET
parameter, for example:
show_picture.php?file=gif10000.gif
and in PHP
retrieve it by $_GET['file']
(make sure you sanitize the input first).
Here is full PHP:
<?php
$allowedImages = array(
'gif10000.gif',
'gif2.gif' //etc
);
$file = $_GET['file'];
if (in_array($file, $allowedImages)) {
echo '<img src="'.$file.'" />';
}
?>