| Current Path : /home/bolconlineco/www/aaaaaa/admin/ |
| Current File : /home/bolconlineco/www/aaaaaa/admin/add_suport.php |
<?php
include('../includes/connection/func.inc.php');
if(isset($_POST['submit']))
{
$title = sql_strip($_POST['title']);
/* $categoryorder=sql_strip($_POST['categoryorder']);
$sql1="select max(CategoryOrder) as maxs from category";
$result11=mysql_query($sql1) or die(mysql_error());
$row=mysql_fetch_array($result11);
$next=$row['maxs'];
$next=$next+1;
$categoryorder = !empty(sql_strip($_POST['categoryorder']))? sql_strip($_POST['categoryorder']):$next;
*/
$matname = $_FILES['mat']['name'];
$tmpname = $_FILES['mat']['tmp_name'];
$CStatus = sql_strip($_POST['CStatus']);
$allowed = array('doc','docx','pdf');
$types = explode('.',$matname);
$type = $types[1];
$full=rand().$matname;
if(in_array(strtolower($type),$allowed))
{
if(move_uploaded_file($tmpname,'../sportmaterials/'.$full))
{
$sql="insert into sportmaterials values ('','$full','$title','$CStatus')";
$result=query($sql);
if($result)
{
$msg = "Inserted Successfully";
header("location:suportmaterials.php?msg=$msg");
exit();
}else
{
$msg = "Can't Inserted due to some Errors";
header("location:suportmaterials.php?msg=$msg");
exit();
}
}
}
else
{
$msg = "Select a valid type";
header("location:suportmaterials.php?msg=$msg");
exit();
}
}
?>