mirror of
				https://github.com/uklans/cache-domains
				synced 2025-11-04 08:38:52 +01:00 
			
		
		
		
	making class to handle the script runing in web mode
This commit is contained in:
		
							parent
							
								
									2a1b7b538a
								
							
						
					
					
						commit
						27c6817d4d
					
				
							
								
								
									
										50
									
								
								scripts/lib/web_mode.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								scripts/lib/web_mode.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,50 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* 
 | 
			
		||||
*/
 | 
			
		||||
class web_mode
 | 
			
		||||
{
 | 
			
		||||
	
 | 
			
		||||
	function __construct()
 | 
			
		||||
	{
 | 
			
		||||
		$this->request_handling();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	function request_handling()
 | 
			
		||||
	{
 | 
			
		||||
		// Files - Always finde the correct path
 | 
			
		||||
		$dir_path = __FILE__;
 | 
			
		||||
		$dir_path = str_replace("web_mode.php", "", $dir_path);
 | 
			
		||||
		$files = glob($dir_path . "../../*.txt");
 | 
			
		||||
 | 
			
		||||
		// TODO: Update to support what services that shoud output
 | 
			
		||||
		if (isset($_POST["conf"]) && $_POST["conf"] == "unbound") 
 | 
			
		||||
		{
 | 
			
		||||
			require_once $dir_path . "../plugins/unbound.php";
 | 
			
		||||
			$unbound = new unbound("web");
 | 
			
		||||
			$unbound->make("web", $files, $_POST["ip"]);
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			$this->show_gui();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	function show_gui()
 | 
			
		||||
	{
 | 
			
		||||
		?>
 | 
			
		||||
 | 
			
		||||
		<form action="/steamcache/scripts/" method="post">
 | 
			
		||||
			<input type="text" name="ip" placeholder="ip of cache server"><br>
 | 
			
		||||
			<input type="radio" name="conf" value="unbound" checked> unbound<br>
 | 
			
		||||
			<input type="radio" name="conf" value="other"> Other<br>
 | 
			
		||||
			<input type="radio" name="conf" value="other2"> Other2<br>
 | 
			
		||||
			<input type="submit" value="Submit">
 | 
			
		||||
		</form>
 | 
			
		||||
 | 
			
		||||
		<?php
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user