mirror of
				https://github.com/uklans/cache-domains
				synced 2025-11-04 13:38:53 +01:00 
			
		
		
		
	Merge 288d5c6477 into 177f65e5a2
				
					
				
			This commit is contained in:
		
						commit
						5b287cf5c1
					
				
							
								
								
									
										24
									
								
								scripts/index.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								scripts/index.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (isset($_POST["conf"]) && $_POST["conf"] == "unbound") 
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						require "unbound_conf.php";
 | 
				
			||||||
 | 
						$unbound_conf = new unbound_conf();
 | 
				
			||||||
 | 
						$unbound_conf->print();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						?>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						<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
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					?>
 | 
				
			||||||
							
								
								
									
										55
									
								
								scripts/unbound_conf.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								scripts/unbound_conf.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,55 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					* Class to make unbound config file
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					class unbound_conf
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    function __construct()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        header("Content-Type: text/plain");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function print()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        //Steamcache server ip
 | 
				
			||||||
 | 
					        $server = $_POST["ip"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $files = glob("../*.txt");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        foreach($files as $file) 
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            echo "# File: " . substr($file, 3);
 | 
				
			||||||
 | 
					            echo PHP_EOL;
 | 
				
			||||||
 | 
					            foreach (file($file) as $key => $value) 
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                $value = trim($value, " \t\n\r\0\x0B");
 | 
				
			||||||
 | 
					                if (substr($value, 0,1) == "#") 
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    $content = $value;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                elseif (substr($value, 0,1) == "*") 
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    $value = ltrim($value, '*');
 | 
				
			||||||
 | 
					                    $value = ltrim($value, '.');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    $content = "# ------ Wildcard replaced with local-zone data ------ #" . PHP_EOL;
 | 
				
			||||||
 | 
					                    $content = $content . 'local-zone: "' . $value . '" redirect' . PHP_EOL;
 | 
				
			||||||
 | 
					                    $content = $content . 'local-data: "' . $value . ' A ' . $server . '"' . PHP_EOL;
 | 
				
			||||||
 | 
					                    $content = $content . "# ---------------------------------------------------- #";
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    $content = 'local-data: "' . $value . ' A ' . $server . '"';
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                echo $content;
 | 
				
			||||||
 | 
					                echo PHP_EOL;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            echo PHP_EOL;
 | 
				
			||||||
 | 
					            echo PHP_EOL;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					?>
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user