Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include '../../scripts/config.inc';
- include '../../scripts/admin/rcon.inc';
- echo '<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" crossorigin="anonymous"><center>';
- function access()
- {
- Global $headAdmin;
- $IP = $_SERVER['REMOTE_ADDR'];
- If( $IP == "85.202.220.14" || $IP == "127.0.0.1" ) $headAdmin = true;
- else $headAdmin = true;
- $allow = explode( ":", "85.202.220.14:81.93.193.7:127.0.0.1:84.27.177.41:81.92.190.104" );
- for( $i = 0;$i < count( $allow );$i++ )
- if( $IP == $allow[ $i ] ) return true;
- return true;
- }
- function deleteEnter( $str ){
- $str = str_replace( "\r", "", $str );
- return str_replace( "\n", "{ENTER}", $str );
- }
- function backEnter( $str ){
- return str_replace( "{ENTER}", "\n", $str );
- }
- if( !access() ) exit();
- //echo '<center><fieldset><h1 color="gold" style="font-family:Georgia"></h1>';
- if( isSet( $_GET[ 'thing' ] ) || isSet( $_GET[ 'editnews' ] ) )
- {
- parseNews();
- if( isSet($_GET[ 'thing' ]) && $_GET["thing"] == "edit" )
- {
- if( $headAdmin ) {
- For( $i = 0;$i < count( $newsTitle );$i++ )
- {
- echo '<a href="?editnews=' . $i . '">' . backEnter( $newsTitle[ $i ] ) . '</a><br \>';
- }
- }
- }
- else if( isSet($_GET[ 'thing' ]) && $_GET[ 'thing' ] == "make" )
- createNewsForm();
- else if( isSet( $_GET[ 'editnews' ] ) )
- {
- if( $headAdmin ) {
- $num = (int)$_GET[ 'editnews' ];
- echo '<form id="edit" action="perform.php" method="post" >
- <fieldset>
- Title:<br \><input name="title" size="70" value="' . backEnter( $newsTitle[$num] ) . '"><br \>
- Text:<br \><textarea onkeyup="textAreaAdjust(this)" name="text" rows="15" cols="70">' . backEnter( $newsText[$num] ) . '</textarea><br \>
- Date:<br \><input name="date" value="' . backEnter( $newsDate[$num] ) . '"><br \>
- Approval:<br \>
- <select name="approve">
- <option value="APPROVED"';if(backEnter($newsApproval[$num]) == 'APPROVED') echo 'selected="selected"';
- echo '>Approved</option>
- <option value="NOTAPPROVED"';if(backEnter($newsApproval[$num]) == 'NOTAPPROVED') echo 'selected="selected"';
- echo '>Not Approved</option>
- </select>
- <input type="hidden" name="id" value="' . $num . '"><br \><br \>
- <input type="submit" name="submit" class="btn btn-primary" value="Send">
- </fieldset>
- </form>'; }
- }
- else if( $_GET[ 'thing' ] == "control" )
- {
- $connection = fsockopen( "udp://" . $ServerIP, $ServerPort);
- if(!is_resource($connection))
- {
- echo '<h1>Server seems to be <font color="red">Offline</font></h1><br \>';
- echo '<h2><a href="?thing=start">Start server</a></h2>';
- }
- else
- {
- echo '<h1>Server seems to be <font color="green">Online</font></h1>';
- echo '<h2><a href="?thing=restart">Restart server</a><br \>';
- echo '<a href="?thing=shut">Shut server</a></h2>';
- echo '<a href="?thing=hostname">Change name of the server</a>
- <br \>
- <a href="?thing=editrot">Edit rotation</a>
- <br \>
- <a href="?thing=update">Update statistics</a>
- <br \>';
- }
- }
- else if( $_GET[ 'thing' ] == "app" )
- {
- getApps();
- }
- else if( $_GET[ 'thing' ] == "update" )
- {
- updateServerStats();
- }
- else if( $_GET[ 'thing' ] == "hostname" )
- {
- $x = rcon( "sv_hostname", 1 );
- $x = explode('"', $x)[3];
- echo '<form id="edit" action="perform.php" method="post" style="background-color: #595959">
- <fieldset>
- ' . color( $x ) . '</font></font></font></font><br \>
- Hostname:<br \><input name="hostname" size="70" value="' . $x . '"><br \>
- <input type="hidden" name="id" value="hostname"><br \><br \>
- <input type="submit" name="submit" class="btn btn-primary" value="Send">
- </fieldset>
- </form>';
- }
- else if( $_GET[ 'thing' ] == "editrot" )
- {
- $x = rcon( "sv_maprotation", 1 );
- echo '<form id="edit" action="perform.php" method="post" >
- <fieldset>
- Text:<br \><textarea name="rotation" rows="30" cols="70">' . $x . '</textarea><br \>
- <input type="hidden" name="id" value="editrot"><br \><br \>
- <input type="submit" name="submit" class="btn btn-primary" value="Send">
- </fieldset>
- </form>';
- }
- else if( $_GET[ 'thing' ] == "start" )
- {
- }
- else if( $_GET[ 'thing' ] == "shut" )
- {
- echo sendMessage( "shut" );
- }
- else if( $_GET[ 'thing' ] == "restart" )
- {
- }
- else
- {
- echo '<h1 style="color:red">Sorry, could not find your request, or it is currently under construction!</h1>';
- }
- echo '<a class="btn btn-primary" href="javascript:history.back()" style="text:white">Go back</a><br \><br \></center>';
- }
- else
- {
- $add = "";
- If( $headAdmin ) $add = '<a href="?thing=edit">Edit news</a><br \>';
- echo '<h2>' . $add . '
- <a href="?thing=make">Make news</a>
- <br \>
- <a href="?thing=app">Admin applications</a>
- <br \>
- <a href="?thing=control" color="blue">Server control</a>
- </h2></center>';
- }
- function getString( $from, $to, $str, $flag=0 )
- {
- $rev = strRev( $str );
- $revTo = strRev( $to );
- $str = strRev( strStr( $rev, $revTo ) );
- $str = str_replace( $to, "", $str );
- $str = strStr( $str, $from );
- $str = str_replace( $from, "", $str );
- $text = "</td>";
- if( $flag ) $text = "</tr>";
- echo '<td>' . $str . $text;
- }
- function updateServerStats()
- {
- Global $StatsFile;
- $file = "../".$StatsFile;
- $stats = explode( ":", "hunter_score:zombie_score:heads:bashes:kills" );
- for( $i = 0;$i < count( $stats );$i++ )
- $stat[$i] = rcon( $stats[$i] );
- $img[0] = "hunter_score.png";
- $img[1] = "zombie_score.png";
- $img[2] = "heads.png";
- $img[3] = "bashes.png";
- $img[4] = "kills.png";
- $re = '/is:"([0-9]*):(.*)" default/m';
- for( $i = 0;$i < count( $stat );$i++ )
- {
- echo $stat[$i];
- preg_match_all($re, $stat[$i], $matches, PREG_SET_ORDER, 0);
- $score[$i] = $matches[ 0 ][1];
- $name[$i] = $matches[ 0 ][2];
- }
- $theret = "<table align=center class=style4><thead><th>#</th><th>Name</th><th>Score</th><tbody>";
- for( $i = 0;$i < count($name);$i++ )
- $theret = $theret . '<tr><td><img src="images/' . $img[$i] . '" width=20 height=20></td><td>' . colorize($name[$i]) . '</td><td>' . $score[$i] . '</td></tr>';
- $theret = $theret . '</tbody></table>';
- $fh = fopen($file, 'w') or die("can't open file");
- fwrite($fh, $theret);
- fclose($fh);
- echo $theret;
- }
- function color($text)
- {
- $text = str_replace('^0', '<font color="black">',$text);
- $text = str_replace('^1', '<font color="red">',$text);
- $text = str_replace('^2', '<font color="green">',$text);
- $text = str_replace('^3', '<font color="yellow">',$text);
- $text = str_replace('^4', '<font color="blue">',$text);
- $text = str_replace('^5', '<font color="aqua">',$text);
- $text = str_replace('^6', '<font color="hotpink">',$text);
- $text = str_replace('^7', '<font color="white">',$text);
- $text = str_replace('^8', '<font color="darkgreen">',$text);
- $text = str_replace('^9', '<font color="darkred">',$text);
- return $text;
- }
- function getApps()
- {
- $file = '../apps737.db';
- $read = file_get_contents($file);
- if( $read == "" ) exit( "Couldn't find any applications" . '<br \><a href="javascript:history.back()">Go back</a>' );
- $apps = explode( "START OF APPLICATION|", $read );
- echo '
- <table class="table table-dark">
- <thead>
- <tr>
- <th>#</th>
- <th>IP</th>
- <th>Name</th>
- <th>Steam</th>
- <th>Age</th>
- <th>English knowledge</th>
- <th>Command knowledge</th>
- <th>Experience as an Admin</th>
- <th>Experience in CoD</th>
- <th>Reason</th>
- </tr>
- </thead>
- <tbody>';
- for( $i = 1;$i < count( $apps );$i++ )
- {
- echo "<tr><th scope='row'>" . $i . "</th>";
- echo getString( "IP:", "NAME: ", $apps[ $i ] );
- echo getString( "NAME: ", "Steam: ", $apps[ $i ] );
- echo getString( "Age: ", "Knownledge of English: ", $apps[ $i ] );
- echo getString( "Knownledge of English: ", "Command Knownledge: ", $apps[ $i ] );
- echo getString( "Command Knownledge: ", "Experience as Admin: ", $apps[ $i ] );
- echo getString( "Experience as Admin: ", "Experience in CoD: ", $apps[ $i ] );
- echo getString( "Command Knownledge: ", "Experience as Admin: ", $apps[ $i ] );
- echo getString( "Experience in CoD: ", "Why wants to be an Admin: ", $apps[ $i ] );
- echo getString( "Why wants to be an Admin: ", "|END OF APPL", $apps[ $i ] );
- echo "</tr>";
- }
- echo '
- </tbody>
- </table>';
- }
- function createNewsForm()
- {
- echo '<center><form id="edit" action="perform.php" method="post" >
- <fieldset>
- Title:<br \><input name="title" size="70"><br \>
- Text:<br \><textarea name="text" rows="30" cols="70"></textarea><br \>
- Date:<br \><input name="date"><br \>
- <input type="hidden" name="id" value="new"><br \><br \>
- <input class="btn btn-primary" type="submit" name="submit" value="Send">
- </fieldset>
- </form>';
- }
- function parseNews()
- {
- Global $array;
- Global $newsTitle;
- Global $newsText;
- Global $newsDate;
- Global $newsApproval;
- $newsTitle[0] = "";
- $newsText[0] = "";
- $newsDate[0] = "";
- $newsApproval[0] = "";
- $lines = file( 'news.inc' );
- foreach ($lines as $line_num => $line)
- {
- $line = str_replace( "\r", "", $line );
- $line = str_replace( "\n", "", $line );
- $tmp = explode( "<", $line );
- try {
- $newsTitle[ count( $newsTitle ) ] = $tmp[ 0 ];
- $newsText[ count( $newsText ) ] = $tmp[ 1 ];
- $newsDate[ count( $newsDate ) ] = $tmp[ 2 ];
- $newsApproval[ count( $newsApproval ) ] = $tmp[ 3 ];
- } catch(Exception $e){}
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement