I would not process a post like this....I would suspect an exploit is opened this way.
Instead just change the $_POST to $_POST['form_elm_name'] where form_elm_name = the value of the forms name attribute.
also do not trust the users input to be harmless. If the expected value of a form is a age, then check that the post only has numbers in it
if it is going to be text only then I usually include a custom function to remove all non-characters from the input. This funct only permits lowercase letters a dash and a space as valid. It alse swaps all spaces for a dash.
We have a in-house channels of Movies. We want to play ads in that channel. The ads can be a:
1) standalone ad
2) A strip (like news headlines in various channels)
3) An L-shaped ad (like shown in some sports channels)
these ads will be in swf/avi/wmv/mp4 etc formats.
In addition, we want to have a scheduler for playing movies(basically a queue)/ads(managed on timely based)/Logo(for the in-house channel i.e an image or an animated image or video format).
How to build a player with these requirements for linux?
I was implementing an image gallery from one of tutorials. In this tutorial PHP opens a directory and loops through it and outputs all image files. I am looking for code solution how to change this loop to output only those images that belongs to particular image album. There should be way to run SQL query and select files and then output them, problem is I have no idea how.
When I upload image I store some data to following table:
CREATE TABLE tbl_image (
im_id INT NOT NULL AUTO_INCREMENT,
im_user_name VARCHAR(25) NOT NULL,
im_album_id INT NOT NULL,
im_title VARCHAR(64) NOT NULL,
im_description TEXT NOT NULL,
im_type VARCHAR(30) NOT NULL,
im_image VARCHAR(60) NOT NULL,
im_date DATETIME NOT NULL,
here is the code piece that should be changed:
/* Configuration Start */
$thumb_directory = 'img/thumbs';
$orig_directory = 'img/original';
$stage_width=600; // How big is the area the images are scattered on
/* Configuration end */
/* Opening the thumbnail directory and looping through all the thumbs: */
$dir_handle = @opendir($thumb_directory) or die("There is an error with your image directory!");
while ($file = readdir($dir_handle))
/* Skipping the system files: */if($file=='.' || $file == '..') continue;
$file_parts = explode('.',$file);
$ext = strtolower(array_pop($file_parts));
/* Using the file name (withouth the extension) as a image title: */
$title = implode('.',$file_parts);
$title = htmlspecialchars($title);
/* If the file extension is allowed: */if(in_array($ext,$allowed_types))
/* Generating random values for the position and rotation: */
$rot = rand(-40,40);
if($top>$stage_height-130 && $left > $stage_width-230)
/* Prevent the images from hiding the drop box */
/* Outputting each image: */
<div id="pic-'.($i++).'" class="pic" style="top:'.$top.'px;left:'.$left.'px;background:url('.$thumb_directory.'/'.$file.') no-repeat 50% 50%; -moz-transform:rotate('.$rot.'deg); -webkit-transform:rotate('.$rot.'deg);">
<a class="fancybox" rel="fncbx" href="'.$orig_directory.'/'.$file.'" target="_blank">'.$title.'</a>
/* Closing the directory */
any thoughts or suggestions are appreciated.