break; case 22: deletePage($link_id); if (!isset($start)) { $start = 1; } if (!isset($filter)) { $filter = ""; } if (!isset($per_page)) { $per_page = 10; } browsePages($site_id, $start, $filter, $per_page); break; case 23: clearLog(); break; case 24: // log-out the current Admin session_destroy(); exit('<meta http-equiv="refresh" content="0; url=admin.php"/>'); break; case 25: clearBestPage(); break; case 26: cleanMediaLink(); break; case 28: // show menu 'Sites awaiting approval' approve_newsites();
<?php echo "Clear Stat Logs:<hr>"; function clearLog($file) { $fh = fopen($file, 'w') or die("can't open file"); fwrite($fh, ""); fclose($fh); } clearLog("location.txt"); clearLog("browsers.txt"); clearLog("platform.txt"); clearLog("screen.txt"); clearLog("date.txt"); clearLog("ipAddress.txt"); clearLog("visitLength.txt"); $fhe = fopen("visitCount.txt", 'w') or die("can't open file"); fwrite($fhe, "1"); fclose($fhe);
public function testWhenLogIsClearedThenFileShouldBeEmpty() { file_put_contents($this->testLog, 'irrelevant existing content'); clearLog($this->testLog); $this->assertLogContains(emptyString()); }
irc("/op {$doto}"); redirect(); } } elseif ($umaction == "startlog") { if ($XUSER['LEVEL'] == 3 || $XUSER['LEVEL'] == 4 || $XUSER['LEVEL'] == 5) { DoQuery("UPDATE {$SERVER['TBL_PREFIX']}rooms SET encrypted='1' WHERE name='{$ROOMS['IN_ROOM_NAME']}'"); redirect(); } } elseif ($umaction == "stoplog") { if ($XUSER['LEVEL'] == 3 || $XUSER['LEVEL'] == 4 || $XUSER['LEVEL'] == 5) { DoQuery("UPDATE {$SERVER['TBL_PREFIX']}rooms SET encrypted='0' WHERE name='{$ROOMS['IN_ROOM_NAME']}'"); redirect(); } } elseif ($umaction == "clearlog") { if ($XUSER['LEVEL'] == 3 || $XUSER['LEVEL'] == 4 || $XUSER['LEVEL'] == 5) { clearLog($ROOMS['IN_ROOM_NAME']); redirect(); } } elseif ($umaction == "top") { if ($XUSER['LEVEL'] == 3 || $XUSER['LEVEL'] == 4 || $XUSER['LEVEL'] == 5) { irc("/deop {$doto}"); redirect(); } } elseif ($umaction == "invite") { echo "inviting {$doto}"; ?> <script language="javascript" type="text/javascript"> alert("Inviting"); </script> <?php }
function processCommand($cmdString) { if (substr($cmdString, 0, 1) != '/') return false; $firstSpace = strpos($cmdString, ' '); if ($firstSpace) { $command = substr($cmdString, 1, $firstSpace - 1); $args = substr($cmdString, $firstSpace + 1); $args = trim($args); if ($args == '') unset($args); else $args = explode(' ', $args); } else { $command = substr($cmdString, 1); } switch($command) { case 'help': if (isset($args)) showHelp($args[0]); else showHelp('help'); break; case 'login': if (isset($args)) if (login(md5($args[0]))) sysShout('Logged in! <a href="javascript:window.location.reload()">Refresh</a> this browser window to view information about shouts that were made before you logged in.'); else sysShout('Login failed.'); break; case 'logout': if (logout()) sysShout('Logged out.'); else sysShout('Logout failed.'); break; case 'ban': if (isset($args)) { if (ban($args[0])) sysShout('Banned ' . formatString($args[0]) . '.'); else sysShout('Couldn\'t ban ' . formatString($args[0]) . '.'); } break; case 'unban': if (isset($args)) { if (unban($args[0])) sysShout('Unbanned ' . formatString($args[0]) . '.'); else sysShout('Couldn\'t unban ' . formatString($args[0]) . '.'); } break; case 'bans': listBans(); break; case 'clearbans': if (clearBans()) sysShout('Bans cleared.'); else sysShout('Couldn\'t clear bans.'); break; case 'clear': if (clearLog()) sysShout('All shouts cleared; <a href="javascript:window.location.reload()">refresh</a> your browser window.'); else sysShout('Couldn\'t clear the chat.'); break; } return true; }