<?php
session_start();
session_name("myImageSecurity"); // set session name
$sesID = session_id(); // get session ID
$sNo = 8;
require "config.php";
mysql_connect ("localhost", "$user", "$password") or die ('My SQL Error: ' . mysql_error());
mysql_select_db ("$database");
//current visitors
$curtime=time();
$keresx = "SELECT * FROM ".T_PRE."_visitors where ip='".$_SERVER['REMOTE_ADDR']."'";
$eredmenyx = mysql_query($keresx) or die ('My SQL Error: ' . mysql_error());
$sorokx = mysql_num_rows($eredmenyx);
if ($sorokx==0)
{
mysql_query("INSERT INTO ".T_PRE."_visitors VALUES ('".$_SERVER['REMOTE_ADDR']."', '$curtime','".$_SERVER['HTTP_REFERER']."','".$_SERVER['REQUEST_URI']."','".$_SERVER['HTTP_USER_AGENT']."')");
}
else
{
mysql_query("UPDATE ".T_PRE."_visitors SET timestamp='$curtime' where ip='".$_SERVER['REMOTE_ADDR']."'");
}
//add unique
$datum=date("Y-m-d H:i:s");
$keresxx = "SELECT * FROM ".T_PRE."_unique where ip='".$_SERVER['REMOTE_ADDR']."'";
$eredmenyxx = mysql_query($keresxx) or die ('My SQL Error: ' . mysql_error());
$sorokxx = mysql_num_rows($eredmenyxx);
if ($sorokxx==0)
{
mysql_query("INSERT INTO ".T_PRE."_unique VALUES ('".$_SERVER['REMOTE_ADDR']."', '1', '$datum', '$curtime')");
}
//###########
$timeout = time()-10*60;
mysql_query("DELETE FROM ".T_PRE."_visitors WHERE timestamp < $timeout");
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";
?>
<script language="javascript" type="text/javascript" src="tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
theme_advanced_buttons1 : "formatselect,fontselect,fontsizeselect,forecolor,bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull",
theme_advanced_buttons2 : "bullist,numlist,separator,undo,redo,separator,link,unlink,anchor,separator,image,cleanup,separator,indent,outdent,separator,charmap,hr,sub,sup",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
plugins : "preview, searchreplace, insertdatetime, emotions",
theme_advanced_buttons2_add : ", preview, search,replace, insertdate, inserttime, emotions",
<?php
echo "language : \"$lng_def\"";
?>
});
</script>
<?php
//##############
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 - $p_title</title>\n";
echo "<link rel=\"STYLESHEET\" type=\"text/css\" href=\"tech.css\"/>\n";
echo "</head>\n";
echo "<body><table class=\"main\" align=\"center\"><tr><td class=\"fej\">
<h1>$p_title</h1><h3>$p_comment</h3>
</td></tr><tr><td class=\"main\">";
//posteds
if ($_POST["s_add_msg"])
{
$id_f_x=$_POST["id_forumx"];
$title_f_x= $_POST["title_forumx"];
$author_x=$_POST["xszerzo"];
$title_x=$_POST["xtitle"];
$text_x=$_POST["szoveg"];
$datum=date("Y-m-d H:i:s");
if (isset($_POST['simage'])) { //Check whether simage var is set or not
$word = trim($_POST['simage']);
} else {
echo "<a href=\"index.php?what=newtopic&idforum=$id_f_x&forumtitle=$title_f_x\">$err1</a>";
}
if (isset($_COOKIE['secWord'])) { //Check whether secWord var is set or not
$sWord = $_COOKIE['secWord']; // actual security string
} else {
echo "<a href=\"index.php?what=newtopic&idforum=$id_f_x&forumtitle=$title_f_x\">$err1</a>";
}
if ($word === $sWord)
{
if ($author_x=="" or $title_x=="" or $text_x=="")
{
echo "<a href=\"index.php?what=newtopic&idforum=$id_f_x&forumtitle=$title_f_x\">$err2</a>";
}
else
{
if (!get_magic_quotes_gpc()) {
$title_x=addslashes($title_x);
$author_x=addslashes($author_x);
$text_x=addslashes($text_x);
}
mysql_query("INSERT INTO ".T_PRE."_topics VALUES ('', '$id_f_x', '$author_x','$datum','$title_x','$text_x','0','0')") or die ('My SQL Error: ' . mysql_error());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php?what=openforum&id=$id_f_x&forumtitle=$title_f_x\" />";
}
}
else
{
echo "<a href=\"index.php?what=newtopic&idforum=$id_f_x&forumtitle=$title_f_x\">$err1</a>";
}
}
elseif ($_POST["s_add_msg2"])
{
$id_f_x=$_POST["id_forumx"];
$title_f_x= $_POST["forum_titlex"];
$topic_id_x= $_POST["id_topicx"];
$topic_title_x=$_POST["topic_titles"];
$author_x=$_POST["xszerzo"];
$text_x=$_POST["szoveg"];
$datum=date("Y-m-d H:i:s");
if (isset($_POST['simage'])) { //Check whether simage var is set or not
$word = trim($_POST['simage']);
} else {
echo "<a href=\"index.php?what=opentopic&idtopic=$topic_id_x&forumtitle=$title_f_x&topictitle=$topic_title_x&idforum=$id_f_x\">$err1</a>";
}
if (isset($_COOKIE['secWord'])) { //Check whether secWord var is set or not
$sWord = $_COOKIE['secWord']; // actual security string
} else {
echo "<a href=\"index.php?what=opentopic&idtopic=$topic_id_x&forumtitle=$title_f_x&topictitle=$topic_title_x&idforum=$id_f_x\">$err1</a>";
}
if ($word === $sWord)
{
if ($author_x=="" or $text_x=="")
{
echo "<a href=\"index.php?what=opentopic&idtopic=$topic_id_x&forumtitle=$title_f_x&topictitle=$topic_title_x&idforum=$id_f_x\">$err2</a>";
}
else
{
if (!get_magic_quotes_gpc()) {
$author_x=addslashes($author_x);
$text_x=addslashes($text_x);
}
mysql_query("INSERT INTO ".T_PRE."_posts VALUES ('', '$topic_id_x', '$author_x','$datum','$text_x')") or die ('My SQL Error: ' . mysql_error());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php?what=opentopic&idtopic=$topic_id_x&forumtitle=$title_f_x&topictitle=$topic_title_x&idforum=$id_f_x\" />";
}
}
else
{
echo "<a href=\"index.php?what=opentopic&idtopic=$topic_id_x&forumtitle=$title_f_x&topictitle=$topic_title_x&idforum=$id_f_x\">$err1</a>";
}
}
else
{
//#########
//news table
echo "<table width=\"90%\" align=\"center\" class=\"news\"><tr><td>$p_news</td></tr></table>";
//#####################
$whatx=$_GET["what"];
if ($whatx=="")
{
//1.Fooldal##############
echo "<table width=\"90%\" align=\"center\"><tr>";
$keresp = "SELECT * FROM ".T_PRE."_forums";
$nx=0;
$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"];
//hany topic
$kerespt = "SELECT * FROM ".T_PRE."_topics where id_forum='$forum_id' order by date_pub ASC";
$eredmenypt = mysql_query($kerespt) or die ('My SQL Error: ' . mysql_error());
$hanytopic=mysql_num_rows($eredmenypt);
$vantpost='0';
while ($row = mysql_fetch_array($eredmenypt, MYSQL_ASSOC))
{
$xdate=$row["date_pub"];
$topic_id=$row["id"];
$kerespax = "SELECT * FROM ".T_PRE."_posts where id_topic='$topic_id' order by date_pub ASC";
$eredmenypax = mysql_query($kerespax) or die ('My SQL Error: ' . mysql_error());
$hanypostc=mysql_num_rows($eredmenypax);
while ($row = mysql_fetch_array($eredmenypax, MYSQL_ASSOC))
{
$xdatex= $row["date_pub"];
}
$datum=date("Y-m-d H:i:s");
$newdatex=dateadd("d",3,"$xdatex");
if ($newdatex>=$datum)
{
$vantpost='1';
}
if ($hanypostc==0)
{
$vantpost='0';
}
}
$datum=date("Y-m-d H:i:s");
$newdate=dateadd("d",3,"$xdate");
if ($newdate>=$datum)
{
$vantopic='1';
}
else
{
$vantopic='0';
}
//############################################
if ($vantopic==1 or $vantpost==1)
{
$kepxtx="<img src=\"book_new.jpg\" border=\"0\" alt=\"...\" />";
}
else
{
$kepxtx="<img src=\"book.jpg\" border=\"0\" alt=\"...\" />";
}
//##########
$nx=$nx+1;
echo "<td width=\"30%\" valign=\"top\"><a href=\"index.php?what=openforum&id=$forum_id&forumtitle=$forum_title\"><font size=\"5\">
$kepxtx $forum_title</font></a><br /><font size=\"1\">$forum_comment - $hanytopic $lng_topics</font></td>";
if ($nx==3 or $nx==6 or $nx==9 or $nx==12 or $nx==15 or $nx==18 or $nx==21 or $nx==24 or $nx==27 or $nx==30)
{
echo "</tr><tr>";
}
}
echo "</tr></table>";
echo "<p align='right'><img src=\"book.jpg\" border=\"0\" alt=\"...\" /> $lng_a1
<img src=\"book_new.jpg\" border=\"0\" alt=\"...\" /> $lng_a2</p>";
//#######################
}
elseif ($whatx=="openforum")
{
//2. Open forums-show topics
$idx=$_GET["id"];
$titlex=$_GET["forumtitle"];
echo "<center><h3><a href=\"index.php\">$lng_index</a> -> $titlex</h3></center>";
$kerest = "SELECT * FROM ".T_PRE."_topics where id_forum='$idx'";
$eredmenyt = mysql_query($kerest) or die ('My SQL Error: ' . mysql_error());
$osszt=mysql_num_rows($eredmenyt);
if ($osszt==0)
{
echo "<i>$lng_notopic</i>";
}
else
{
while ($row = mysql_fetch_array($eredmenyt, MYSQL_ASSOC))
{
$topic_id= $row["id"];
$topic_user= $row["user"];
$topic_date= $row["date_pub"];
$topic_title= $row["title"];
$topic_locked= $row["locked"];
$topic_viewed= $row["viewed"];
//hany answer
$kerespa = "SELECT * FROM ".T_PRE."_posts where id_topic='$topic_id'";
$eredmenypa = mysql_query($kerespa) or die ('My SQL Error: ' . mysql_error());
$hanyvalasz=mysql_num_rows($eredmenypa);
//##########
if ($topic_locked==0)
{
//show if new post###################
$kerespax = "SELECT * FROM ".T_PRE."_posts where id_topic='$topic_id' order by date_pub ASC";
$eredmenypax = mysql_query($kerespax) or die ('My SQL Error: ' . mysql_error());
while ($row = mysql_fetch_array($eredmenypax, MYSQL_ASSOC))
{
$xdatex= $row["date_pub"];
}
$datum=date("Y-m-d H:i:s");
$newdate=dateadd("d",3,"$xdatex");
if ($newdate>=$datum)
{
$vanpost='1';
}
else
{
$vanpost='0';
}
if ($hanyvalasz==0)
{
$vanpost='0';
}
if ($vanpost==1)
{
if ($hanyvalasz < 30)
{
$kepxtx2="<img src=\"book2_new.jpg\" border=\"0\" alt=\"...\" />";
}
else
{
$kepxtx2="<img src=\"book2_new_pop.jpg\" border=\"0\" alt=\"...\" />";
}
}
else
{
if ($hanyvalasz < 30)
{
$kepxtx2="<img src=\"book2.jpg\" border=\"0\" alt=\"...\" />";
}
else
{
$kepxtx2="<img src=\"book2_pop.jpg\" border=\"0\" alt=\"...\" />";
}
}
//#################################33
echo "<a href=\"index.php?what=opentopic&idtopic=$topic_id&forumtitle=$titlex&topictitle=$topic_title&idforum=$idx\">
<font size=\"4\">$kepxtx2 $topic_title (<i>$topic_date - $topic_user</i>) - $hanyvalasz $lng_posts <font color='#808080'>($lng_viewed: $topic_viewed)</font></font></a><br />";
}
else
{
echo "<a href=\"index.php?what=opentopic&idtopic=$topic_id&forumtitle=$titlex&topictitle=$topic_title&idforum=$idx\">
<font size=\"4\"><img src=\"lock.jpg\" border=\"0\"> $topic_title (<i>$topic_date - $topic_user</i>) - $hanyvalasz $lng_posts <font color='#808080'>($lng_viewed: $topic_viewed)</font></font></a><br />";
}
}
}
echo "<p align=\"right\">
<a href=\"index.php?what=newtopic&idforum=$idx&forumtitle=$titlex\">$lng_newtopic</a></p>";
echo "<p align='right'><img src=\"book2.jpg\" border=\"0\" alt=\"...\" /> $lng_a3
<img src=\"book2_new.jpg\" border=\"0\" alt=\"...\" /> $lng_a4
<img src=\"book2_pop.jpg\" border=\"0\" alt=\"...\" /> $lng_a5
<img src=\"book2_new_pop.jpg\" border=\"0\" alt=\"...\" /> $lng_a6</p>";
//###########################
}
elseif ($whatx=="opentopic")
{
//3. Open topics-answers
$page=$_GET["page"];
$idtopicx=$_GET["idtopic"];
$ftitle=$_GET["forumtitle"];
$ttitle=$_GET["topictitle"];
$idforumx=$_GET["idforum"];
echo "<center><h3><a href=\"index.php\">$lng_index</a> ->
<a href=\"index.php?what=openforum&id=$idforumx&forumtitle=$ftitle\">$ftitle</a>
-> $ttitle</h3></center>";
//viewed count
mysql_query("UPDATE ".T_PRE."_topics SET viewed=viewed+1 WHERE id='$idtopicx'");
//##############
$kerest = "SELECT * FROM ".T_PRE."_topics where id='$idtopicx'";
$eredmenyt = mysql_query($kerest) or die ('My SQL Error: ' . mysql_error());
while ($row = mysql_fetch_array($eredmenyt, MYSQL_ASSOC))
{
$topic_user= $row["user"];
$topic_date= $row["date_pub"];
$topic_title= $row["title"];
$topic_locked= $row["locked"];
$topic_text= $row["text"];
echo "<table width=\"90%\" align=\"center\" class=\"posts\"><tr><td>
<div class=\"dialogtitle\"><b>$topic_title</b> (<i>$topic_date - $topic_user</i>)</div>
</td></tr><tr><td>$topic_text</td></tr></table>";
}
//open posts
$kerestt = "SELECT * FROM ".T_PRE."_posts where id_topic='$idtopicx'";
$eredmenytt = mysql_query($kerestt) or die ('My SQL Error: ' . mysql_error());
$totalpostx = mysql_num_rows($eredmenytt);
//paginate
if ($totalpostx>0)
{
$oldalak=$totalpostx / 8;
if ($oldalak > 1)
{
$eredmenytt = mysql_query ("SELECT * FROM ".T_PRE."_posts where id_topic='$idtopicx' LIMIT 0,8") or die (mysql_error());
echo "<p align='right'>$lng_pages1: <a href='index.php?what=opentopic&idtopic=$idtopicx&forumtitle=$ftitle&topictitle=$topic_title&idforum=$idforumx&page=1'> <span class=pagenum>$lng_pages2</span> </a>";
for ($aaa=1;$aaa<=$oldalak+1;$aaa++)
{
if ($page == "")
{
echo "<a href='index.php?what=opentopic&idtopic=$idtopicx&forumtitle=$ftitle&topictitle=$topic_title&idforum=$idforumx&page=$aaa'> <span class=pagenum>$aaa</span> </a>";
}
else
{
if ($page==$aaa)
{
echo "<a href='index.php?what=opentopic&idtopic=$idtopicx&forumtitle=$ftitle&topictitle=$topic_title&idforum=$idforumx&page=$aaa'> <span class=pagenumcur>$aaa</span> </a>";
}
else
{
echo "<a href='index.php?what=opentopic&idtopic=$idtopicx&forumtitle=$ftitle&topictitle=$topic_title&idforum=$idforumx&page=$aaa'> <span class=pagenum>$aaa</span> </a>";
}
}
}
$aaa=$aaa-1;
echo "<a href='index.php?what=opentopic&idtopic=$idtopicx&forumtitle=$ftitle&topictitle=$topic_title&idforum=$idforumx&page=$aaa'> <span class=pagenum>$lng_pages3</span> </a></p>";
}
if ($page != "")
{
$egy = $page*6 - 6;
$eredmenytt = mysql_query ("SELECT * FROM ".T_PRE."_posts where id_topic='$idtopicx' LIMIT $egy,8") or die (mysql_error());
}
}
while ($row = mysql_fetch_array($eredmenytt, MYSQL_ASSOC))
{
$topic_user= $row["user"];
$topic_date= $row["date_pub"];
$topic_text= $row["text"];
echo "<table width=\"90%\" align=\"center\" class=\"topic\"><tr><td>
<div class=\"anstitle\"><i>$topic_date - $topic_user</i></div>
</td></tr><tr><td>$topic_text</td></tr></table>";
}
//oldalak
if ($oldalak > 1)
{
echo "<p align='right'>$lng_pages1: <a href='index.php?what=opentopic&idtopic=$idtopicx&forumtitle=$ftitle&topictitle=$topic_title&idforum=$idforumx&page=1'> <span class=pagenum>$lng_pages2</span> </a>";
for ($aaa=1;$aaa<=$oldalak+1;$aaa++)
{
if ($page == "")
{
echo "<a href='index.php?what=opentopic&idtopic=$idtopicx&forumtitle=$ftitle&topictitle=$topic_title&idforum=$idforumx&page=$aaa'> <span class=pagenum>$aaa</span> </a>";
}
else
{
if ($page==$aaa)
{
echo "<a href='index.php?what=opentopic&idtopic=$idtopicx&forumtitle=$ftitle&topictitle=$topic_title&idforum=$idforumx&page=$aaa'> <span class=pagenumcur>$aaa</span> </a>";
}
else
{
echo "<a href='index.php?what=opentopic&idtopic=$idtopicx&forumtitle=$ftitle&topictitle=$topic_title&idforum=$idforumx&page=$aaa'> <span class=pagenum>$aaa</span> </a>";
}
}
}
$aaa=$aaa-1;
echo "<a href='index.php?what=opentopic&idtopic=$idtopicx&forumtitle=$ftitle&topictitle=$topic_title&idforum=$idforumx&page=$aaa'> <span class=pagenum>$lng_pages3</span> </a></p>";
}
//###########
if ($oldalak <= 1 or $page>= $oldalak)
{
if ($topic_locked==0)
{
echo "<center><h3>$lng_ansfor $topic_title</h3></center>";
echo "<form method=\"post\" action=\"index.php\" name=\"PostMessage\">";
echo "$lng_author: <br /><input type=\"text\" value=\"\" name=\"xszerzo\" size=\"40\" /><br />
<input type=\"hidden\" value=\"$idtopicx\" name=\"id_topicx\" size=\"40\" />
<input type=\"hidden\" value=\"$ftitle\" name=\"forum_titlex\" size=\"40\" />
<input type=\"hidden\" value=\"$ttitle\" name=\"topic_titles\" size=\"40\" />
<input type=\"hidden\" value=\"$idforumx\" name=\"id_forumx\" size=\"40\" />";
echo "<textarea name=\"szoveg\" cols=\"80\" rows=\"20\">";
echo "</textarea><br />
<input type=\"hidden\" name=\"myImageSecurity\" value=\"$sesID\" /> ";
echo "<img src=\"securityimage.php?myImageSecurity=$sesID&no=$sNo\" alt=\"..\"/>";
echo "<br />";
echo "<input type=\"text\" value=\"\" name=\"simage\" size=\"20\" /><br />";
echo "<input type=\"submit\" value=\"$lng_save\" name=\"s_add_msg2\" />";
echo "</form>";
}
else
{
echo "<i>$lng_locked</i>";
}
}
//########################
}
elseif ($whatx=="newtopic")
{
//write a new topic
$idforumx=$_GET["idforum"];
$forumtitlex=$_GET["forumtitle"];
echo "<center><h3>$lng_newtopic2 $forumtitlex</h3></center>";
echo "<form method=\"post\" action=\"index.php\" name=\"PostMessage\">
<input type=\"hidden\" value=\"$idforumx\" name=\"id_forumx\" size=\"40\" />
<input type=\"hidden\" value=\"$forumtitlex\" name=\"title_forumx\" size=\"40\" />";
echo "$lng_author: <br /><input type=\"text\" value=\"\" name=\"xszerzo\" size=\"40\" /><br />";
echo "$lng_ntitle: <br /><input type=\"text\" value=\"\" name=\"xtitle\" size=\"40\" /><br />";
echo "<textarea name=\"szoveg\" cols=\"80\" rows=\"20\">";
echo "</textarea><br />
<input type=\"hidden\" name=\"myImageSecurity\" value=\"$sesID\" />";
echo "<img src=\"securityimage.php?myImageSecurity=$sesID&no=$sNo\" alt=\"..\"/>";
echo "<br />";
echo "<input type=\"text\" value=\"\" name=\"simage\" size=\"20\" /><br />";
echo "<a href=\"index.php\">$lng_index</a>
<a href=\"index.php?what=openforum&id=$idforumx&forumtitle=$forumtitlex\">$lng_backf</a> ";
echo "<input type=\"submit\" value=\"$lng_save\" name=\"s_add_msg\" />";
echo "</form>";
//##################
}
}
//stat
echo "<hr />";
//1.hany forum
$keresx1 = "SELECT * FROM ".T_PRE."_forums";
$eredmenyx1 = mysql_query($keresx1) or die ('My SQL Error: ' . mysql_error());
$osszforum=mysql_num_rows($eredmenyx1);
//2.hany topic
$keresx2 = "SELECT * FROM ".T_PRE."_topics";
$eredmenyx2 = mysql_query($keresx2) or die ('My SQL Error: ' . mysql_error());
$ossztopic=mysql_num_rows($eredmenyx2);
//3.ossz posts
$keresx3 = "SELECT * FROM ".T_PRE."_posts";
$eredmenyx3 = mysql_query($keresx3) or die ('My SQL Error: ' . mysql_error());
$osszpost=mysql_num_rows($eredmenyx3);
$osszpost=$osszpost+$ossztopic;
echo "$lng_tot $osszforum $lng_tot2, $ossztopic $lng_tot3 ($osszpost $lng_tot4)<br />";
//utolso post
$keresx4 = "SELECT * FROM ".T_PRE."_posts order by date_pub ASC";
$eredmenyx4 = mysql_query($keresx4) or die ('My SQL Error: ' . mysql_error());
while ($row = mysql_fetch_array($eredmenyx4, MYSQL_ASSOC))
{
$last_user= $row["user"];
$last_date= $row["date_pub"];
}
//utolso topic
$keresx5 = "SELECT * FROM ".T_PRE."_topics order by date_pub ASC";
$eredmenyx5 = mysql_query($keresx5) or die ('My SQL Error: ' . mysql_error());
while ($row = mysql_fetch_array($eredmenyx5, MYSQL_ASSOC))
{
$last_user2= $row["user"];
$last_title= $row["title"];
$last_date2= $row["date_pub"];
}
echo "$lng_last: $last_title (by $last_user2 on $last_date2)<br />";
echo "$lng_last2: $last_user on $last_date<br />";
//most viewed topic
$keresx55 = "SELECT * FROM ".T_PRE."_topics order by viewed ASC";
$eredmenyx55 = mysql_query($keresx55) or die ('My SQL Error: ' . mysql_error());
while ($row = mysql_fetch_array($eredmenyx55, MYSQL_ASSOC))
{
$most_user2= $row["user"];
$most_title= $row["title"];
$most_date2= $row["date_pub"];
}
echo "$lng_mview: $most_title (by $most_user2 on $most_date2)<br />";
//################
//visitors
$keres2 = "SELECT * FROM ".T_PRE."_visitors";
$eredmeny2 = mysql_query($keres2) or die ('My SQL Error: ' . mysql_error());
$curonline = mysql_num_rows($eredmeny2);
$robots=0;
while ($row = mysql_fetch_array($eredmeny2, MYSQL_ASSOC))
{
$cur_visitoragent= $row["agent"];
if (isbot($cur_visitoragent))
{
$robots=$robots+1;
}
}
//show max visitors
mysql_query("UPDATE ".T_PRE."_maxview SET total=total+1");
$keres3 = "SELECT * FROM ".T_PRE."_maxview";
$eredmeny3 = mysql_query($keres3) or die ('My SQL Error: ' . mysql_error());
$rowcnt = mysql_num_rows($eredmeny3);
$datum=date("Y-m-d H:i:s");
$datum2=date("Y-m-d");
if ($rowcnt==0)
{
mysql_query("INSERT INTO ".T_PRE."_maxview values ('1','$curonline','$datum')");
}
else
{
while ($row = mysql_fetch_array($eredmeny3, MYSQL_ASSOC))
{
$oldmax= $row["most"];
$totvis= $row["total"];
$mikor=$row["datex"];
}
if ($curonline>$oldmax)
{
mysql_query("UPDATE ".T_PRE."_maxview SET most='$curonline', datex='$datum'");
}
}
$totvis=$totvis+1;
$keresxx = "SELECT * FROM ".T_PRE."_unique";
$eredmenyxx = mysql_query($keresxx) or die ('My SQL Error: ' . mysql_error());
$sorokxx = mysql_num_rows($eredmenyxx);
echo "<hr /><b><font color='#FF0000'>$lng_vstat1: $datum2</font></b><br />
$lng_vstat2: <b>$totvis</b> <i>(<font color='#FF0000'>$sorokxx</font> $lng_statuniq)</i><br />
$lng_vstat3: <b>$curonline</b> <i>($lng_vstat4: $robots)</i><br />
<i>$lng_vstat5: <b>$oldmax</b> $lng_vstat6 $mikor</i>";
function isbot($agent="")
{
//no agent given => read from globals
if ($agent=="")
{
@$agent=$_SERVER["HTTP_USER_AGENT"];
}
if (strstr(strtolower($agent),"jeevesteoma")) return true;
if (strstr(strtolower($agent),"msnbot")) return true;
if (strstr(strtolower($agent),"slurp")) return true;
if (strstr(strtolower($agent),"jeevestemoa")) return true;
if (strstr(strtolower($agent),"gulper")) return true;
if (strstr(strtolower($agent),"googlebot")) return true;
if (strstr(strtolower($agent),"linkwalker")) return true;
if (strstr(strtolower($agent),"validator")) return true;
if (strstr(strtolower($agent),"webaltbot")) return true;
if (strstr(strtolower($agent),"wget")) return true;
if (strstr(strtolower($agent),"adsbot")) return true;
if (strstr(strtolower($agent),"archiver")) return true;
if (strstr(strtolower($agent),"scooter")) return true;
if (strstr(strtolower($agent),"jeeves")) return true;
if (strstr(strtolower($agent),"baiduspider")) return true;
if (strstr(strtolower($agent),"exabot")) return true;
if (strstr(strtolower($agent),"crawler")) return true;
if (strstr(strtolower($agent),"webcrawler")) return true;
if (strstr(strtolower($agent),"neomo")) return true;
if (strstr(strtolower($agent),"gigabot")) return true;
if (strstr(strtolower($agent),"google")) return true;
if (strstr(strtolower($agent),"desktop")) return true;
if (strstr(strtolower($agent),"googlebot")) return true;
if (strstr(strtolower($agent),"heritrix")) return true;
if (strstr(strtolower($agent),"ichiro")) return true;
if (strstr(strtolower($agent),"mj12bot")) return true;
if (strstr(strtolower($agent),"metagerbot")) return true;
if (strstr(strtolower($agent),"msnbot")) return true;
if (strstr(strtolower($agent),"search")) return true;
if (strstr(strtolower($agent),"nutch")) return true;
if (strstr(strtolower($agent),"omniexplorer")) return true;
if (strstr(strtolower($agent),"validator")) return true;
if (strstr(strtolower($agent),"psbot")) return true;
if (strstr(strtolower($agent),"seekbot")) return true;
if (strstr(strtolower($agent),"seo")) return true;
if (strstr(strtolower($agent),"snappy")) return true;
if (strstr(strtolower($agent),"synoobot")) return true;
if (strstr(strtolower($agent),"crawleradmin")) return true;
if (strstr(strtolower($agent),"turnitinbot")) return true;
if (strstr(strtolower($agent),"voyager")) return true;
if (strstr(strtolower($agent),"w3")) return true;
if (strstr(strtolower($agent),"yacybot")) return true;
if (strstr(strtolower($agent),"yahoo")) return true;
if (strstr(strtolower($agent),"ia_archiver")) return true;
if (strstr(strtolower($agent),"msnbot")) return true;
}
//open lang file
//###########
echo "<br /><br />
<center><a href=\"http://validator.w3.org/check?uri=referer\"><font color='#808080'>XHTML 1.0</font></a>
<a href=\"http://jigsaw.w3.org/css-validator/\"><font color='#808080'>CSS</font></a>
<a href=\"http://tinymce.moxiecode.com?id=powered_by_tinymce_v2\"><font color='#808080'>TinyMCE</font></a>
<a href=\"http://www.php.net\"><font color='#808080'>PHP5</font></a>
<a href=\"http://www.mysql.com\"><font color='#808080'>MySQL</font></a></center>";
echo "</td></tr><tr><td class=\"lab\">
<center><b>©$p_author</b><br /><br />TechBook Ver 1.0.0 beta, made by ©JSystems<br /><a href=\"http://www.jsystems.ro\">www.jsystems.ro</a></center></td></tr></table></body></html>";
function dateAdd($interval,$number,$dateTime) {
$dateTime = (strtotime($dateTime) != -1) ? strtotime($dateTime) : $dateTime;
$dateTimeArr=getdate($dateTime);
$yr=$dateTimeArr[year];
$mon=$dateTimeArr[mon];
$day=$dateTimeArr[mday];
$hr=$dateTimeArr[hours];
$min=$dateTimeArr[minutes];
$sec=$dateTimeArr[seconds];
switch($interval) {
case "s"://seconds
$sec += $number;
break;
case "n"://minutes
$min += $number;
break;
case "h"://hours
$hr += $number;
break;
case "d"://days
$day += $number;
break;
case "ww"://Week
$day += ($number * 7);
break;
case "m": //similar result "m" dateDiff Microsoft
$mon += $number;
break;
case "yyyy": //similar result "yyyy" dateDiff Microsoft
$yr += $number;
break;
default:
$day += $number;
}
$dateTime = mktime($hr,$min,$sec,$mon,$day,$yr);
$dateTimeArr=getdate($dateTime);
$nosecmin = 0;
$min=$dateTimeArr[minutes];
$sec=$dateTimeArr[seconds];
if ($hr==0){$nosecmin += 1;}
if ($min==0){$nosecmin += 1;}
if ($sec==0){$nosecmin += 1;}
if ($nosecmin>2){ return(date("Y-m-d",$dateTime));} else { return(date("Y-m-d G:i:s",$dateTime));}
}
?>