load->helper('url');
$this->load->database();
$this->load->library('session');
@session_start();
$this->load->model('index_model');
$user = $this->session->userdata('validated');
if(empty($user)) {
redirect(base_url().'index.php/index/login');
}
$userid = $this->session->userdata('uid');
// if($userid!=1){
// redirect('http://192.168.200.160/alert/superviser/admin.php/index/dashboard');
// }
/*$user_type=$this->session->userdata('user_type');
if($user_type!='P'){
redirect(base_url().'admin.php/index/index');
}*/
//$this->load->view('common/header');
}
public function update_password(){
// $this->db->where('uid',$user = $this->session->userdata('uid'));
// $this->db->where('password',sha1($_REQUEST['oldpass']));
// $query = $this->db->get('user');
// if($query->num_rows == 1){
$data = array('password' => sha1($_REQUEST['newpas']));
$this->db->where('srno', $this->session->userdata('uid'));
//$this->db->where('password', sha1($_REQUEST['oldpass']));
if($this->db->update('users', $data)){
$_SESSION['pass_succ']=1;
}else{
$_SESSION['pass_err']=1;
}
// }else{
// $_SESSION['pass_error']=1;
// }
$this->changepassword();
}
function addform(){
$this->load->view('header');
$this->load->view('addform');
}
public function insertform()
{
$a=$this->input->post('hdnTextboxrestra1');
$a=$a-1;
for($i=1;$i<=$a;$i++){
if($_FILES['forms_'.$i]['name']!='')
{
$target_path="uploads/";
$target_path=$target_path.rand().time().basename($_FILES['forms_'.$i]['name']);
move_uploaded_file($_FILES['forms_'.$i]['tmp_name'],$target_path);
$data = array (
'typ' => $_REQUEST['typ'],
'subtyp' => 'Forms & Documents',
'files' => $target_path,
'name' => $_REQUEST['formsnm_'.$i],
);
$this->db->insert('form', $data);
}
}
$a=$this->input->post('hdnTextboxrestra2zz');
$a=$a-1;
for($i=1;$i<=$a;$i++){
if($_FILES['publiczz_'.$i]['name']!='')
{
$target_path="uploads/";
$target_path=$target_path.rand().time().basename($_FILES['publiczz_'.$i]['name']);
move_uploaded_file($_FILES['publiczz_'.$i]['tmp_name'],$target_path);
$data = array (
'typ' => $_REQUEST['typ'],
'subtyp' => 'ORDER COPY',
'files' => $target_path,
'name' => $_REQUEST['publicnmzz_'.$i],
);
$this->db->insert('form', $data);
}
}
$a=$this->input->post('hdnTextboxrestra2');
$a=$a-1;
for($i=1;$i<=$a;$i++){
if($_FILES['public_'.$i]['name']!='')
{
$target_path="uploads/";
$target_path=$target_path.rand().time().basename($_FILES['public_'.$i]['name']);
move_uploaded_file($_FILES['public_'.$i]['tmp_name'],$target_path);
$data = array (
'typ' => $_REQUEST['typ'],
'subtyp' => 'PUBLIC ANNOUNCEMENT',
'files' => $target_path,
'name' => $_REQUEST['publicnm_'.$i],
);
$this->db->insert('form', $data);
}
}
$a=$this->input->post('hdnTextboxrestra3');
$a=$a-1;
for($i=1;$i<=$a;$i++){
if($_FILES['creditors_'.$i]['name']!='')
{
$target_path="uploads/";
$target_path=$target_path.rand().time().basename($_FILES['creditors_'.$i]['name']);
move_uploaded_file($_FILES['creditors_'.$i]['tmp_name'],$target_path);
$data = array (
'typ' => $_REQUEST['typ'],
'subtyp' => 'CREDITORS LIST',
'files' => $target_path,
'name' => $_REQUEST['creditorsnm_'.$i],
);
$this->db->insert('form', $data);
}
}
$a=$this->input->post('hdnTextboxrestra4');
$a=$a-1;
for($i=1;$i<=$a;$i++){
if($_FILES['eoi_'.$i]['name']!='')
{
$target_path="uploads/";
$target_path=$target_path.rand().time().basename($_FILES['eoi_'.$i]['name']);
move_uploaded_file($_FILES['eoi_'.$i]['tmp_name'],$target_path);
$data = array (
'typ' => $_REQUEST['typ'],
'subtyp' => 'EOI',
'files' => $target_path,
'name' => $_REQUEST['eoinm_'.$i],
);
$this->db->insert('form', $data);
}
}
$this->load->view('header');
$this->load->view('success');
}
function editform($id){
$data['myinfo']=$this->index_model->editform($id);
$this->load->view('header');
$this->load->view('editform',$data);
}
public function updateform($id)
{
if($_FILES['forms']['name']!='')
{
$target_path="uploads/";
$target_path=$target_path.rand().time().basename($_FILES['forms']['name']);
move_uploaded_file($_FILES['forms']['tmp_name'],$target_path);
$data = array (
'files' => $target_path,
);
$this->db->where('id',$id);
$this->db->update('form', $data);
}
$data = array (
'name' => $_REQUEST['formsnm'],
);
$this->db->where('id',$id);
$this->db->update('form', $data);
$this->load->view('header');
$this->load->view('success');
}
public function updateUserChangePassword($id)
{
$data = array (
'password' => sha1($_REQUEST['pass']),
);
$this->db->where('srno',$id);
$this->load->view('header');
if($this->db->update('users', $data))
$this->load->view('success');
else
$this->load->view('error');
}
public function manageform(){
$data['myinfo']=$this->index_model->manageform();
$this->load->view('header');
$this->load->view('manageform',$data);
}
public function deleteform($id){
$this->db->where('id', $id);
$this->db->delete('form');
// $data['myinfo']=$this->index_model->manageform();
// $this->load->view('header');
// $this->load->view('manageform',$data);
?>
load->view('header');
$this->load->view('dashboard');
}
function dashboard(){
$this->load->view('header');
$this->load->view('dashboard');
}
function logout(){
$this->session->sess_destroy();
redirect(base_url());
}
function changepassword(){
$this->load->view('header');
$this->load->view('changepassword');
}
function britishdate($vardt){
$datess = date_create($vardt);
return $dtsdhfj=date_format($datess, 'd/m/Y');
}
function addSlider(){
$this->load->view('header');
$this->load->view('addSlider');
}
public function insertSlider()
{
$user = $this->session->userdata('uid');
if($_FILES['pic']['name']!='')
{
$target_path="uploads/slider/";
$target_path=$target_path.basename($_FILES['pic']['name']);
move_uploaded_file($_FILES['pic']['tmp_name'],$target_path);
}
else {
$target_path=""; }
$data = array (
'gal_ttl' => $_REQUEST['pgnm'],
'gal_link' => $_REQUEST['lnk'],
'gal_descr' => $_REQUEST['cont'],
'gal_img' => $target_path,
);
$this->load->view('header');
if($this->db->insert('slider', $data))
{
$this->load->view('success');
}
else
$this->load->view('error');
}
public function manageSlider(){
$data['myinfo']=$this->index_model->manageSlider();
$this->load->view('header');
$this->load->view('manageSlider',$data);
}
public function deleteSlider($id){
$this->db->where('gal_id', $id);
$this->db->delete('slider');
$data['myinfo']=$this->index_model->manageSlider();
$this->load->view('header');
$this->load->view('manageSlider',$data);
}
function editSlider($id){
$data['myinfo']=$this->index_model->editSlider($id);
$this->load->view('header');
$this->load->view('editSlider',$data);
}
public function updateSlider($id)
{
if($_FILES['pic']['name']!='')
{
$target_path="uploads/slider/";
$target_path=$target_path.basename($_FILES['pic']['name']);
move_uploaded_file($_FILES['pic']['tmp_name'],$target_path);
}
else {
$target_path=""; }
if( $target_path==''){
$data = array (
'gal_ttl' => $_REQUEST['pgnm'],
'gal_link' => $_REQUEST['lnk'],
'gal_descr' => $_REQUEST['cont'],
);
} else {
$data = array (
'gal_ttl' => $_REQUEST['pgnm'],
'gal_link' => $_REQUEST['lnk'],
'gal_descr' => $_REQUEST['cont'],
'gal_img' => $target_path,
);
}
$this->db->where('gal_id',$id);
$this->load->view('header');
if($this->db->update('slider', $data))
$this->load->view('success');
else
$this->load->view('error');
}
function addCategory(){
$this->load->view('header');
$this->load->view('addCategory');
}
public function insertCategory()
{
$user = $this->session->userdata('uid');
$data = array (
'cat_nm' => $_REQUEST['cat_nm'],
//'cat_tag' => $_REQUEST['cat_tag'],
);
$this->load->view('header');
if($this->db->insert('category', $data))
{
$this->load->view('success');
}
else
$this->load->view('error');
}
public function manageCategory(){
$data['myinfo']=$this->index_model->manageCategory();
$this->load->view('header');
$this->load->view('manageCategory',$data);
}
public function deleteCategory($id){
$user = $this->session->userdata('uid');
$this->db->where('cat_id', $id);
$this->db->delete('category');
$data['myinfo']=$this->index_model->manageCategory();
$this->load->view('header');
$this->load->view('manageCategory',$data);
}
public function deletecomm($id){
$user = $this->session->userdata('uid');
$this->db->where('commid', $id);
$this->db->delete('commentpost');
?>
0,
);
} else {
$data = array (
'sts' => 1,
);
}
$this->db->where('commid', $id);
$this->db->update('commentpost',$data);
?>
index_model->editCategory($id);
$this->load->view('header');
$this->load->view('editCategory',$data);
}
public function updateCategory($id)
{
$user = $this->session->userdata('uid');
$data = array (
'cat_nm' => $_REQUEST['cat_nm'],
//'cat_tag' => $_REQUEST['cat_tag'],
);
$this->db->where('cat_id',$id);
$this->load->view('header');
if($this->db->update('category', $data))
$this->load->view('success');
else
$this->load->view('error');
}
function addsubCategory(){
$this->load->view('header');
$this->load->view('addsubCategory');
}
public function insertsubCategory()
{
$user = $this->session->userdata('uid');
$data = array (
'subcat_catid' => $_REQUEST['subcat_catid'],
'subcat_nm' => $_REQUEST['subcat_nm'],
);
$this->load->view('header');
if($this->db->insert('subcategory', $data))
{
$this->load->view('success');
}
else
$this->load->view('error');
}
public function managesubCategory(){
$data['myinfo']=$this->index_model->managesubCategory();
$this->load->view('header');
$this->load->view('managesubCategory',$data);
}
public function deletesubCategory($id){
$user = $this->session->userdata('uid');
$this->db->where('subcat_id', $id);
$this->db->delete('subcategory');
$data['myinfo']=$this->index_model->managesubCategory();
$this->load->view('header');
$this->load->view('managesubCategory',$data);
}
function editsubCategory($id){
$data['myinfo']=$this->index_model->editsubCategory($id);
$this->load->view('header');
$this->load->view('editsubCategory',$data);
}
public function updatesubCategory($id)
{
$user = $this->session->userdata('uid');
$data = array (
'subcat_catid' => $_REQUEST['subcat_catid'],
'subcat_nm' => $_REQUEST['subcat_nm'],
);
$this->db->where('subcat_id',$id);
$this->load->view('header');
if($this->db->update('subcategory', $data))
$this->load->view('success');
else
$this->load->view('error');
}
function addProducts(){
$this->load->view('header');
$this->load->view('addProducts');
}
public function insertProducts()
{
$user = $this->session->userdata('uid');
$dt = date('Y-m-d');
if($_FILES['pic']['name']!='')
{
$target_path="uploads/products/";
$target_path=$target_path.rand().time().basename($_FILES['pic']['name']);
move_uploaded_file($_FILES['pic']['tmp_name'],$target_path);
}
else {
$target_path=""; }
if($_FILES['vid']['name']!='')
{
$target_pathvid="uploads/products/";
$target_pathvid=$target_pathvid.rand().time().basename($_FILES['vid']['name']);
move_uploaded_file($_FILES['vid']['tmp_name'],$target_pathvid);
}
else {
$target_pathvid=""; }
$data = array (
'pro_catid' => $_REQUEST['pro_catid'],
'pro_subcatid' => $_REQUEST['pro_subcatid'],
'pro_nm' => $_REQUEST['pro_nm'],
'pro_desc' => $_REQUEST['pro_desc'],
'pro_img' => $target_path,
'pro_vid' => $target_pathvid,
'pro_dt' => $dt,'pro_typ' => $_REQUEST['pro_typ'],
);
$this->load->view('header');
if($this->db->insert('products', $data))
{
$insid = $this->db->insert_id();
for ($i = 0; $i < count($_FILES['pics']['name']); $i++) {
$target_path="uploads/products/";
$target_path=$target_path.rand().time().basename($_FILES['pics']['name'][$i]);
move_uploaded_file($_FILES['pics']['tmp_name'][$i],$target_path);
$data = array (
'proid' => $insid,
'paths' => $target_path,
);
$this->db->insert('productsimg', $data);
}
for ($i = 0; $i < count($_FILES['vids']['name']); $i++) {
$target_path="uploads/products/";
$target_path=$target_path.rand().time().basename($_FILES['vids']['name'][$i]);
move_uploaded_file($_FILES['vids']['tmp_name'][$i],$target_path);
$data = array (
'proid' => $insid,
'paths' => $target_path,
);
$this->db->insert('productsvid', $data);
}
$this->load->view('success');
}
else
$this->load->view('error');
}
public function manageProducts(){
$data['myinfo']=$this->index_model->manageProducts();
$this->load->view('header');
$this->load->view('manageProducts',$data);
}
public function deleteProducts($id){
$user = $this->session->userdata('uid');
$this->db->where('pro_id', $id);
$this->db->delete('products');
$data['myinfo']=$this->index_model->manageProducts();
$this->load->view('header');
$this->load->view('manageProducts',$data);
}
public function deleteProductsimg($id){
$user = $this->session->userdata('uid');
$this->db->where('pimgid', $id);
$this->db->delete('productsimg');
$data['myinfo']=$this->index_model->manageProducts();
$this->load->view('header');
$this->load->view('manageProducts',$data);
}
public function deleteProductsvid($id){
$user = $this->session->userdata('uid');
$this->db->where('pimgid', $id);
$this->db->delete('productsvid');
$data['myinfo']=$this->index_model->manageProducts();
$this->load->view('header');
$this->load->view('manageProducts',$data);
}
function ViewComments($id){
$data['myinfo']=$this->index_model->ViewComments($id);
$this->load->view('header');
$this->load->view('ViewComments',$data);
}
function editProducts($id){
$data['myinfo']=$this->index_model->editProducts($id);
$this->load->view('header');
$this->load->view('editProducts',$data);
}
public function updateProducts($id)
{
$user = $this->session->userdata('uid');
if($_FILES['pic']['name']!='')
{
$target_path="uploads/products/";
$target_path=$target_path.basename($_FILES['pic']['name']);
move_uploaded_file($_FILES['pic']['tmp_name'],$target_path);
}
else {
$target_path=""; }
if($_FILES['vid']['name']!='')
{
$target_pathvid="uploads/products/";
$target_pathvid=$target_pathvid.rand().time().basename($_FILES['vid']['name']);
move_uploaded_file($_FILES['vid']['tmp_name'],$target_pathvid);
$datavd = array (
'pro_vid' => $target_pathvid,
);
$this->db->where('pro_id',$id);
$this->db->update('products', $datavd);
}
if($target_path!=''){
$data = array (
'pro_catid' => $_REQUEST['pro_catid'],
'pro_subcatid' => $_REQUEST['pro_subcatid'],
'pro_nm' => $_REQUEST['pro_nm'],
'pro_desc' => $_REQUEST['pro_desc'],
'pro_img' => $target_path,
);
} else {
$data = array (
'pro_catid' => $_REQUEST['pro_catid'],
'pro_subcatid' => $_REQUEST['pro_subcatid'],
'pro_nm' => $_REQUEST['pro_nm'],
'pro_desc' => $_REQUEST['pro_desc'],
);
}
$this->db->where('pro_id',$id);
$this->load->view('header');
if($this->db->update('products', $data))
{
$insid = $id;
for ($i = 0; $i < count($_FILES['pics']['name']); $i++) {
$target_path="uploads/products/";
$target_path=$target_path.rand().time().basename($_FILES['pics']['name'][$i]);
move_uploaded_file($_FILES['pics']['tmp_name'][$i],$target_path);
$data = array (
'proid' => $insid,
'paths' => $target_path,
);
$this->db->insert('productsimg', $data);
}
for ($i = 0; $i < count($_FILES['vids']['name']); $i++) {
$target_path="uploads/products/";
$target_path=$target_path.rand().time().basename($_FILES['vids']['name'][$i]);
move_uploaded_file($_FILES['vids']['tmp_name'][$i],$target_path);
$data = array (
'proid' => $insid,
'paths' => $target_path,
);
$this->db->insert('productsvid', $data);
}
$this->load->view('success');
?>
load->view('error');
}
}
function addServices(){
$this->load->view('header');
$this->load->view('addServices');
}
public function insertServices()
{
$user = $this->session->userdata('uid');
$data = array (
'ser_nm' => $_REQUEST['ser_nm'],
'ser_desc' => $_REQUEST['ser_desc'],
);
$this->load->view('header');
if($this->db->insert('services', $data))
{
$this->load->view('success');
}
else
$this->load->view('error');
}
public function manageServices(){
$data['myinfo']=$this->index_model->manageServices();
$this->load->view('header');
$this->load->view('manageServices',$data);
}
public function deleteServices($id){
$user = $this->session->userdata('uid');
$this->db->where('ser_id', $id);
$this->db->delete('services');
$data['myinfo']=$this->index_model->manageServices();
$this->load->view('header');
$this->load->view('manageServices',$data);
}
function editServices($id){
$data['myinfo']=$this->index_model->editServices($id);
$this->load->view('header');
$this->load->view('editServices',$data);
}
public function updateServices($id)
{
$user = $this->session->userdata('uid');
$data = array (
'ser_nm' => $_REQUEST['ser_nm'],
'ser_desc' => $_REQUEST['ser_desc'],
);
$this->db->where('ser_id',$id);
$this->load->view('header');
if($this->db->update('services', $data))
$this->load->view('success');
else
$this->load->view('error');
}
function homepagedata(){
$id='1';
$data['myinfo']=$this->index_model->homepagedata($id);
$this->load->view('header');
$this->load->view('homepagedata',$data);
}
public function updatehomepagedata($id)
{
$data = array (
'txt1' => $_REQUEST['txt1'],
// 'dtl1' => $_REQUEST['dtl1'],
// 'txt2' => $_REQUEST['txt2'],
// 'dtl2' => $_REQUEST['dtl2'],
// 'txt3' => $_REQUEST['txt3'],
// 'dtl3' => $_REQUEST['dtl3'],
// 'txt4' => $_REQUEST['txt4'],
// 'dtl4' => $_REQUEST['dtl4'],
);
$this->db->where('id',$id);
$this->load->view('header');
if($this->db->update('homepagedata', $data))
$this->load->view('success');
else
$this->load->view('error');
}
function contactinfo(){
$id='1';
$data['myinfo']=$this->index_model->contactinfo($id);
$this->load->view('header');
$this->load->view('contactinfo',$data);
}
public function updatecontactinfo($id)
{
if($_FILES['pic']['name']!='')
{
$target_path="uploads/logo/";
$target_path=$target_path.rand().time().basename($_FILES['pic']['name']);
move_uploaded_file($_FILES['pic']['tmp_name'],$target_path);
$data = array (
'comp' => $_REQUEST['comp'],
'adrs' => $_REQUEST['adrs'],
'phn1' => $_REQUEST['phn1'],
'phn2' => $_REQUEST['phn2'],
'eml1' => $_REQUEST['eml1'],
'eml2' => $_REQUEST['eml2'],
'fb' => $_REQUEST['fb'],
'twitt' => $_REQUEST['twitt'],
'map' => $_REQUEST['map'],
'why' => $_REQUEST['why'],
'logo' => $target_path,
);
}
else {
$target_path="";
$data = array (
'comp' => $_REQUEST['comp'],
'adrs' => $_REQUEST['adrs'],
'phn1' => $_REQUEST['phn1'],
'phn2' => $_REQUEST['phn2'],
'eml1' => $_REQUEST['eml1'],
'eml2' => $_REQUEST['eml2'],
'fb' => $_REQUEST['fb'],
'twitt' => $_REQUEST['twitt'],
'map' => $_REQUEST['map'],
'why' => $_REQUEST['why'],
);
}
$this->db->where('id',$id);
$this->load->view('header');
if($this->db->update('contactinfo', $data))
$this->load->view('success');
else
$this->load->view('error');
}
// function aboutus(){
// $id='1';
// $data['myinfo']=$this->index_model->aboutus($id);
// $this->load->view('header');
// $this->load->view('aboutus',$data);
// }
function addPages(){
$this->load->view('header');
$this->load->view('addPages');
}
public function insertPages($id)
{
if($_FILES['pic']['name']!='')
{
$target_path="uploads/aboutus/";
$target_path=$target_path.rand().time().basename($_FILES['pic']['name']);
move_uploaded_file($_FILES['pic']['tmp_name'],$target_path);
}
else {
$target_path=""; }
if(isset($_REQUEST['hdr'])&&$_REQUEST['hdr']!=''){
$hdr=$_REQUEST['hdr'];
} else {
$hdr=0;
}
if(isset($_REQUEST['ftr'])&&$_REQUEST['ftr']!=''){
$ftr=$_REQUEST['ftr'];
} else {
$ftr=0;
}
$data = array (
'abt_img' => $target_path,
'abt_desc' => $_REQUEST['abt_desc'],
'nm' => $_REQUEST['nm'],
'ord' => $_REQUEST['ord'],
);
$this->load->view('header');
if($this->db->insert('aboutus', $data))
$this->load->view('success');
else
$this->load->view('error');
}
public function managePages(){
$data['myinfo']=$this->index_model->managePages();
$this->load->view('header');
$this->load->view('managePages',$data);
}
public function deletePages($id){
$this->db->where('abt_id', $id);
$this->db->delete('aboutus');
$data['myinfo']=$this->index_model->managePages();
$this->load->view('header');
$this->load->view('managePages',$data);
}
function editPages($id){
$data['myinfo']=$this->index_model->aboutus($id);
$this->load->view('header');
$this->load->view('aboutus',$data);
}
// function aboutus(){
// $id='1';
// $data['myinfo']=$this->index_model->aboutus($id);
// $this->load->view('header');
// $this->load->view('aboutus',$data);
// }
public function updateaboutus($id)
{
if($_FILES['pic']['name']!='')
{
$target_path="uploads/aboutus/";
$target_path=$target_path.rand().time().basename($_FILES['pic']['name']);
move_uploaded_file($_FILES['pic']['tmp_name'],$target_path);
}
else {
$target_path=""; }
if($target_path!=''){
$data = array (
'nm' => $_REQUEST['nm'],
'abt_img' => $target_path,
'abt_desc' => $_REQUEST['abt_desc'],
'ord' => $_REQUEST['ord'],
);
} else {
$data = array (
'nm' => $_REQUEST['nm'],
'abt_desc' => $_REQUEST['abt_desc'],'ord' => $_REQUEST['ord'],
);
}
$this->db->where('abt_id',$id);
$this->load->view('header');
if($this->db->update('aboutus', $data))
$this->load->view('success');
else
$this->load->view('error');
}
function addGallery(){
$this->load->view('header');
$this->load->view('addGallery');
}
public function insertGallery()
{
$user = $this->session->userdata('uid');
if($_FILES['pic']['name']!='')
{
$target_path="uploads/gallery/";
$target_path=$target_path.basename($_FILES['pic']['name']);
move_uploaded_file($_FILES['pic']['tmp_name'],$target_path);
}
else {
$target_path=""; }
$data = array (
'gal_ttl' => $_REQUEST['pgnm'],
'gal_descr' => $_REQUEST['cont'],
'gal_img' => $target_path,
);
$this->load->view('header');
if($this->db->insert('gallery', $data))
{
$this->load->view('success');
}
else
$this->load->view('error');
}
public function manageGallery(){
$data['myinfo']=$this->index_model->manageGallery();
$this->load->view('header');
$this->load->view('manageGallery',$data);
}
public function deleteGallery($id){
$this->db->where('gal_id', $id);
$this->db->delete('gallery');
$data['myinfo']=$this->index_model->manageGallery();
$this->load->view('header');
$this->load->view('manageGallery',$data);
}
function editGallery($id){
$data['myinfo']=$this->index_model->editGallery($id);
$this->load->view('header');
$this->load->view('editGallery',$data);
}
public function updateGallery($id)
{
if($_FILES['pic']['name']!='')
{
$target_path="uploads/gallery/";
$target_path=$target_path.basename($_FILES['pic']['name']);
move_uploaded_file($_FILES['pic']['tmp_name'],$target_path);
}
else {
$target_path=""; }
if( $target_path==''){
$data = array (
'gal_ttl' => $_REQUEST['pgnm'],
'gal_descr' => $_REQUEST['cont'],
);
} else {
$data = array (
'gal_ttl' => $_REQUEST['pgnm'],
'gal_descr' => $_REQUEST['cont'],
'gal_img' => $target_path,
);
}
$this->db->where('gal_id',$id);
$this->load->view('header');
if($this->db->update('gallery', $data))
$this->load->view('success');
else
$this->load->view('error');
}
public function subscribersmail(){
$this->load->view('header');
$this->load->view('subscribersmail',$data);
}
public function subscribers(){
$data['myinfo']=$this->index_model->subscribers();
$this->load->view('header');
$this->load->view('subscribers',$data);
}
public function share_something(){
$data['myinfo']=$this->index_model->share_something();
$this->load->view('header');
$this->load->view('share_something',$data);
}
public function delete_share_something($id){
$this->db->where('id', $id);
$this->db->delete('share_something');
$this->share_something();
}
public function deletesubscribers($id){
$this->db->where('id', $id);
$this->db->delete('subscriber');
$this->subscribers();
}
public function newcontactrequests(){
$data['myinfo']=$this->index_model->newcontactrequests();
$this->load->view('header');
$this->load->view('newcontactrequests',$data);
}
public function deletenewcontactrequests($id){
$this->db->where('id', $id);
$this->db->delete('newcontactrequests');
$this->newcontactrequests();
}
function addVideo(){
$this->load->view('header');
$this->load->view('addVideo');
}
public function insertVideo()
{
$user = $this->session->userdata('uid');
if($_FILES['pic']['name']!='')
{
$target_path="uploads/video/";
$target_path=$target_path.rand().time().basename($_FILES['pic']['name']);
move_uploaded_file($_FILES['pic']['tmp_name'],$target_path);
}
else {
$target_path=""; }
$dt = date('Y-m-d');
$data = array (
'ttl' => $_REQUEST['ttl'],
'dtt' => $dt,
'gal_ttl' => $_REQUEST['cont'],
'gal_link' =>$target_path,
);
$this->load->view('header');
if($this->db->insert('video', $data))
{
$this->load->view('success');
}
else
$this->load->view('error');
}
public function manageVideo(){
$data['myinfo']=$this->index_model->manageVideo();
$this->load->view('header');
$this->load->view('manageVideo',$data);
}
public function deleteVideo($id){
$this->db->where('gal_id', $id);
$this->db->delete('video');
$data['myinfo']=$this->index_model->manageVideo();
$this->load->view('header');
$this->load->view('manageVideo',$data);
}
function editVideo($id){
$data['myinfo']=$this->index_model->editVideo($id);
$this->load->view('header');
$this->load->view('editVideo',$data);
}
public function updateVideo($id)
{
if($_FILES['pic']['name']!='')
{
$target_path="uploads/video/";
$target_path=$target_path.rand().time().basename($_FILES['pic']['name']);
move_uploaded_file($_FILES['pic']['tmp_name'],$target_path);
}
else {
$target_path=""; }
if( $target_path==''){
$data = array (
'ttl' => $_REQUEST['ttl'],
'gal_ttl' => $_REQUEST['cont'],
);
} else {
$data = array (
'ttl' => $_REQUEST['ttl'],
'gal_ttl' => $_REQUEST['cont'],
'gal_link' =>$target_path,
);
}
$this->db->where('gal_id',$id);
$this->load->view('header');
if($this->db->update('video', $data))
$this->load->view('success');
else
$this->load->view('error');
}
public function subscribersmailsent()
{
$rr = mysql_fetch_array(mysql_query("select * from contactinfo where id='1'"));
$admineml = $rr["eml1"];
foreach ($_REQUEST['subscrb'] as $value) {
//echo $value;
$to =$value;
$subject = $_REQUEST['subj'];
$message = $_REQUEST['msg'];
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
//$headers .= 'From: ' . "\r\n";
$headers .= 'From: <'.$admineml.'>' . "\r\n";
//$headers .= 'Cc: myboss@example.com' . "\r\n";
mail($to,$subject,$message,$headers);
}
$this->load->view('header');
$this->load->view('success');
}
function addsponsor(){
$this->load->view('header');
$this->load->view('addsponsor');
}
public function insertsponsor()
{
$user = $this->session->userdata('uid');
if($_FILES['pic']['name']!='')
{
$target_path="uploads/sponsor/";
$target_path=$target_path.rand().time().basename($_FILES['pic']['name']);
move_uploaded_file($_FILES['pic']['tmp_name'],$target_path);
}
else {
$target_path=""; }
$data = array (
'gal_link' => $_REQUEST['lnk'],
'gal_img' => $target_path,
);
$this->load->view('header');
if($this->db->insert('sponsor', $data))
{
$this->load->view('success');
}
else
$this->load->view('error');
}
public function managesponsor(){
$data['myinfo']=$this->index_model->managesponsor();
$this->load->view('header');
$this->load->view('managesponsor',$data);
}
public function deletesponsor($id){
$this->db->where('gal_id', $id);
$this->db->delete('sponsor');
$data['myinfo']=$this->index_model->managesponsor();
$this->load->view('header');
$this->load->view('managesponsor',$data);
}
function editsponsor($id){
$data['myinfo']=$this->index_model->editsponsor($id);
$this->load->view('header');
$this->load->view('editsponsor',$data);
}
public function updatesponsor($id)
{
if($_FILES['pic']['name']!='')
{
$target_path="uploads/sponsor/";
$target_path=$target_path.basename($_FILES['pic']['name']);
move_uploaded_file($_FILES['pic']['tmp_name'],$target_path);
}
else {
$target_path=""; }
if( $target_path==''){
$data = array (
'gal_link' => $_REQUEST['lnk'],
);
} else {
$data = array (
'gal_link' => $_REQUEST['lnk'],
'gal_img' => $target_path,
);
}
$this->db->where('gal_id',$id);
$this->load->view('header');
if($this->db->update('sponsor', $data))
$this->load->view('success');
else
$this->load->view('error');
}
}
ob_flush();
?>