swap-comics.php
58 lines
| 1.2 KiB
| text/x-php
|
XmlPhpLexer
| r1 | <?php | |||
| require_once('include/admin.inc.php'); | ||||
| auth_redirect(); // Require logged in user to access this page. | ||||
| if($_POST) | ||||
| { | ||||
| check_nonce('swap-strip'); | ||||
| r8 | ||||
| r1 | if(!is_numeric($_POST['comic_a']) || !is_numeric($_POST['comic_b'])) | |||
| mtdie('This tool only works on numeric strip numbers.'); | ||||
| $a = (int)$_POST['comic_a']; | ||||
| $b = (int)$_POST['comic_b']; | ||||
| $f = fopen(SITE_PATH_ABS.'/'.SITE_STRIP.'/'.SITE_STRIP_LOCK, 'w'); | ||||
| flock($f, LOCK_EX); | ||||
| r8 | ||||
| r1 | swap_strips( $a, $b ); | |||
| r8 | ||||
| r1 | close($f); | |||
| r8 | ||||
| r1 | $info.='<p>Strips $a and $b swapped successfully.</p>'; | |||
| adminlog("Strips $a and $b have been swapped.", MTS_STRIP, MTA_MODIFY); | ||||
| } | ||||
| adminhead('Swap Comics'); | ||||
| adminmenu('swap-comics.php'); | ||||
| ?> | ||||
| <h2>Swap Comics</h2> | ||||
| <form action="swap-comics.php" method="post" name="post" id="post"> | ||||
| <div id="poststuff"> | ||||
| <table class="editform" width="100%" cellspacing="2" cellpadding="5"> | ||||
| <tr> | ||||
| <th scope="row" width="33%">First Comic</th> | ||||
| <td width="66%"><input name="comic_a" type="text" id="comic_a" value="" /></th> | ||||
| </tr> | ||||
| <tr> | ||||
| <th scope="row" width="33%">Second Comic</th> | ||||
| <td width="66%"><input name="comic_b" type="text" id="comic_b" value="" /></th> | ||||
| </tr> | ||||
| </table> | ||||
| r8 | ||||
| r1 | <p class="submit"><input type="submit" value="Swap »" name="submit" /></p> | |||
| </div> | ||||
| </form> | ||||
| <?php adminfooter() ?> | ||||
