| Current Path : /home/bolconlineco/public_html/admin/ |
| Current File : /home/bolconlineco/public_html/admin/delete_materials.php |
<?php
ob_start();
session_start();
?>
<?php
include('../includes/connection/func.inc.php');
if(isset($_GET['topicId']) && isset($_GET['courseId']))
{
$id = sql_strip($_GET['topicId']);
$cat_id=sql_strip($_GET['courseId']);
$matId=sql_strip($_GET['matId']);
$ccatId=sql_strip($_GET['catId']);
$sql="select path from topicstudy where tSId='$matId'";
$result=mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($result) > 0)
{
$resultSet=mysql_fetch_array($result);
if(file_exists('../StudyMaterials/'.$resultSet['path']))
{
if(unlink('../StudyMaterials/'.$resultSet['path']))
{
$sq="delete from topicstudy where topicId='$id' and courseId='$cat_id' and tSId='$matId'";
$result=mysql_query($sq) or die(mysql_error());
$msg="Deleted Successfully";
header("location:topicstudymat.php?catId=$ccatId&courseId=$cat_id&topicId=$id &msg=$msg");
exit();
}
}
else
{
$sq="delete from topicstudy where topicId='$id' and courseId='$cat_id' and tSId='$matId'";
$result=mysql_query($sq) or die(mysql_error());
$msg="Deleted Successfully";
header("location:topicstudymat.php?catId=$ccatId&courseId=$cat_id&topicId=$id &msg=$msg");
exit();
}
}
}
?>