Developing a quick script to remove a file from a directory and the entry from the database ... but the point of the script doesnt really matter , im probably overlooking somthing , im getting a line error on 20 , the error is as follows
Parse error: parse error, unexpected T_IF in /home/user/public_html/delete_gallery_pic.php on line 20
Line 20 is the line that checks for the empty variables $gid and $pid
Thanks for the debugging help ..
<?
include("./admin/config.php");
include("$include_path/common.php");
// CHECK TO MAKE SURE THE USER IS LOGGED IN
check_user_login();
include("$include_path/custom.php");
// ASSIGN THE VARIABLES
$gid = $_REQUEST['gid'];
$pid = $_REQUEST['pid']
// CHECK TO MAKE SURE A VALID REQUEST WAS MADE
if(empty($gid) OR empty($pid)) {
header(' Location: ' . getenv('HTTP_REFERER'));
exit();
} else {
// START THE REMOVAL OF THE PICTURE FROM THE PIX DIRECTORY
$user_name = get_username($id);
$firstchar = substr($user_name, 0, 1);
$firstchar = strtoupper($firstchar);
$dirname = "http://pix.mydomain.com/" . $firstchar . "/" . $user_name . "/" . $gid;
$file = $pid;
$thumb = "tb_" . $pid;
// FIRST , BEFORE WE DELETE ANYTHING , LETS MAKE SURE THE FILE EXIST'S
if(!empty($file)) {
unlink($dirname."/".$file);
unlink($dirname."/".$thumb);
// now we are going to remove the file from the database
mysql_query(" DELETE from `shocc_gallery_photos` WHERE `gallery_id` = '$gid' AND `photo_filename` = '$pid' AND `user_id` = '$id' ") or die(' I cant remove the photo from the database because ' . mysql_error());
}
}
?>