Need help fixing a very simple script.

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

Put them in 2 different forms and it should work, or reword the php to first detect the submit button (Need to give your submit button a name for that to work).

You could use radio buttons for the type, banned/ unbanned. Then use one textarea. But, instead of two if statements combine them.

well this is the index, this is everything involved in the whole folder. hmmm.

Sponsor our Newsletter | Privacy Policy | Terms of Service