<?php
	

	if(isset($_POST)){

		$mysql_host = $_POST['host'];
		$mysql_username = $_POST['username'];
		$mysql_password = $_POST['password'];
		$mysql_database = $_POST['db_name'];
			
		// Connect to MySQL server
		$conn = mysqli_connect($mysql_host, $mysql_username, $mysql_password) or die('Error connecting to MySQL server: ' . $conn->error);
		// Select database
		$sql = mysqli_select_db($conn,$mysql_database);
		if($sql){
		// $st_1 = $conn->query('ALTER TABLE setting ADD (supported_until DATETIME)') or print json_encode(array('st'=>0,'msg'=>$conn->error));
		// $st_1 = $conn->query('ALTER TABLE setting ADD (purchase_code VARCHAR(255) NOT NULL)') or print json_encode(array('st'=>0,'msg'=>$conn->error));
		$st_1 = $conn->query("INSERT INTO language_data(keyword,type,english) VALUES ('trial','admin','Trial')") or print json_encode(array('st'=>0,'msg'=>$conn->error));
		$st_1 = $conn->query("INSERT INTO language_data(keyword,type,english) VALUES ('trial_month','admin','Trial for 1 Month')") or print json_encode(array('st'=>0,'msg'=>$conn->error));
		

		if($st_1){
			echo json_encode(array('st'=>1,'msg'=>'<div class="alert alert-success alert-dismissible fade show" role="alert">
						  <strong>Congratulations!!</strong> Your script were updated
						  <button type="button" class="close" data-dismiss="alert" aria-label="Close">
						    <span aria-hidden="true">&times;</span>
						  </button>
						</div>'));
		}else{
			echo json_encode(array('st'=>0,'msg'=>'<div class="alert alert-danger alert-dismissible fade show" role="alert">
						  <strong>Sorry!!</strong> '.$conn->error.'
						  <button type="button" class="close" data-dismiss="alert" aria-label="Close">
						    <span aria-hidden="true">&times;</span>
						  </button>
						</div>'));
		}
		
		}else{
			echo json_encode(array('st'=>0,'msg'=>'<div class="alert alert-danger alert-dismissible fade show" role="alert">
						  <strong>Sorry!!</strong> Database Not Found
						  <button type="button" class="close" data-dismiss="alert" aria-label="Close">
						    <span aria-hidden="true">&times;</span>
						  </button>
						</div>'));
			
		}
	}
?>