File size: 5.07Kb
<?php
/*
-------------------------------------------
+ BOT Chat for PBNL
+ Script Coded By Judinho of CodeX Team!
+ 2go:- judinho59
+ judinho59@gmail.com
+ http://codemmunity.com
---------------------------------------------
*/
include('monit.php');
echo"<title>Admin » Bot Panel</title>";
if(isset($_GET["act"])){
$act=$_GET["act"];
}else{
$act=" ";
}
if($act == edit) {
$id=(int)$_GET['id'];
if(isset($_POST['esubmit'])) {
$id=(int)$_GET['id'];
$key = $_POST['key'];
$text = $_POST['text'];
$txt1 = $_POST['txt1'];
$txt2 = $_POST['txt2'];
$txt3 = $_POST['txt3'];
$txt4 = $_POST['txt4'];
$check=mysql_num_rows(mysql_query("SELECT * FROM `b_bot` WHERE key=$key"));
if(!$key||empty($key)||$check>0) {
$error .= 'Key Error!';
}
if(!$text||empty($text)) {
$error .= 'Text must not be Empty!';
}
if(!$error) {
mysql_query("UPDATE `b_bot` SET
`text` = '" . mysql_real_escape_string($text) . "',
`txt1` = '" . mysql_real_escape_string($txt1) . "',
`txt2` = '" . mysql_real_escape_string($txt2) . "',
`txt3` = '" . mysql_real_escape_string($txt3) . "',
`txt4` = '" . mysql_real_escape_string($txt4) . "',
`key` = '" . mysql_real_escape_string($key) . "'");
header("Location: botcp.php?msg=BOT Word successfully Edited");
exit();
} else {
header("Location: botcp.php?msg=$error");
exit();
}
}
$editq=mysql_query("SELECT * FROM b_bot WHERE id=$id");
$edit=mysql_fetch_array($editq);
$ekey=$edit["key"];
$etext=$edit["text"];
$etxt1=$edit["txt1"];
$etxt2=$edit["txt2"];
$etxt3=$edit["txt3"];
$etxt4=$edit["txt4"];
echo"<div class='b_head'>BOT » Edit Word </div>
<br> <br>
<form method='post' action='botcp.php?act=edit&id=$id'> <ul>
<li> Key: <input type='text' name='key' size='40' value='$ekey'> </li>
<li> Text: <input type='text' name='text' size='40' value='$etext'> </li>
<li> Text 1: <input type='text' name='txt1' size='40' value='$etxt1'> </li>
<li> Text 2: <input type='text' name='txt2' size='40' value='$etxt2'> </li>
<li> Text 3: <input type='text' name='txt3' size='40' value='$etxt3'> </li>
<li> Text 4: <input type='text' name='txt4' size='40' value='$etxt4'> </li>
<li> <input type='submit' value='Edit' name='esubmit'> </li>
</ul> </form> <br>
<br>
<font color='red'>Info:</font> <strong> {user} is Replacement username. <br>";
}
elseif($act == del){
$id = $_GET['id'];
$exist=mysql_query("SELECT * FROM `b_bot` WHERE id=$id");
if(mysql_num_rows($exist) == 0) {
$err .= 'Error!';
}
if(!$err) {
mysql_query("DELETE FROM `b_bot` WHERE id=$id") or die(mysql_error());
header('location: botcp.php?msg=BOT Word successfully Deleted!');
exit();
} else {
echo '<div class="msg">'.$err.'</div>';
}
}else{
if(isset($_POST['submit'])) {
$key = $_POST['key'];
$text = $_POST['text'];
$txt1 = $_POST['txt1'];
$txt2 = $_POST['txt2'];
$txt3 = $_POST['txt3'];
$txt4 = $_POST['txt4'];
$txt5 = $_POST['txt5'];
$check=mysql_num_rows(mysql_query("SELECT * FROM `b_bot` WHERE key='$key'"));
if(!$key||empty($key)||$check>0) {
$error .= 'Key Error!';
}
if(!$text||empty($text)) {
$error .= 'Text must not be Empty!';
}
if(!$error) {
mysql_query("INSERT INTO `b_bot` SET
`text` = '" . mysql_real_escape_string($text) . "',
`txt1` = '" . mysql_real_escape_string($txt1) . "',
`txt2` = '" . mysql_real_escape_string($txt2) . "',
`txt3` = '" . mysql_real_escape_string($txt3) . "',
`txt4` = '" . mysql_real_escape_string($txt4) . "',
`key` = '" . mysql_real_escape_string($key) . "'");
header("Location: botcp.php?msg=BOT Word successfully Added");
exit();
} else {
header("Location: botcp.php?msg=$error");
exit();
}
}
$msg=$_GET['msg'];
if(!empty($msg)){
echo"<div class='msg'>$msg</div>";
}
echo"<div class='b_head'> Add Word for BOT! </div> <br>
<span class='title'> Here, you can Add Words in which the Bot should Detect and its Reply.</span> <br> <br>
<form method='post' action='botcp.php?act=add'> <ul>
<li> Key: <input type='text' name='key' size='40'> </li>
<li> Text: <input type='text' name='text' size='40'> </li>
<li> Text 1: <input type='text' name='txt1' size='40'> </li>
<li> Text 2: <input type='text' name='txt2' size='40'> </li>
<li> Text 3: <input type='text' name='txt3' size='40'> </li>
<li> Text 4: <input type='text' name='txt4' size='40'> </li>
<li> <input type='submit' value='Add' name='submit'> </li>
</ul> </form> <br>
<br>
<font color='red'>Info:</font> <strong> {user} is Replacement username. <br>
<a href='about_bot.php'>How to Use BOT</a><br>
";
$query=mysql_query("SELECT * FROM b_bot ORDER BY id DESC");
if(mysql_num_rows($query)==0)
{
echo"<div class='msg'> No Words for BOT! </div>";
} else {
echo "<div class='b_head'>Words for BOT!</div>";
while ($bot=mysql_fetch_array($query)) {
echo "<div class='user_info'><ul></li><b>Key: </b> $bot[key];<br><b>Text: </b> $bot[text];<br><b>Text 1:</b> $bot[txt1];<br> <b>Text 2:</b> $bot[txt2];<br><b>Text 3:</b> $bot[txt3];<br><b>Text 4:</b> $bot[txt4];<br>
<br/><a href='?act=edit&id=$bot[id]'>[edit]</a> | <a href='?act=del&id=$bot[id];'>[delete]</a> </li></ul></div> <br> <hr>";
}
}
}
include('../footer.php');
?>