<?php
$yn = $_POST['YN'];
$yb = $_POST['YB'];
$user1 = $_POST['user'];
$pass1 = $_POST['pass'];
$servicesvisible1 = $_POST['servicesvisible'];
$clockvisible1 = $_POST['clockvisible'];
$kknowledgefeedvisible1 = $_POST['kknowledgefeedvisible'];
$webclipfeedvisible1 = $_POST['webclipfeedvisible'];
$konvoschat1 = $_POST['konvoschat'];
$konvosvisible1 = $_POST['konvosvisible'];
$kodivisible1 = $_POST['kodivisible'];
$backgroundcolor1 = $_POST['backgroundcolor'];
$showversion1 = $_POST['showversion'];

//
$fl='../config.php'; 
        /*read operation ->*/ $tmp = fopen($fl, "r");   $content=fread($tmp,filesize($fl)); fclose($tmp);

// here goes your update
// Server Updates
$content =   preg_replace( '/\$yourname = \"(.*?)\";/', '$yourname = "'.$yn.'";', $content);
$content =   preg_replace( '/\$base = \"(.*?)\";/', '$base = "'.$yb.'";', $content);
// User/Pass Update
$content =   preg_replace( '/\$user = \"(.*?)\";/', '$user = "'.$user1.'";', $content);
$content =   preg_replace( '/\$pass = \"(.*?)\";/', '$pass = "'.$pass1.'";', $content);
$content =   preg_replace( '/\$custombackground = \"(.*?)\";/', '$custombackground = "#'.$backgroundcolor1.'";', $content);
 // version Settings
 if (empty($showversion1)) {
    $content =   preg_replace( '/\$showversion = \"(.*?)\";/', '$showversion = "0";', $content);
 } else {
 $content =   preg_replace( '/\$showversion = \"(.*?)\";/', '$showversion = "1";', $content);
 }
 // clockvisible Settings
 if (empty($clockvisible1)) {
    $content =   preg_replace( '/\$clockvisible = \"(.*?)\";/', '$clockvisible = "0";', $content);
 } else {
 $content =   preg_replace( '/\$clockvisible = \"(.*?)\";/', '$clockvisible = "1";', $content);
 }
 // kknowledgefeedvisible Settings
 if (empty($kknowledgefeedvisible1)) {
    $content =   preg_replace( '/\$kknowledgefeedvisible = \"(.*?)\";/', '$kknowledgefeedvisible = "0";', $content);
 } else {
 $content =   preg_replace( '/\$kknowledgefeedvisible = \"(.*?)\";/', '$kknowledgefeedvisible = "1";', $content);
 }
 // webclipfeedvisible Settings
 if (empty($webclipfeedvisible1)) {
    $content =   preg_replace( '/\$webclipfeedvisible = \"(.*?)\";/', '$webclipfeedvisible = "0";', $content);
 } else {
 $content =   preg_replace( '/\$webclipfeedvisible = \"(.*?)\";/', '$webclipfeedvisible = "1";', $content);
 }
 // konvosvisible Settings
 if (empty($konvosvisible1)) {
    $content =   preg_replace( '/\$konvosvisible = \"(.*?)\";/', '$konvosvisible = "0";', $content);
 } else {
 $content =   preg_replace( '/\$konvosvisible = \"(.*?)\";/', '$konvosvisible = "1";', $content);
 }
 // konvoschat Settings
 if (empty($konvoschat1)) {
    $content =   preg_replace( '/\$konvoschat = \"(.*?)\";/', '$konvoschat = "0";', $content);
 } else {
 $content =   preg_replace( '/\$konvoschat = \"(.*?)\";/', '$konvoschat = "1";', $content);
 }
  // kodivisible Settings
 if (empty($kodivisible1)) {
    $content =   preg_replace( '/\$kodivisible = \"(.*?)\";/', '$kodivisible = "0";', $content);
 } else {
 $content =   preg_replace( '/\$kodivisible = \"(.*?)\";/', '$kodivisible = "1";', $content);
 }
         /*write operation ->*/ $tmp =fopen($fl, "w");    fwrite($tmp, $content);    fclose($tmp);

		//sleep for 5 seconds
		
		
		header("Location: re1.php");
die();
		
		?>