<?php  session_start();
include("../../config/config.php");
include("../validateuserlogin.php");

$company_name	=   secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'company_name']);
$footer_change	=   secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'footer_change']);
$copyright	    =   secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'copyright']);
$datecreated=date("Y-m-d H:i:s");


  try{
echo $rows_found_settings;
  	if($rows_found_settings>0){

		 $olgaquerys="UPDATE website_setting SET datecreated='$datecreated' "; 

		   if(!empty($company_name)){
            $olgaquerys=$olgaquerys." ,company='$company_name'";

		   }
		     if(!empty($footer_change)){

		   	 $olgaquerys=$olgaquerys." ,footer='$footer_change'";
		   }
		   if(!empty($copyright)){

		   	  $olgaquerys=$olgaquerys." ,copyright='$copyright'";
		   }
		$stmts = $conn->prepare($olgaquerys);
		if($stmts->execute()){

			
			
			 header("location:../dashboard.php");

			}
		}else{
			 $olgaquerys="INSERT INTO website_setting SET datecreated='$datecreated' "; 

		   if(!empty($company_name)){
            $olgaquerys=$olgaquerys." company='$company_name'";

		   }
		     if(!empty($footer_change)){

		   	 $olgaquerys=$olgaquerys." ,footer='$footer_change'";
		   }
		   if(!empty($copyright)){

		   	  $olgaquerys=$olgaquerys." ,copyright='$copyright'";
		   }
		$stmts = $conn->prepare($olgaquerys);
		if($stmts->execute()){

			
			
			 header("location:../dashboard.php");

			}


		}
 
 
   }
         
        // show error
        catch(PDOException $exception){
            die('ERROR: ' . $exception->getMessage());
        }
    


    ?>