I am making an easier way for my admins to ban and unban people for our gaming server using the website restricted by ips using .htaccess. The restriction is working fine. How the script works is it simply edits two different text files located in the directory. We got it working with one text field, but our second text field does not work, when you try to add or edit and submit it does not save. it is the $unbanned_file that is not working.
[php]
<?php // configuration $url = 'exampleurl'; $file = '/var/www/banlist/banlist.txt'; $unbanned_file = '/var/www/banlist/unbanned.txt'; // check if form has been submitted if (isset($_POST['text'])) { // save the text contents file_put_contents($file, $_POST['text']); // redirect to form again header(sprintf('Location: %s', $url)); printf('Moved.', htmlspecialchars($url)); exit(); } if (isset($_POST['unbanned'])) { // save the text contents file_put_contents($unbanned_file, $_POST['unbanned']); // redirect to form again header(sprintf('Location: %s', $url)); printf('Moved.', htmlspecialchars($url)); exit(); } // read the textfile $text = file_get_contents($file); $unbanned = file_get_contents($unbanned_file); ?>Avalon Ban List
<?php echo htmlspecialchars($text) ?>
Unbanned List
<?php echo htmlspecialchars($unbanned) ?>
[/php]
I am new and learning, but mostly this code was copied from google and edited to suite. ( just to clarify my level of experience )
Thanks xD