yes i agree with you ill do it
if ($action == "shoutannounce")
{
if (@count($_POST['id'])) {
$ids = implode(',', array_map('intval', $_POST['id']));
SQL_Query_exec("DELETE FROM `shoutannounce` WHERE `id` IN ($ids)");
}
show_error_msg("Success", "Announcement Removed.", 1);
}
stdhead("Shoutbox Announce");
navmenu();
begin_frame("Shoutbox Announce");
echo("<center>[<a href='admincp.php?action=shoutannouncecreate'>Create Announcement</a>]</center><br />");
$sql = SQL_Query_exec("SELECT * FROM `shoutannounce` ORDER BY `id` DESC");
if (mysql_num_rows($sql) > 0)
{
echo("<form method='post' action='admincp.php?action=shoutannounce'>");
echo("<table border='0' cellpadding='5' cellspacing='3' align='center' width='100%' class='table_table'>");
echo("<tr>");
echo("<td class='table_head'><strong>Title</strong></td>");
echo("<td class='table_head'><strong>Message</strong></td>");
echo("<td class='table_head'><strong>Added</strong></td>");
echo("<td class='table_head'><strong>Run at</strong></td>");
echo("<td class='table_head'><strong>Last Run</strong></td>");
echo("<td class='table_head'><strong>Enabled</strong></td>");
echo("<td class='table_head'><strong>Delete</strong></td>");
echo("</tr>");
while ($row = mysql_fetch_array($sql))
{
echo("<tr>");
echo("<td class='table_col1' align='center'><a href='admincp.php?action=shouteditannounce&id=" . $row['id'] . "'>" . htmlspecialchars($row['title']) . "</a></td>");
echo("<td class='table_col2' align='center'>" . format_comment($row['descr']) . "</td>");
echo("<td class='table_col1' align='center'>" . utc_to_tz($row['added']) . "</td>");
echo("<td class='table_col1' align='center'>" . $row['time'] . "</td>");
echo("<td class='table_col2' align='center'>" . utc_to_tz(date('Y-m-d H:i:s', $row['last_time'])) . "</td>");
echo("<td class='table_col1' align='center'>" . htmlspecialchars($row['active']) . "</td>");
echo("<td class='table_col2' align='center'><input type='checkbox' name='id[]' value='".$row['id']."'/></td>");
echo("</tr>");
}
echo("</table>");
echo("<div align='right'><input type='submit' value='Remove'/></div>");
echo("</form>");
}
else {
echo("<center>No Current announcements.</center>");
}
end_frame();
stdfoot();
}
if ($action == "shoutannouncecreate")
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if (empty($_POST['title']) || empty($_POST['descr']) || !is_valid_id($_POST['time']))
show_error_msg("Error", "Form not completed. <a href='admincp.php?action=shoutannouncecreate'>return</a>?", 1);
SQL_Query_exec("INSERT INTO `shoutannounce` (`title`, `descr`, `added`, `time`) VALUES (" . sqlesc($_POST['title']) . ", " . sqlesc($_POST['descr']) . ", " . sqlesc(get_date_time()) . ", " . sqlesc($_POST['time']) . ")");
show_error_msg("Success", "Announcement Created. <a href='admincp.php?action=shoutannounce'>return</a>?", 1);
}
stdhead("Create New Announcement");
navmenu();
begin_frame("Create New Announcement");
echo("<form name='shoutannouncecreate' method='post' action='admincp.php?action=shoutannouncecreate'>");
echo("<table border='0' cellpadding='5' cellspacing='0' align='center'>");
echo("<tr>");
echo("<th><strong>Title:</strong></td>");
echo("<th><input type='text' name='title' size='30' /></td>");
echo("</tr>");
echo("<tr>");
echo("<th><strong>Time:</strong></td>");
echo("<th><select name='time'><option value='1800'>30 Mins</option><option value='3600'>1 Hour</option></select></td>");
echo("</tr>");
echo("</table>");
require_once("backend/bbcode.php");
echo(textbbcode("shoutannouncecreate","descr","$descr"));
echo("<input type='reset' value='Reset' /><input type='submit' value='Submit' />");
echo("</form>");
end_frame();
stdfoot();
}
if ($action == 'shouteditannounce')
{
$id = isset($_GET['id']) ? $_GET['id'] : '';
if (!is_valid_id($id))
show_error_msg("Error", "Thats an Invalid ID O_o", 1);
$sql = SQL_Query_exec("SELECT * FROM `shoutannounce` WHERE `id` = $id");
$row = mysql_fetch_array($sql);
if (!$row)
show_error_msg("Error", "Invalid ID.", 1);
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if (empty($_POST['title']) || empty($_POST['descr']) || !is_valid_id($_POST['time']))
show_error_msg("Error", "Form not completed. <a href='admincp.php?action=shouteditannounce&id=$id'>return</a>?", 1);
SQL_Query_exec("UPDATE `shoutannounce` SET `title` = " . sqlesc($_POST['title']) . ", `descr` = " . sqlesc($_POST['descr']) . ", `time` = " . sqlesc($_POST['time']) . ", `active` = " . sqlesc($_POST['active']) . " WHERE `id` = $id");
show_error_msg("Success", "Announcement edited. <a href='admincp.php?action=shoutannounce'>return</a>?", 1);
}
stdhead("Edit Announcement");
navmenu();
begin_frame("Edit Announcement");
echo("<form name='shouteditcreate' method='post' action='admincp.php?action=shouteditannounce&id=$id'>");
echo("<table border='0' cellpadding='5' cellspacing='0' align='center'>");
echo("<tr>");
echo("<th><strong>Title:</strong></td>");
echo("<th><input type='text' name='title' size='30' value='" . htmlspecialchars($row['title']) . "' /></td>");
echo("</tr>");
echo("<tr>");
echo("<th><strong>Time:</strong></td>");
echo("<th><select name='time'><option value='1800' " . ($row['time'] == '1800' ? 'selected="selected"' : '' ). ">30 Mins</option><option value='3600' " . ($row['time'] == '3600' ? 'selected="selected"' : ''). ">1 Hour</option></select></td>");
echo("</tr>");
echo("<tr>");
echo("<th><strong>Enabled:</strong></td>");
echo("<th><select name='active'><option value='yes' " . ($row['active'] == 'yes' ? 'selected="selected"' : '' ). ">Yes</option><option value='no' " . ($row['active'] == 'no' ? 'selected="selected"' : ''). ">No</option></select></td>");
echo("</tr>");
echo("</table>");
require_once("backend/bbcode.php");
echo(textbbcode("shouteditcreate","descr", $row['descr']));
echo("<input type='reset' value='Reset' /><input type='submit' value='Submit' />");
echo("</form>");
end_frame();
stdfoot();
}
if ($action == "shoutannouncecreate")
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if (empty($_POST['title']) || empty($_POST['descr']) || !is_valid_id($_POST['time']))
show_error_msg("Error", "Form not completed. <a href='admincp.php?action=shoutannouncecreate'>return</a>?", 1);
SQL_Query_exec("INSERT INTO `shoutannounce` (`title`, `descr`, `added`, `time`) VALUES ('" . $_POST['title'] . "', '" . $_POST['descr'] . "', '" . get_date_time() . "', '" . $_POST['time'] . "')");
show_error_msg("Success", "Announcement Created. <a href='admincp.php?action=shoutannounce'>return</a>?", 1);
}
stdhead("Create New Announcement");
navmenu();
begin_frame("Create New Announcement");
echo("<form name='shoutannouncecreate' method='post' action='admincp.php?action=shoutannouncecreate'>");
echo("<table border='0' cellpadding='5' cellspacing='0' align='center'>");
echo("<tr>");
echo("<th><strong>Title:</strong></td>");
echo("<th><input type='text' name='title' size='30' /></td>");
echo("</tr>");
echo("<tr>");
echo("<th><strong>Time:</strong></td>");
echo("<th><select name='time'><option value='1800'>30 Mins</option><option value='3600'>1 Hour</option></select></td>");
echo("</tr>");
echo("</table>");
require_once("backend/bbcode.php");
echo(textbbcode("shoutannouncecreate","descr","$descr"));
echo("<input type='reset' value='Reset' /><input type='submit' value='Submit' />");
echo("</form>");
end_frame();
stdfoot();
}
if ($action == 'shouteditannounce')
{
$id = isset($_GET['id']) ? $_GET['id'] : '';
if (!is_valid_id($id))
show_error_msg("Error", "Thats an Invalid ID O_o", 1);
$sql = SQL_Query_exec("SELECT * FROM `shoutannounce` WHERE `id` = $id");
$row = mysql_fetch_array($sql);
if (!$row)
show_error_msg("Error", "Invalid ID.", 1);
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if (empty($_POST['title']) || empty($_POST['descr']) || !is_valid_id($_POST['time']))
show_error_msg("Error", "Form not completed. <a href='admincp.php?action=shouteditannounce&id=$id'>return</a>?", 1);
SQL_Query_exec("UPDATE `shoutannounce` SET `title` = '" . $_POST['title'] . "', `descr` = '" . $_POST['descr'] . "', `time` = '" . $_POST['time'] . "', `active` = '" . $_POST['active'] . "' WHERE `id` = $id");
show_error_msg("Success", "Announcement edited. <a href='admincp.php?action=shoutannounce'>return</a>?", 1);
}
stdhead("Edit Announcement");
navmenu();
begin_frame("Edit Announcement");
echo("<form name='shouteditcreate' method='post' action='admincp.php?action=shouteditannounce&id=$id'>");
echo("<table border='0' cellpadding='5' cellspacing='0' align='center'>");
echo("<tr>");
echo("<th><strong>Title:</strong></td>");
echo("<th><input type='text' name='title' size='30' value='" . htmlspecialchars($row['title']) . "' /></td>");
echo("</tr>");
echo("<tr>");
echo("<th><strong>Time:</strong></td>");
echo("<th><select name='time'><option value='1800' " . ($row['time'] == '1800' ? 'selected="selected"' : '' ). ">30 Mins</option><option value='3600' " . ($row['time'] == '3600' ? 'selected="selected"' : ''). ">1 Hour</option></select></td>");
echo("</tr>");
echo("<tr>");
echo("<th><strong>Enabled:</strong></td>");
echo("<th><select name='active'><option value='yes' " . ($row['active'] == 'yes' ? 'selected="selected"' : '' ). ">Yes</option><option value='no' " . ($row['active'] == 'no' ? 'selected="selected"' : ''). ">No</option></select></td>");
echo("</tr>");
echo("</table>");
require_once("backend/bbcode.php");
echo(textbbcode("shouteditcreate","descr", $row['descr']));
echo("<input type='reset' value='Reset' /><input type='submit' value='Submit' />");
echo("</form>");
end_frame();
stdfoot();
}
$query = SQL_Query_exec("SELECT `id`, `descr`, `time`, `last_time` FROM `shoutannounce` WHERE `active` = 'yes'");
while ($row = mysql_fetch_array($query)) {
if ($row['last_time'] + $row['time'] > gmtime())
continue;
SQL_Query_exec("INSERT INTO ajshoutbox (uid, date, name, text) VALUES(0,NOW(), 'System', '" . $row['descr'] . "')");
SQL_Query_exec("UPDATE `shoutannounce` SET `last_time` = '" . gmtime() . "' WHERE `id` = " . $row['id'] . "");
}
CREATE TABLE IF NOT EXISTS `shoutannounce` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(100) NOT NULL DEFAULT '',
`descr` text NOT NULL,
`added` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`active` enum('yes','no') NOT NULL DEFAULT 'yes',
`time` int(11) unsigned NOT NULL DEFAULT '0',
`last_time` int(11) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
$res = SQL_Query_exec("SHOW TABLES");
$query = SQL_Query_exec("SELECT `id`, `descr`, `time`, `last_time` FROM `shoutannounce` WHERE `active` = 'yes'");
while ($row = mysql_fetch_array($query)) {
if ($row['last_time'] + $row['time'] > gmtime())
continue;
SQL_Query_exec("INSERT INTO ajshoutbox (uid, date, name, text) VALUES(0,NOW(), '<font color=red >BoT</font>', " . sqlesc($row['descr']) . ")");
SQL_Query_exec("UPDATE `shoutannounce` SET `last_time` = '" . gmtime() . "' WHERE `id` = " . $row['id'] . "");
}
//SQL_Query_exec("OPTIMIZE TABLE `$table[0]`;");
}
}
?>
//shoutannonce
if ($action == "shoutannounce")
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if (empty($_POST['title']) || empty($_POST['descr']) || !is_valid_id($_POST['time']))
show_error_msg("Error", "Form not completed. <a href='admincp.php?action=shoutannounce'>return</a>?", 1);
SQL_Query_exec("INSERT INTO `shoutannounce` (`title`, `descr`, `added`, `time`) VALUES ('" . $_POST['title'] . "', '" . $_POST['descr'] . "', '" . get_date_time() . "', '" . $_POST['time'] . "')");
show_error_msg("Success", "Announcement Created. <a href='admincp.php?action=shoutannounce'>return</a>?", 1);
}
stdhead("Create New Announcement");
navmenu();
begin_frame("Create New Announcement");
echo("<form name='shoutannounce' method='post' action='admincp.php?action=shoutannounce'>");
echo("<table border='0' cellpadding='5' cellspacing='0' align='center'>");
echo("<tr>");
echo("<th><strong>Title:</strong></td>");
echo("<th><input type='text' name='title' size='30' /></td>");
echo("</tr>");
echo("<tr>");
echo("<th><strong>Time:</strong></td>");
echo("<th><select name='time'><option value='1800'>30 Mins</option><option value='3600'>1 Hour</option></select></td>");
echo("</tr>");
echo("</table>");
require_once("backend/bbcode.php");
echo(textbbcode("shoutannounce","descr","$descr"));
echo("<input type='reset' value='Reset' /><input type='submit' value='Submit' />");
echo("</form>");
end_frame();
stdfoot();
}
if ($action == 'shouteditannounce')
{
$id = isset($_GET['id']) ? $_GET['id'] : '';
if (!is_valid_id($id))
show_error_msg("Error", "Thats an Invalid ID O_o", 1);
$sql = SQL_Query_exec("SELECT * FROM `shoutannounce` WHERE `id` = $id");
$row = mysql_fetch_array($sql);
if (!$row)
show_error_msg("Error", "Invalid ID.", 1);
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if (empty($_POST['title']) || empty($_POST['descr']) || !is_valid_id($_POST['time']))
show_error_msg("Error", "Form not completed. <a href='admincp.php?action=shouteditannounce&id=$id'>return</a>?", 1);
SQL_Query_exec("UPDATE `shoutannounce` SET `title` = '" . $_POST['title'] . "', `descr` = '" . $_POST['descr'] . "', `time` = '" . $_POST['time'] . "', `active` = '" . $_POST['active'] . "' WHERE `id` = $id");
show_error_msg("Success", "Announcement edited. <a href='admincp.php?action=shoutannounce'>return</a>?", 1);
}
stdhead("Edit Announcement");
navmenu();
begin_frame("Edit Announcement");
echo("<form name='shouteditcreate' method='post' action='admincp.php?action=shouteditannounce&id=$id'>");
echo("<table border='0' cellpadding='5' cellspacing='0' align='center'>");
echo("<tr>");
echo("<th><strong>Title:</strong></td>");
echo("<th><input type='text' name='title' size='30' value='" . htmlspecialchars($row['title']) . "' /></td>");
echo("</tr>");
echo("<tr>");
echo("<th><strong>Time:</strong></td>");
echo("<th><select name='time'><option value='1800' " . ($row['time'] == '1800' ? 'selected="selected"' : '' ). ">30 Mins</option><option value='3600' " . ($row['time'] == '3600' ? 'selected="selected"' : ''). ">1 Hour</option></select></td>");
echo("</tr>");
echo("<tr>");
echo("<th><strong>Enabled:</strong></td>");
echo("<th><select name='active'><option value='yes' " . ($row['active'] == 'yes' ? 'selected="selected"' : '' ). ">Yes</option><option value='no' " . ($row['active'] == 'no' ? 'selected="selected"' : ''). ">No</option></select></td>");
echo("</tr>");
echo("</table>");
require_once("backend/bbcode.php");
echo(textbbcode("shouteditcreate","descr", $row['descr']));
echo("<input type='reset' value='Reset' /><input type='submit' value='Submit' />");
echo("</form>");
end_frame();
stdfoot();
}
//End shoutannonce
<td align="center"><a href="admincp.php?action=shoutannounce"><img src="images/admin/blocked.gif" border="0" width="32" height="32"><br />Shoutbox Announce<br /></a></td>
No users online
Torrents
Members
Online