<?php
require "../config.php";
mysql_connect ("localhost", "$user", "$password") or die ('My SQL Error: ' . mysql_error());
mysql_select_db ("$database");
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">
<head>\n";
$kerespp = "SELECT * FROM ".T_PRE."_page";
$eredmenypp = mysql_query($kerespp) or die ('My SQL Error: ' . mysql_error());
while ($row = mysql_fetch_array($eredmenypp, MYSQL_ASSOC))
{
$p_lang= $row["lang"];
$p_title= $row["title"];
$p_comment= $row["comment"];
$p_author= $row["author"];
$p_news= $row["news"];
}
//open lang file
include "../language/$p_lang";
//##############
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-2\"/>\n";
echo "<meta http-equiv=\"DESCRIPTION\" content=\"TechBook\"/>\n";
echo "<meta http-equiv=\"KEYWORDS\" content=\"jsystems\"/>\n";
echo "<meta http-equiv=\"GENERATOR\" content=\"techBook\"/>\n";
echo "<meta http-equiv=\"AUTHOR\" content=\"JSystems\"/>\n";
echo "<link rel='shortcut icon' href='tech.ico'/>\n";
echo "<title>techBook admin panel - $p_title</title>\n";
echo "<link rel=\"STYLESHEET\" type=\"text/css\" href=\"../tech.css\"/>\n";
echo "</head>\n";
//saves
if ($_POST["s_add_msg"])
{
$xtitle=$_POST["xtitle"];
$xcomment=$_POST["xcomment"];
$xpsw=$_POST["xpsw"];
if ($xtitle=="")
{
echo "$adl_err1";
}
elseif ($xpsw=="")
{
echo "$adl_err2";
}
elseif ($xpsw != "$adminpsw")
{
echo "$adl_err3";
}
else
{
//save
mysql_query("INSERT INTO ".T_PRE."_forums VALUES ('', '$xtitle', '$xcomment')") or die ('My SQL Error: ' . mysql_error());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php?adm=forums\" />";
}
}
elseif ($_POST["s_add_msg2"])
{
$xtitle=$_POST["xtitle"];
$xcomment=$_POST["xcomment"];
$xpsw=$_POST["xpsw"];
$xid= $_POST["xid"];
if ($xtitle=="")
{
echo "$adl_err1";
}
elseif ($xpsw=="")
{
echo "$adl_err2";
}
elseif ($xpsw != "$adminpsw")
{
echo "$adl_err3";
}
else
{
//save
mysql_query("UPDATE ".T_PRE."_forums SET title='$xtitle', comment='$xcomment' where id='$xid'") or die ('My SQL Error: ' . mysql_error());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php?adm=forums\" />";
}
}
elseif ($_POST["s_add_msg3"])
{
$xpsw=$_POST["xpsw"];
$xid= $_POST["xid"];
if ($xpsw=="")
{
echo "$adl_err2";
}
elseif ($xpsw != "$adminpsw")
{
echo "$adl_err3";
}
else
{
//save
mysql_query("DELETE FROM ".T_PRE."_forums where id='$xid'") or die ('My SQL Error: ' . mysql_error());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php?adm=forums\" />";
}
}
elseif ($_POST["s_add_msg4"])
{
$xpsw=$_POST["xpsw"];
$xid= $_POST["xid"];
if ($xpsw=="")
{
echo "$adl_err2";
}
elseif ($xpsw != "$adminpsw")
{
echo "$adl_err3";
}
else
{
//save
mysql_query("UPDATE ".T_PRE."_topics SET locked='1' where id='$xid'") or die ('My SQL Error: ' . mysql_error());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php?adm=topics\" />";
}
}
elseif ($_POST["s_add_msg5"])
{
$xpsw=$_POST["xpsw"];
$xid= $_POST["xid"];
if ($xpsw=="")
{
echo "$adl_err2";
}
elseif ($xpsw != "$adminpsw")
{
echo "$adl_err3";
}
else
{
//save
mysql_query("UPDATE ".T_PRE."_topics SET locked='0' where id='$xid'") or die ('My SQL Error: ' . mysql_error());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php?adm=topics\" />";
}
}
elseif ($_POST["s_add_msg6"])
{
$xpsw=$_POST["xpsw"];
$xid= $_POST["xid"];
if ($xpsw=="")
{
echo "$adl_err2";
}
elseif ($xpsw != "$adminpsw")
{
echo "$adl_err3";
}
else
{
//save
mysql_query("DELETE FROM ".T_PRE."_topics where id='$xid'") or die ('My SQL Error: ' . mysql_error());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php?adm=topics\" />";
}
}
elseif ($_POST["s_add_msg7"])
{
$xpsw=$_POST["xpsw"];
$xid= $_POST["xid"];
if ($xpsw=="")
{
echo "$adl_err2";
}
elseif ($xpsw != "$adminpsw")
{
echo "$adl_err3";
}
else
{
//save
mysql_query("DELETE FROM ".T_PRE."_posts where id='$xid'") or die ('My SQL Error: ' . mysql_error());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php?adm=topics\" />";
}
}
elseif ($_POST["s_add_msg8"])
{
$xlang=$_POST["p_lang"];
$xtitle= $_POST["ptitle"];
$xcomment= $_POST["pcomment"];
$xauthor= $_POST["pauthor"];
$xnews= $_POST["newsx"];
$xpsw=$_POST["xpsw"];
if ($xpsw=="")
{
echo "$adl_err2";
}
elseif ($xpsw != "$adminpsw")
{
echo "$adl_err3";
}
else
{
//save
mysql_query("UPDATE ".T_PRE."_page SET lang='$xlang', title='$xtitle', comment='$xcomment', author='$xauthor', news='$xnews'") or die ('My SQL Error: ' . mysql_error());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php?adm=general\" />";
}
}
//##########################################################################
echo "<table class=\"main\" align=\"center\"><tr><td class=\"fej\">
</td></tr><tr><td class=\"main\">";
//index page 3 menu
echo "<img src=\"../book.jpg\" border=\'0\'> <a href=\"../index.php\"><font size=\"4\">$adl_menu1</font></a> ";
echo "<img src=\"../book.jpg\" border=\'0\'> <a href=\"index.php?adm=general\"><font size=\"4\">$adl_menu2</font></a> ";
echo "<img src=\"../book.jpg\" border=\'0\'> <a href=\"index.php?adm=forums\"><font size=\"4\">$adl_menu3</font></a> ";
echo "<img src=\"../book.jpg\" border=\'0\'> <a href=\"index.php?adm=topics\"><font size=\"4\">$adl_menu4</font></a><br />";
//open menus :)))))))
$editx=$_GET["edit"];
if ($editx=="")
{
$admx=$_GET["adm"];
if ($admx=="general")
{
//open general setup
echo "<h3>$adl_title1</h3>";
$kerespp = "SELECT * FROM ".T_PRE."_page";
$eredmenypp = mysql_query($kerespp) or die ('My SQL Error: ' . mysql_error());
while ($row = mysql_fetch_array($eredmenypp, MYSQL_ASSOC))
{
$p_lang= $row["lang"];
$p_title= $row["title"];
$p_comment= $row["comment"];
$p_author= $row["author"];
$p_news= $row["news"];
}
echo "<form method=\"post\" action=\"index.php\" name=\"PostMessage\">";
echo "$adl_set1: <select name=\"p_lang\">";
$d = dir("../language/");
while ($entry2 = $d->read()) {
if (strstr($entry2,".php"))
{
if ($entry2==$p_lang)
{
echo "<option value=\"$entry2\" selected=\"selected\">$entry2</option>";
}
else
{
echo "<option value=\"$entry2\">$entry2</option>";
}
}
}
echo "</select><br />";
echo "$adl_set2: <br /><input type=\"text\" value=\"$p_title\" name=\"ptitle\" size=\"40\" /><br />";
echo "$adl_set3: <br /><input type=\"text\" value=\"$p_comment\" name=\"pcomment\" size=\"40\" /><br />";
echo "$adl_set4: <br /><input type=\"text\" value=\"$p_author\" name=\"pauthor\" size=\"40\" /><br />";
echo "$adl_set5: <br /><textarea name=\"newsx\" cols=\"60\" rows=\"10\">$p_news";
echo "</textarea><br />";
echo "$adl_admpsw: <br /><input type=\"password\" value=\"\" name=\"xpsw\" size=\"40\" /><br />";
echo "<input type=\"submit\" value=\"$lng_save\" name=\"s_add_msg8\" />";
echo "</form>";
}
elseif ($admx=="forums")
{
//open forum setup
echo "<h3>$adl_title2</h3>";
echo "<table width=\"90%\">";
$keresp = "SELECT * FROM ".T_PRE."_forums";
$eredmenyp = mysql_query($keresp) or die ('My SQL Error: ' . mysql_error());
while ($row = mysql_fetch_array($eredmenyp, MYSQL_ASSOC))
{
$forum_id= $row["id"];
$forum_title= $row["title"];
$forum_comment= $row["comment"];
echo "<tr><td>$forum_id</td><td>$forum_title</td><td>$forum_comment</td><td>
<a href=\"index.php?edit=editforum&fid=$forum_id\">$adl_edit</a>
<a href=\"index.php?edit=delforum&fid=$forum_id\">$adl_del</a></td></tr>";
}
echo "</table><br><a href=\"index.php?edit=newforum\">$adl_newf</a>";
}
elseif ($admx=="topics")
{
//open topic setup
echo "<h3>$adl_title3</h3>";
echo "<table width=\"90%\">";
$keresp = "SELECT * FROM ".T_PRE."_topics";
$eredmenyp = mysql_query($keresp) or die ('My SQL Error: ' . mysql_error());
while ($row = mysql_fetch_array($eredmenyp, MYSQL_ASSOC))
{
$topic_id= $row["id"];
$topic_title= $row["title"];
$topic_user= $row["user"];
$topic_date= $row["date_pub"];
$topic_locked=$row["locked"];
if ($topic_locked==0)
{
echo "<tr><td><font color='#008000'>$topic_id</font></td><td><font color='#008000'>$topic_title</font></td><td><font color='#008000'>$topic_user</font></td><td><font color='#008000'>$topic_date</font></td><td>
<a href=\"index.php?edit=locktopic&tid=$topic_id\"><font color='#FF0000'><b>$adl_lock</b></font></a>
<a href=\"index.php?edit=deltopic&tid=$topic_id\">$adl_del</a></td></tr>";
}
else
{
echo "<tr><td><font color='#FF0000'>$topic_id</font></td><td><font color='#FF0000'>$topic_title</font></td><td><font color='#FF0000'>$topic_user</font></td><td><font color='#FF0000'>$topic_date</font></td><td>
<a href=\"index.php?edit=unlocktopic&tid=$topic_id\"><font color='#008000'><b>$adl_unlock</b></font></a>
<a href=\"index.php?edit=deltopic&tid=$topic_id\">$adl_del</a></td></tr>";
}
}
echo "</table>";
echo "<h3>$adl_title4</h3>";
echo "<table width=\"90%\">";
$keresp = "SELECT * FROM ".T_PRE."_posts";
$eredmenyp = mysql_query($keresp) or die ('My SQL Error: ' . mysql_error());
while ($row = mysql_fetch_array($eredmenyp, MYSQL_ASSOC))
{
$post_id= $row["id"];
$post_user= $row["user"];
$post_date= $row["date_pub"];
echo "<tr><td>$post_id</td><td>$post_user</td><td>$post_date</td><td>
<a href=\"index.php?edit=delpost&pid=$post_id\">$adl_del</a></td></tr>";
}
echo "</table>";
}
}
elseif ($editx=="editforum")
{
//edit forum :)
$fid = $_GET["fid"];
$kerespx = "SELECT * FROM ".T_PRE."_forums where id='$fid'";
$eredmenypx = mysql_query($kerespx) or die ('My SQL Error: ' . mysql_error());
while ($row = mysql_fetch_array($eredmenypx, MYSQL_ASSOC))
{
$forum_titlex= $row["title"];
$forum_commentx= $row["comment"];
}
echo "<center><h3>$adl_newfset1</h3></center>";
echo "<form method=\"post\" action=\"index.php\" name=\"PostMessage\">";
echo "$adl_newfset2: <br /><input type=\"text\" value=\"$forum_titlex\" name=\"xtitle\" size=\"40\" />
<input type=\"hidden\" value=\"$fid\" name=\"xid\" size=\"40\" /><br />";
echo "$adl_newfset3: <br /><input type=\"text\" value=\"$forum_commentx\" name=\"xcomment\" size=\"40\" /><br />";
echo "<br>";
echo "$adl_admpsw: <br /><input type=\"password\" value=\"\" name=\"xpsw\" size=\"40\" /><br />";
echo "<a href=\"index.php?adm=forums\">$adl_back</a> ";
echo "<input type=\"submit\" value=\"$lng_save\" name=\"s_add_msg2\" />";
echo "</form>";
}
elseif ($editx=="delforum")
{
$fid = $_GET["fid"];
echo "<center><h3>$adl_dellf</h3></center>";
echo "<form method=\"post\" action=\"index.php\" name=\"PostMessage\">";
echo "<input type=\"hidden\" value=\"$fid\" name=\"xid\" size=\"40\" />";
echo "$adl_admpsw: <br /><input type=\"password\" value=\"\" name=\"xpsw\" size=\"40\" /><br />";
echo "<a href=\"index.php?adm=forums\">$adl_back</a> ";
echo "<input type=\"submit\" value=\"$adl_del\" name=\"s_add_msg3\" />";
echo "</form>";
}
elseif ($editx=="newforum")
{
//new forum :)
echo "<center><h3>$adl_newf</h3></center>";
echo "<form method=\"post\" action=\"index.php\" name=\"PostMessage\">";
echo "$adl_newfset2: <br /><input type=\"text\" value=\"\" name=\"xtitle\" size=\"40\" /><br />";
echo "$adl_newfset3: <br /><input type=\"text\" value=\"\" name=\"xcomment\" size=\"40\" /><br />";
echo "<br>";
echo "$adl_admpsw: <br /><input type=\"password\" value=\"\" name=\"xpsw\" size=\"40\" /><br />";
echo "<a href=\"index.php?adm=forums\">$adl_back</a> ";
echo "<input type=\"submit\" value=\"$lng_save\" name=\"s_add_msg\" />";
echo "</form>";
}
elseif ($editx=="locktopic")
{
$tid = $_GET["tid"];
echo "<center><h3>$adl_extitle1</h3></center>";
echo "<form method=\"post\" action=\"index.php\" name=\"PostMessage\">";
echo "<input type=\"hidden\" value=\"$tid\" name=\"xid\" size=\"40\" />";
echo "$adl_admpsw: <br /><input type=\"password\" value=\"\" name=\"xpsw\" size=\"40\" /><br />";
echo "<a href=\"index.php?adm=topics\">$adl_back</a> ";
echo "<input type=\"submit\" value=\"$adl_lock\" name=\"s_add_msg4\" />";
echo "</form>";
}
elseif ($editx=="unlocktopic")
{
$tid = $_GET["tid"];
echo "<center><h3>$adl_extitle2</h3></center>";
echo "<form method=\"post\" action=\"index.php\" name=\"PostMessage\">";
echo "<input type=\"hidden\" value=\"$tid\" name=\"xid\" size=\"40\" />";
echo "$adl_admpsw: <br /><input type=\"password\" value=\"\" name=\"xpsw\" size=\"40\" /><br />";
echo "<a href=\"index.php?adm=topics\">$adl_back</a> ";
echo "<input type=\"submit\" value=\"$adl_unlock\" name=\"s_add_msg5\" />";
echo "</form>";
}
elseif ($editx=="deltopic")
{
$tid = $_GET["tid"];
echo "<center><h3>$adl_extitle3</h3></center>";
echo "<form method=\"post\" action=\"index.php\" name=\"PostMessage\">";
echo "<input type=\"hidden\" value=\"$tid\" name=\"xid\" size=\"40\" />";
echo "$adl_admpsw: <br /><input type=\"password\" value=\"\" name=\"xpsw\" size=\"40\" /><br />";
echo "<a href=\"index.php?adm=topics\">$adl_back</a> ";
echo "<input type=\"submit\" value=\"$adl_del\" name=\"s_add_msg6\" />";
echo "</form>";
}
elseif ($editx=="delpost")
{
$pid = $_GET["pid"];
echo "<center><h3>$adl_extitle4</h3></center>";
echo "<form method=\"post\" action=\"index.php\" name=\"PostMessage\">";
echo "<input type=\"hidden\" value=\"$pid\" name=\"xid\" size=\"40\" />";
echo "$adl_admpsw: <br /><input type=\"password\" value=\"\" name=\"xpsw\" size=\"40\" /><br />";
echo "<a href=\"index.php?adm=topics\">$adl_back</a> ";
echo "<input type=\"submit\" value=\"$adl_del\" name=\"s_add_msg7\" />";
echo "</form>";
}
echo "</td></tr><tr><td class=\"lab\">
<center>©JSystems<br><a href=\"http://www.jsystems.ro\">www.jsystems.ro</a></center></td></tr></table>";
?>