33 lines
		
	
	
		
			928 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			928 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| require_once '../../includes/connect_endpoint.php';
 | |
| session_start();
 | |
| if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
 | |
|     die(json_encode([
 | |
|         "success" => false,
 | |
|         "message" => translate('session_expired', $i18n)
 | |
|     ]));
 | |
| }
 | |
| 
 | |
| if ($_SERVER["REQUEST_METHOD"] === "POST") {
 | |
|     $postData = file_get_contents("php://input");
 | |
|     $data = json_decode($postData, true);
 | |
|     
 | |
|     $monthly_price = $data['value'];
 | |
| 
 | |
|     $stmt = $db->prepare('UPDATE settings SET monthly_price = :monthly_price');
 | |
|     $stmt->bindParam(':monthly_price', $monthly_price, SQLITE3_INTEGER);
 | |
| 
 | |
|     if ($stmt->execute()) {
 | |
|         die(json_encode([
 | |
|             "success" => true,
 | |
|             "message" => translate("success", $i18n)
 | |
|         ]));
 | |
|     } else {
 | |
|         die(json_encode([
 | |
|             "success" => false,
 | |
|             "message" => translate("error", $i18n)
 | |
|         ]));
 | |
|     }
 | |
| }
 | |
| 
 | |
| ?>
 |