<?PHP
////////////////////////////////////////
/////////// jendri@o2.pl ///////////////
/////// Create by Jensej and ///////////
///////Pitufo edited by Klon52. ////////
/////////// klon52@o2.pl ///////////////
////////////////////////////////////////
/// SQL
/// CREATE TABLE IF NOT EXISTS `messages` (`id` int(11) NOT NULL auto_increment,`msg` varchar(255) NOT NULL,`type` varchar(255) NOT NULL,`time` varchar(255) NOT NULL,`delete_it` int(2) NOT NULL default '1',PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=48 ;
/// LUA Globalevents 'broadcast.lua'
////////////////////////////////////////////////////////////////////////////////////////
// function onThink(interval, lastExecution)
// local result_plr = db.getResult("SELECT * FROM messages WHERE `delete_it` = 1;")
// if(result_plr:getID() ~= -1) then
// while(true) do
// id = tonumber(result_plr:getDataInt("id"))
// msg = tostring(result_plr:getDataString("msg"))
// class = tonumber(result_plr:getDataInt("type"))
// doBroadcastMessage(msg, class)
// db.executeQuery("DELETE FROM `messages` WHERE `id` = " .. id .. ";")
//
// if not(result_plr:next()) then
// break
// end
// end
// result_plr:free()
// end
// return TRUE
// end
/////////////////////////////////////////////////////////////////////////////////////////
///in globalevents.xml paste this : <globalevent name="broadcast" interval="5" event="script" value="broadcast.lua"/>
if($group_id_of_acc_logged >= $config['site']['access_admin_panel'])
{
if($action == "")
{
$main_content .= '<h3><center><Wellcome in Admin Panel.</center></h3>';
$main_content .= '<table bgcolor='.$config['site']['vdarkborder'].' border=0 cellpadding=5 cellspacing=1 width=100%>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>Select Function:</center></TD></tr>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Edit Player</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=player">Select</a></td>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Edit Account</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=acc">Select</a></td></tr>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>SMS Shop:</center></TD></tr>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Add Points</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=points">Select</a></td>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Add new Product in Shop</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=addnew&offer_type=item">Select</a></td></tr>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>Other Function:</center></TD></tr>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Namelock management</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=namelock">Select</a></td>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Mass Mail Sender</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=massmail">Select</a></td>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Broadcast</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=broadcast">Select</a></td>
</tr>
</table>';
}
if($action == "broadcast")
{
$main_content .= '<h3><center><Wellcome in Admin Panel.</center></h3>';
$main_content .= '<table bgcolor='.$config['site']['vdarkborder'].' border=0 cellpadding=5 cellspacing=1 width=100%>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>Select Function:</center></TD></tr>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Edit Player</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=player">Select</a></td>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Edit Account</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=acc">Select</a></td></tr>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>SMS Shop:</center></TD></tr>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Add Points</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=points">Select</a></td>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Add new Product in Shop</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=addnew&offer_type=item">Select</a></td></tr>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>Other Function:</center></TD></tr>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Namelock management</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=namelock">Select</a></td>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Mass Mail Sender</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=massmail">Select</a></td>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Broadcast</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=broadcast">Select</a></td>
</tr>
</table><br><br>';
// Broadcast system by Pitufo \\
$type = $_REQUEST['type'];
if(empty($type) AND (empty($msg)))
{
$main_content .= '<FORM METHOD=post>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<TR BGCOLOR='. $config['site']['vdarkborder'] .'><TD COLSPAN=4 CLASS="blue" ><B><center>Broadcast</center></B></TD></TR>
<TR BGCOLOR='. $config['site']['lightborder'] .'><TD WIDTH=25%><B>Message</B></TD><TD WIDTH=25%><B>Message Type</B></TD></TR>
<TR BGCOLOR='. $config['site']['darkborder'] .'>
<TD VALIGN=top ROWSPAN=2>
Message: <INPUT TYPE=text NAME="msg" MAXLENGTH="50" Value="1"><BR>
</TD><TD VALIGN=top>
<INPUT TYPE=radio NAME="type" VALUE="20"> <IMG SRC="/images/broadcast/20.png">(20)<BR>
<INPUT TYPE=radio NAME="type" VALUE="21" CHECKED> <IMG SRC="/images/broadcast/21.png">(21)<BR>
<INPUT TYPE=radio NAME="type" VALUE="22"> <IMG SRC="/images/broadcast/22.png">(22)<BR>
<INPUT TYPE=radio NAME="type" VALUE="23"> <IMG SRC="/images/broadcast/23.png">(23)<BR>
<INPUT TYPE=radio NAME="type" VALUE="25"> <IMG SRC="/images/broadcast/25.png">(25)<BR>
</TD></TR>
</TABLE>
<BR>
<CENTER>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD>
<INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="http://static.tibia.com/images/global/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18>
</TD></TR></FORM></TABLE>
</CENTER>';
}
else
{
$msg_received_text .= '<tr bgcolor='. $config['site']['darkborder'] .'><td>'.$msg.'</font></td><td>';$msg_received_text .= '<i>'.$type.'</i>';
$msg_received_text .= '<td>'.date("j F Y, H:i:s", time()).'</td>
</tr>';
if(!empty($msg_received_text))
{
$main_content .= '<h2>Message</h2><table cellpadding="4" cellspacing="1" width="650"><tr bgcolor="#F1E0C6"><td><b>Message:</b></td><td><b>Type:</b></td><td><b>Time:</b></td></tr>'.$msg_received_text.'</table><br />';
}
$sql = 'INSERT INTO '.$SQL->tableName('messages').' (id, msg, type, time, delete_it) VALUES (NULL, "'.$msg.'", '.$type.', '.$SQL->quote(time()).', \'1\');';
$SQL->query($sql);
$main_content .= '<a href="?subtopic=adminpanel"><font size="2"><b>Go Back</b></font></a>';
}
}
if($action == "massmail")
{
$main_content .= '<h3><center><Wellcome in Admin Panel.</center></h3>';
$main_content .= '<table bgcolor='.$config['site']['vdarkborder'].' border=0 cellpadding=5 cellspacing=1 width=100%>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>Select Function:</center></TD></tr>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Edit Player</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=player">Select</a></td>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Edit Account</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=acc">Select</a></td></tr>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>SMS Shop:</center></TD></tr>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Add Points</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=points">Select</a></td>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Add new Product in Shop</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=addnew&offer_type=item">Select</a></td></tr>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>Other Function:</center></TD></tr>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Namelock management</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=namelock">Select</a></td>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Mass Mail Sender</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=massmail">Select</a></td>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Broadcast</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=broadcast">Select</a></td>
</tr>
</table><br><br>';
//Mass Mail by Gesior
$email = $SQL->query('SELECT * FROM '.$SQL->tableName('accounts').' WHERE email != "";');
$mail_content = stripslashes(trim($_POST['mail_content']));
$subject = stripslashes(ucwords(strtolower(trim($_REQUEST['subject']))));
if(empty($mail_content))
{
$main_content .= '<form action="" method="post"><b>Subject Title:</b><input type="textbox" name="subject"><br>
<b>Mail Content:</b><textarea name="mail_content" rows="3" cols="45"></textarea><br><input type="submit" value="Send emails">
</form>';
}
else
{
require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
foreach($email as $emails)
{
if ($config['site']['smtp_enabled'] == "yes")
{
$mail->IsSMTP();
$mail->Host = $config['site']['smtp_host'];
$mail->Port = (int)$config['site']['smtp_port'];
$mail->SMTPAuth = ($config['site']['smtp_auth'] ? true : false);
$mail->Username = $config['site']['smtp_user'];
$mail->Password = $config['site']['smtp_pass'];
}
else
$mail->IsMail();
$mail->IsHTML(true);
$mail->From = $config['site']['mail_address'];
$mail->AddAddress($emails['email']);
$mail->Subject = $subject;
$mail->Body = $mail_content;
}
if($mail->Send())
{
$main_content .= '<br />Mass emails has been sent.<br>
<a href="?subtopic=adminpanel"><center><b>BACK<b></center></a>';
}
else
{
$main_content .= '<br />An error occorred while sending email! Try again or contact with admin.<br>
<a href="?subtopic=adminpanel"><b><center>BACK</center><b></a>';
}
}
}
if($action == "namelock")
{
$main_content .= '<h3><center><Wellcome in Admin Panel.</center></h3>';
$main_content .= '<table bgcolor='.$config['site']['vdarkborder'].' border=0 cellpadding=5 cellspacing=1 width=100%>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>Select Function:</center></TD></tr>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Edit Player</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=player">Select</a></td>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Edit Account</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=acc">Select</a></td></tr>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>SMS Shop:</center></TD></tr>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Add Points</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=points">Select</a></td>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Add new Product in Shop</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=addnew&offer_type=item">Select</a></td></tr>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>Other Function:</center></TD></tr>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Namelock management</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=namelock">Select</a></td>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Mass Mail Sender</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=massmail">Select</a></td>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Broadcast</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=broadcast">Select</a></td>
</tr>
</table><br><br>';
//Namelock by Gesior.
$name = $_GET['name'];
$name_new = $_GET['name_new'];
$player = new OTS_Player();
$player->find($name);
if($player->isLoaded() && $player->isNameLocked())
{
if($name_new == $player->getOldName())
{
if($action == 'nameaccept')
{
$main_content .= '<font color="green">Changed name from <b>'.$player->getName().'</b> to <b>'.$player->getOldName().'</b>.</font>';
$player->setCustomField('old_name', $player->getName());
$player->setCustomField('name', $player->getOldName());
$player->setCustomField('nick_verify', 1);
$player->removeNameLock();
}
elseif($action == 'namereject')
{
$main_content .= '<font color="green">Rejected proposition of change name from <b>'.$player->getName().'</b> to <b>'.$player->getOldName().'</b>.</font>';
$player->setCustomField('old_name', '');
}
}
else
$main_content .= '<font color="red">Invalid new name. Try again.</font><br>';
}
else
$main_content .= '<h2>First 50 namelocked players</h2>';
$main_content .= '<table><tr bgcolor="'.$config['site']['vdarkborder'].'"><td><font color="white"><b>- New nick proposition -</b></font></td><td><font color="white"><b>- ACCEPT -</b></font></td><td><font color="white"><b>- REJECT -</b></font></td></tr>';
$number_of_rows = 1;
$players_info = $SQL->query("SELECT `players`.`name`, `players`.`old_name` AS `name_new` FROM `bans`, `players` WHERE `players`.`old_name` != '' AND `bans`.`value` = `players`.`id` AND `bans`.`active` = 1");
$players = array();
foreach($players_info->fetchAll() as $player)
{
if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
$main_content .= '<tr bgcolor="'.$bgcolor.'"><td>'.$player['name_new'].'</td><td><a href="?subtopic=adminpanel&action=nameaccept&name='.urlencode($player['name']).'&name_new='.urlencode($player['name_new']).'"><font color="green">Accept</font></a></td><td><a href="?subtopic=adminpanel&action=namereject&name='.urlencode($player['name']).'&name_new='.urlencode($player['name_new']).'"><font color="red">Reject</font></a><td></tr>';
}
$main_content .= '</TABLE>';
}
if($action == "points")
{
$main_content .= '<h3><center><Wellcome in Admin Panel.</center></h3>';
$main_content .= '<table bgcolor='.$config['site']['vdarkborder'].' border=0 cellpadding=5 cellspacing=1 width=100%>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>Select Function:</center></TD></tr>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Edit Player</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=player">Select</a></td>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Edit Account</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=acc">Select</a></td></tr>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>SMS Shop:</center></TD></tr>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Add Points</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=points">Select</a></td>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Add new Product in Shop</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=addnew&offer_type=item">Select</a></td></tr>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>Other Function:</center></TD></tr>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Namelock management</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=namelock">Select</a></td>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Mass Mail Sender</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=massmail">Select</a></td>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Broadcast</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=broadcast">Select</a></td>
</tr>
</table><br><br>';
//Add Points by Gesior.
$player = stripslashes(ucwords(strtolower(trim($_REQUEST['character']))));
$points = $_POST['points'];
if(empty($player))
{
$main_content .= '<form action="" method="post"><B>Enter Character Name:</B><input type="textbox" name="character"><br>
<B>Enter Points Amount:</B><input type="textbox" name="points"><br><input type="submit" value="Submit">
</form></center><form action="?subtopic=adminpanel&action=points" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form>';
}
else
{
$player_data = $SQL->query("SELECT * FROM `players` WHERE `name` = '".$player."';")->fetch();
$SQL->query("UPDATE `accounts` SET `premium_points` = `premium_points` + '".$points."' WHERE `id` = '".$player_data['account_id']."'");
$main_content .= '<b><center>'.$points.' Premium Points added to the account of <i>'.$player.'</i> !</b></center><br>
<form action="?subtopic=adminpanel&action=points" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form>';
}
}
if($action == "addnew")
{
$main_content .= '<h3><center><Wellcome in Admin Panel.</center></h3>';
$main_content .= '<table bgcolor='.$config['site']['vdarkborder'].' border=0 cellpadding=5 cellspacing=1 width=100%>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>Select Function:</center></TD></tr>
<tr bgcolor='. $config['site']['lightborder'] .'><TD COLSPAN=2 ><b><center><h3>Player must be offline !</h3></center></TD></tr>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Edit Player</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=player">Select</a></td>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Edit Account</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=acc">Select</a></td></tr>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>SMS Shop:</center></TD></tr>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Add Points</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=points">Select</a></td>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Add new Product in Shop</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=addnew&offer_type=item">Select</a></td></tr>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>Other Function:</center></TD></tr>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Namelock management</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=namelock">Select</a></td>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Mass Mail Sender</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=massmail">Select</a></td>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Broadcast</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=broadcast">Select</a></td>
</tr>
</table><br><br>';
//Add new item by Gesior.
if($_REQUEST['offer_type'])
{
$shop_points = stripslashes(ucwords(strtolower(trim($_REQUEST['shop_points']))));
$shop_offer_type = stripslashes(trim($_REQUEST['offer_type']));
if(empty($shop_points))
{
$main_content .= '<table border="0"><tr><td align="center"><b>Select offer type:</b></td><td><table border="0" ><tr bgcolor="'.$config['site']['vdarkborder'].'">
<td><font color="white">Item</td><td><font color="white">Container</td><td><font color="white">Pacc</td><td><font color="white">Redskull</td><td><font color="white">Unban</td><td><font color="white">Changename</td></tr>
<tr bgcolor="'.$config['site']['darkborder'].'">
<td align="center"><a href="?subtopic=adminpanel&action=addnew&offer_type=item"><input type="radio" name="offer_type" value="item"></a></td>
<td align="center"><a href="?subtopic=adminpanel&action=addnew&offer_type=container"><input type="radio" name="offer_type" value="container" ></a></td>
<td align="center"><a href="?subtopic=adminpanel&action=addnew&offer_type=pacc"><input type="radio" name="offer_type" value="pacc" ></a></td>
<td align="center"><a href="?subtopic=adminpanel&action=addnew&offer_type=redskull"><input type="radio" name="offer_type" value="redskull" ></a></td>
<td align="center"><a href="?subtopic=adminpanel&action=addnew&offer_type=unban"><input type="radio" name="offer_type" value="unban" ></a></td>
<td align="center"><a href="?subtopic=adminpanel&action=addnew&offer_type=changename"><input type="radio" name="offer_type" value="changename" ></a></td>
</tr></table></td></tr>';
$main_content .= '<form action="?subtopic=adminpanel&action=addnew&offer_type='.$shop_offer_type.'&check" method="post" ><table border="0"><tr><td align="center" ><b>Points:</b></td>
<td><input type="textbox" name="shop_points" maxlenght="7" style="width: 70px"></td></tr>';
if($_REQUEST['offer_type'] == 'container')
{
$main_content .= '<tr><td align="center" ><b>Container ID:</b></td>
<td><input type="text" name="shop_itemid1" maxlenght="7" style="width: 70px" ></td></tr>
<tr><td align="center" ><b>Count Container:</b></td>
<td><input type="text" name="shop_count1" maxlenght="7" style="width: 70px" ></td></tr>
<tr><td align="center" ><b>Item ID:</b></td>
<td><input type="text" name="shop_itemid2" maxlenght="7" style="width: 70px" ></td></tr>
<tr><td align="center" ><b>Count Item:</b></td>
<td><input type="text" name="shop_count2" maxlenght="7" style="width: 70px" ></td></tr>';
}
if($_REQUEST['offer_type'] == 'item')
{
$main_content .= '<tr><td align="center"><b>Item ID:</b></td>
<td><input type="text" name="shop_itemid1" maxlenght="7" style="width: 70px" ></td></tr>
<tr><td align="center"><b>Item Count:</b></td>
<td><input type="text" name="shop_count1" maxlenght="7" style="width: 70px" ></td></tr>';
}
if($_REQUEST['offer_type'] == 'pacc')
{
$main_content .= '<tr><td align="center" ><b>Days:</b></td>
<td><input type="text" name="shop_count1" maxlenght="7" style="width: 70px" ></td></tr>';
}
$main_content .= '<tr><td align="center" ><b>Offer Description:</b></td>
<td ><textarea name="shop_offer_description" rows="2" cols="35"></textarea></td></tr>
<tr><td align="center" ><b>Offer Name:</b></td>
<td><input type="text" name="shop_offer_name" maxlenght="40" style="width: 200px" ></td></tr>
<tr><td><input name="submit" type="submit" value="Submit" /></form></td><td>
<form action="?subtopic=adminpanel&action=addnew&offer_type=container" method="post" >
<input name="submit" type="submit" value="Reset" /></form></td></tr></table>';
$main_content .= '<form action="?subtopic=adminpanel&action=addnew" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form>';
}
else
{
$shop_points = stripslashes(trim($_POST['shop_points']));
$shop_offer_type = stripslashes(trim($_REQUEST['offer_type']));
$shop_itemid1 = stripslashes(trim($_POST['shop_itemid1']));
$shop_count1 = stripslashes(trim($_POST['shop_count1']));
$shop_itemid2 = stripslashes(trim($_POST['shop_itemid2']));
$shop_count2 = stripslashes(trim($_POST['shop_count2']));
$shop_offer_description = stripslashes(trim($_POST['shop_offer_description']));
$shop_offer_name = stripslashes(trim($_POST['shop_offer_name']));
$SQL->query('INSERT INTO `z_shop_offer` (id, points, itemid1, count1, itemid2, count2, offer_type, offer_description, offer_name, pid) VALUES (NULL, '.$SQL->quote($shop_points).', '.$SQL->quote($shop_itemid1).', '.$SQL->quote($shop_count1).', '.$SQL->quote($shop_itemid2).', '.$SQL->quote($shop_count2).', '.$SQL->quote($shop_offer_type).', '.$SQL->quote($shop_offer_description).', '.$SQL->quote($shop_offer_name).', 0)');
$main_content .= '<center><h2><font color="red">Added to Shop:</font></h2></center><hr/>
<tr><td align="center" ><b>Points:</b></td>
<td>'.$shop_points.'</td></tr><br>';
if($shop_offer_type == 'container')
{
$main_content .= '<tr><td align="center" ><b>Container ID:</b></td>
<td>'.$shop_itemid1.'</td></tr><br>
<tr><td align="center" ><b>Count Container:</b></td>
<td>'.$shop_count1.'</td></tr><br>
<tr><td align="center" ><b> Item ID (in Container):</b></td>
<td>'.$shop_itemid2.'</td></tr><br>
<tr><td align="center" ><b>Count Item (in Container):</b></td>
<td>'.$shop_count2.'</td></tr><br>';
}
if ($shop_offer_type == 'item')
{
$main_content .= '<tr><td align="center" ><b>Item ID:</b></td>
<td>'.$shop_itemid1.'</td></tr><br>
<tr><td align="center" ><b>Count Item:</b></td>
<td>'.$shop_count1.'</td></tr><br>'; }
if ($shop_offer_type == 'pacc')
{
$main_content .= '<tr><td align="center" ><b>Days:</b></td>
<td>'.$shop_count1.'</td></tr><br>'; }
$main_content .= '<tr><td align="center" ><b>Offer Type:</b></td>
<td>'.$shop_offer_type.'</td></tr><br>
<tr><td align="center" ><b>Offer Description:</b></td>
<td>'.$shop_offer_description.'</td></tr><br>
<tr><td align="center" ><b>Offer Name:</b></td>
<td>'.$shop_offer_name.'</td></tr>
<br><form action="?subtopic=adminpanel&action=addnew&offer_type=item" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form>';
}
}
}
if($action == "player")
{
$main_content .= '<h3><center><Wellcome in Admin Panel.</center></h3>';
$main_content .= '<table bgcolor='.$config['site']['vdarkborder'].' border=0 cellpadding=5 cellspacing=1 width=100%>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>Select Function:</center></TD></tr>
<tr bgcolor='. $config['site']['lightborder'] .'><TD COLSPAN=2 ><b><center><h3>Player must be offline !</h3></center></TD></tr>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Change Name</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=player&type=name">Select</a></td>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Change Experience</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=player&type=exp">Select</a></td>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Change Level</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=player&type=lvl">Select</a></td>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Change Group ID</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=player&type=pos">Select</a></td>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Change Others</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=player&type=others">Select</a></td>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Delete Player</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=player&type=del">Select</a></td>
</tr>
</table><br><br>';
//player name
if($_REQUEST['type'] == 'name')
{
$main_content .= '<form action="?subtopic=adminpanel&action=player&type=name" method="post">
New Player Name <input type="text" name="newname"><br>
Old Player Name <input type="text" name="name0"><br>
<input type="submit" value="OK" name="okname"></form>';
$main_content .= '<br><center><a href="?subtopic=adminpanel">BACK TO MAIN ADMIN PANEL</a></center>';
if (isset($_POST['okname']))
{
if(empty($_POST['newname']))
{
$main_content .= '<h3><b><font color="red">You must enter New Player Name.</font></b></h3>';
}
elseif(empty($_POST['name0']))
{
$main_content .= '<h3><b><font color="red">You must enter Old Player Name.</font></b></h3>';
}
else
$SQL->query("UPDATE `players` SET `name` = ".$SQL->quote( $_POST['newname'] )." WHERE name = ".$SQL->quote( $_POST['name0'] ).";");
$main_content .= 'Player name has been changed.';
}
}
if($_REQUEST['type'] == 'exp')
{
$main_content .= '<form action="?subtopic=admin&action=player&type=exp" method="post">
Add experience <input type="text" name="exp"> (only numbers)<br>
Player Name <input type="text" name="nameexp"><br>
<input type="submit" value="OK" name="okexp"></form>';
$main_content .= '<br><center><a href="?subtopic=adminpanel">BACK TO MAIN ADMIN PANEL</a></center>';
if (isset($_POST['okexp']))
{
if(empty($_POST['exp']))
{
$main_content .= '<h3><b><font color="red">You must enter Experience.</font></b></h3>';
}
elseif(empty($_POST['nameexp']))
{
$main_content .= '<h3><b><font color="red">You must enter Player Name.</font></b></h3>';
}
else
$SQL->query("UPDATE `players` SET experience = experience + ".$SQL->quote( $_POST['exp'] )." WHERE name = ".$SQL->quote( $_POST['nameexp'] ).";");
$main_content .= 'Experience has been added.';
}
}
if($_REQUEST['type'] == 'lvl')
{
$main_content .= '<form action="?subtopic=adminpanel&action=player&type=lvl" method="post">
Set player level <input type="text" name="level"> (only numbers)<br>
Player Name <input type="text" name="namelvl"><br>
<input type="submit" value="OK" name="oklvl"></form>';
$main_content .= '<br><center><a href="?subtopic=adminpanel">BACK TO MAIN ADMIN PANEL</a></center>';
if (isset($_POST['oklvl']))
{
if(empty($_POST['level']))
{
$main_content .= '<h3><b><font color="red">You must enter Player Level.</font></b></h3>';
}
elseif(empty($_POST['namelvl']))
{
$main_content .= '<h3><b><font color="red">You must enter Player Name.</font></b></h3>';
}
else
$SQL->query("UPDATE `players` SET level = ".$SQL->quote( $_POST['level'] )." WHERE name = ".$SQL->quote( $_POST['namelvl'] ).";");
$main_content .= 'Level has been set.';
}
}
if($_REQUEST['type'] == 'pos')
{
$main_content .= '<form action="?subtopic=admin&action=player&type=pos" method="post">
Group ID <input type="text" name="newpos"><i>example(1-player,2-tutor,3-senior tutor,4-gamemaster,5-community manager,6-god)</i><br>
Player Name <input type="text" name="namepos"><br>
<input type="submit" value="OK" name="okpos"></form>';
$main_content .= '<br><center><a href="?subtopic=adminpanel">BACK TO MAIN ADMIN PANEL</a></center>';
if (isset($_POST['okpos']))
{
if(empty($_POST['newpos']))
{
$main_content .= '<h3><b><font color="red">You must enter Player New Group ID.</font></b></h3>';
}
if(empty($_POST['namepos']))
{
$main_content .= '<h3><b><font color="red">You must enter Player Name.</font></b></h3>';
}
else
$SQL->query("UPDATE `players` SET group_id = ".$SQL->quote( $_POST['newpos'] )." WHERE name = ".$SQL->quote( $_POST['name9'] ).";");
$main_content .= 'Player group id has been changed.';
}
}
if($_REQUEST['type'] == 'others')
{
$main_content .= '<form action="?subtopic=adminpanel&action=player&type=others" method="post">
Health <input type="text" name="health"> (only numbers)<br>
Mana <input type="text" name="mana"> (only numbers)<br>
Cap <input type="text" name="cap"> (only numbers)<br>
MagLevel <input type="text" name="maglevel"> (only numbers)<br>
Player Name <input type="text" name="nameothers"><br>
<input type="submit" value="OK" name="okothers"></form>';
$main_content .= '<br><center><a href="?subtopic=adminpanel">BACK TO MAIN ADMIN PANEL</a></center>';
if (isset($_POST['okothers']))
{
if(empty($_POST['health']))
{
$main_content .= '<h3><b><font color="red">You must enter Player health.</font></b></h3>';
}
if(empty($_POST['mana']))
{
$main_content .= '<h3><b><font color="red">You must enter Player mana.</font></b></h3>';
}
if(empty($_POST['cap']))
{
$main_content .= '<h3><b><font color="red">You must enter Player capacity.</font></b></h3>';
}
if(empty($_POST['maglevel']))
{
$main_content .= '<h3><b><font color="red">You must enter Player magic level.</font></b></h3>';
}
if(empty($_POST['nameothers']))
{
$main_content .= '<h3><b><font color="red">You must enter Player Name.</font></b></h3>';
}
else
$SQL->query("UPDATE `players` SET health=".$SQL->quote( $_POST['health'] ).",healthmax=".$SQL->quote( $_POST['health'] ).",mana=".$SQL->quote( $_POST['mana'] ).",manamax=".$SQL->quote( $_POST['mana'] ).",cap=".$SQL->quote( $_POST['cap'] ).",maglevel=".$SQL->quote( $_POST['maglevel'] )." WHERE name = ".$SQL->quote( $_POST['nameothers'] ).";");
$main_content .= 'Informations has been changed.';
}
}
if($_REQUEST['type'] == 'del')
{
$main_content .= '<form action="?subtopic=adminpanel&action=player&type=del" method="post">
Player Name <input type="text" name="namedel"><br>
<b>ARE YOU SURE?</b> <input type="submit" value="YES" name="okdel"></form>';
$main_content .= '<br><center><a href="?subtopic=adminpanel">BACK TO MAIN ADMIN PANEL</a></center>';
if (isset($_POST['okothers']))
{
if(empty($_POST['namedel']))
{
$main_content .= '<h3><b><font color="red">You must enter Player Name.</font></b></h3>';
}
else
$SQL->query("DELETE from `players` WHERE name = ".$SQL->quote( $_POST['name4'] ).";");
$main_content .= 'Character has beed deleted.';
}
}
}
if($action == "acc")
{
$main_content .= '<h3><center><Wellcome in Admin Panel.</center></h3>';
$main_content .= '<table bgcolor='.$config['site']['vdarkborder'].' border=0 cellpadding=5 cellspacing=1 width=100%>
<tr bgcolor='. $config['site']['vdarkborder'] .'><TD COLSPAN=2 ><b><center>Select Function:</center></TD></tr>
<tr bgcolor='. $config['site']['lightborder'] .'><TD COLSPAN=2 ><b><center><h3>Player must be offline !</h3></center></TD></tr>
<tr bgcolor='. $config['site']['darkborder'] .'><td Align="center" WIDTH=50%>Change Account Name</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=acc&type=accname">Select</a></td>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Change Password</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=acc&type=pass">Select</a></td>
<tr bgcolor='. $config['site']['darktborder'] .'><td Align="center" WIDTH=50%>Change E-Mail</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=acc&type=accmail">Select</a></td>
<tr bgcolor='. $config['site']['lightborder'] .'><td Align="center" WIDTH=50%>Change Page Access</td> <td Align="center" WIDTH=50%><a href="?subtopic=adminpanel&action=acc&type=page">Select</a></td>
</tr>
</table><br><br>';
// Players by Klon52 and Turson.
// Edit Acc Name.
if($_REQUEST['type'] == 'accname')
{
//Acc name form.
$main_content .= '<form action="?subtopic=adminpanel&action=acc&type=accname" method="post">
New account number <input type="text" name="newacc"> <br>
Player Name <input type="text" name="nameacc">
<br><input type="submit" value="OK" name="okaccname"></form>';
$main_content .= '<br><center><a href="?subtopic=adminpanel">BACK TO MAIN ADMIN PANEL</a></center>';
if (isset($_POST['okaccname']))
{
if(empty($_POST['newacc']))
{
$main_content .= '<h3><b><font color="red">You must enter New Account Name.</font></b></h3>';
}
elseif(empty($_POST['nameacc']))
{
$main_content .= '<h3><b><font color="red">You must enter Player Name.</font></b></h3>';
}
else
$SQL->query("UPDATE `accounts` INNER JOIN `players` ON `accounts`.`id` = `players`.`account_id` SET accounts.name=".$SQL->quote( $_POST['newacc'] )." WHERE players.name = ".$SQL->quote( $_POST['accname'] ).";");
$main_content .= 'Account number has beed changed.';
}
}
if($_REQUEST['type'] == 'pass')
{
//password form.
$main_content .= '<form action="?subtopic=adminpanel&action=acc&type=pass" method="post">
New password <input type="text" name="newpass"><br>
Player Name <input type="text" name="namepass"><br>
<input type="submit" value="OK" name="okpass"></form>';
$main_content .= '<br><center><a href="?subtopic=adminpanel">BACK TO MAIN ADMIN PANEL</a></center>';
if (isset($_POST['okpass']))
{
if(empty($_POST['newpass']))
{
$main_content .= '<h3><b><font color="red">You must enter New Account Password.</font></b></h3>';
}
elseif(empty($_POST['namepass']))
{
$main_content .= '<h3><b><font color="red">You must enter New Account Password.</font></b></h3>';
}
else
$SQL->query("UPDATE `accounts` INNER JOIN `players` ON `accounts`.`id` = `players`.`account_id` SET accounts.password=".$SQL->quote( $_POST['newpass'] )." WHERE players.name = ".$SQL->quote( $_POST['namepass'] ).";");
$main_content .= 'Password has beed changed.';
}
}
if($_REQUEST['type'] == 'accmail')
{
//new mail form.
$main_content .= '<form action="?subtopic=adminpanel&action=acc&type=accmail" method="post">
New e-mail adress <input type="text" name="newmail"> <br>
Player Name <input type="text" name="nameaccmail"><br>
<input type="submit" value="OK" name="okaccmail"></form>';
$main_content .= '<br><center><a href="?subtopic=adminpanel">BACK TO MAIN ADMIN PANEL</a></center>';
if (isset($_POST['okaccmail']))
{
if(empty($_POST['newmail']))
{
$main_content .= '<h3><b><font color="red">You must enter New Account E-Mail.</font></b></h3>';
}
elseif(empty($_POST['nameaccmail']))
{
$main_content .= '<h3><b><font color="red">You must enter Player Name.</font></b></h3>';
}
else
$SQL->query("UPDATE `accounts` INNER JOIN `players` ON `accounts`.`id` = `players`.`account_id` SET accounts.email=".$SQL->quote( $_POST['newmail'] )." WHERE players.name = ".$SQL->quote( $_POST['nameaccmail'] ).";");
$main_content .= 'E-Mail adress has beed changed.';
}
}
if($_REQUEST['type'] == 'page')
{
//page access form.
$main_content .= '<form action="?subtopic=adminpanel&action=acc&type=page" method="post">
Page access <input type="text" name="newaccess">(3->admin) <br>
Player Name <input type="text" name="namepage"><br>
<input type="submit" value="OK" name="okpage"></form>';
$main_content .= '<br><center><a href="?subtopic=adminpanel">BACK TO MAIN ADMIN PANEL</a></center>';
if (isset($_POST['okpage']))
{
if(empty($_POST['newaccess']))
{
$main_content .= '<h3><b><font color="red">You must enter New Account Page Access.</font></b></h3>';
}
elseif(empty($_POST['namepage']))
{
$main_content .= '<h3><b><font color="red">You must enter Player Name.</font></b></h3>';
}
else
$SQL->query("UPDATE `accounts` INNER JOIN `players` ON `accounts`.`id` = `players`.`account_id` SET accounts.page_access=".$SQL->quote( $_POST['newaccess'] )." WHERE players.name = ".$SQL->quote( $_POST['namepage'] ).";");
$main_content .= 'Page access has beed changed.';
}
}
}
}
else
$main_content .= 'You don\'t have required access to see this page!';
?>