/*****************************************************/
/* jPORTAL - internetowy system portalowy */
/*****************************************************/
/* autor: Pawel 'jaco' Jaczewski */
/* email: info@websys.pl */
/*****************************************************/
#=====================================================#
if(eregi("main.php",$PHP_SELF)) { header("Location: index.php"); exit; }
###############################################################################
###############################################################################
###############################################################################
set_theme();
include("theme/$theme/functions.inc.php");
###############################################################################
###############################################################################
###############################################################################
function left_menu() {
global $menu_tbl, $PHP_SELF;
left_menu_open();
$query = "SELECT * FROM $menu_tbl WHERE posx='left' AND status=1 ORDER BY posy";
$result = mysql_query($query);
while($r = mysql_fetch_array($result)) {
$title = $r['title'];
$text = $r['text'];
$id = $r['id'];
$title = stripslashes($title);
$text = stripslashes($text);
left_menu_title_open();
echo $title;
left_menu_title_close();
left_menu_text_open();
$text = '?>'.$text.'';
eval($text);
left_menu_text_close();
}
left_menu_close();
}
###############################################################################
###############################################################################
###############################################################################
function right_menu() {
global $menu_tbl;
right_menu_open();
$query = "SELECT * FROM $menu_tbl WHERE posx='right' AND status=1 ORDER BY posy";
$result = mysql_query($query);
while($r = mysql_fetch_array($result)) {
$title = $r['title'];
$text = $r['text'];
$id = $r['id'];
$title = stripslashes($title);
$text = stripslashes($text);
right_menu_title_open();
echo $title;
right_menu_title_close();
right_menu_text_open();
$text = '?>'.$text.'';
eval($text);
right_menu_text_close();
}
right_menu_close();
}
###############################################################################
###############################################################################
###############################################################################
function set_theme() {
global $set_theme, $logs, $theme, $default_theme;
if($set_theme<>'') {
if(file_exists("theme/$set_theme")) {
$theme = $set_theme;
$czas = mktime(0,0,0,date("m"),date("d"),date("Y")+5);
setcookie("theme", $set_theme, $czas);
header("Location: index.php");
exit;
}
}
if($theme=='' OR !file_exists("theme/$theme")) {
$theme = $default_theme;
} else {
if(!file_exists("theme/$set_theme"))
$theme = $default_theme;
}
}
###############################################################################
###############################################################################
###############################################################################
function poll_form($punkt='') {
global $poll_a_tbl, $poll_b_tbl;
$query = "SELECT * FROM $poll_a_tbl ORDER BY id DESC";
$result = mysql_query($query);
$num = mysql_num_rows($result);
if($num==0) {
echo '
",$text);
$text = str_replace(":-)","
",$text);
$text = str_replace(":(","
",$text);
$text = str_replace(":-(","
",$text);
$text = str_replace(":P","
",$text);
$text = str_replace(":-P","
",$text);
$text = str_replace(":o","
",$text);
$text = str_replace(":O","
",$text);
$text = str_replace(":-o","
",$text);
$text = str_replace(":-O","
",$text);
$text = str_replace(" :/","
",$text);
$text = str_replace(":lol:","
",$text);
$text = str_replace(":deb:","
",$text);
$text = str_replace(":D","
",$text);
$text = str_replace("8)","
",$text);
$text = str_replace(":@","
",$text);
$text = str_replace(";)","
",$text);
$text = str_replace(";-)","
",$text);
$text = str_replace("???","
",$text);
$text = str_replace(":]","
",$text);
}
return $text;
}
###############################################################################
###############################################################################
###############################################################################
function login_guest($goto='') {
global $guest_tbl, $ga10, $gb10, $gnick, $gmail, $gpass, $REMOTE_ADDR;
if($ga10<>'' AND $gb10<>'') {
$query = "SELECT * FROM $guest_tbl WHERE nick='$ga10' AND stat='ok'";
$result = mysql_query($query);
$r = mysql_fetch_array($result);
$nick_ = $r['nick'];
$pass_ = $r['pass'];
$mail_ = $r['mail'];
if($nick_==$ga10 AND $pass_==$gb10) {
$_SESSION[gnick] = $nick_;
$_SESSION[gpass] = md5($pass_);
$_SESSION[gmail] = $mail_;
if(file_exists($o.'online_g/'.$REMOTE_ADDR)) unlink($o.'online_g/'.$REMOTE_ADDR);
if($goto=='')
header("Location: login.php?cmd=pw_get");
else
header("Location: $goto");
exit;
} else {
return 'no';
}
} else {
return 'no';
}
}
###############################################################################
###############################################################################
###############################################################################
function get_user_info($aaa='nic', $abc='') {
global $guest_tbl, $gnick, $gmail, $gpass, $forum_a;
if($abc=='') {
if($aaa=='nic') $aaa = $_SESSION['gnick'];
$query = "SELECT * FROM $guest_tbl WHERE nick='$aaa' AND stat='ok'";
$result = mysql_query($query);
$r = mysql_fetch_array($result);
$in[0] = $r['post'];
$in[1] = $r['nick'];
$in[2] = $r['mail'];
$in[3] = $r['sign'];
$in[4] = $r['www'];
$in[5] = $r['iname'];
$in[6] = $r['admin'];
$in[7] = $r['date'];
$in[8] = $r['avatar'];
return $in;
} else {
$query = "SELECT * FROM $guest_tbl WHERE stat='ok'";
$result = mysql_query($query);
while($r = mysql_fetch_array($result)) {
$in[$r['nick']][0] = $r['post'];
$in[$r['nick']][1] = $r['nick'];
$in[$r['nick']][2] = $r['mail'];
$in[$r['nick']][3] = $r['sign'];
$in[$r['nick']][4] = $r['www'];
$in[$r['nick']][5] = $r['iname'];
$in[$r['nick']][6] = $r['admin'];
$in[$r['nick']][7] = $r['date'];
$in[$r['nick']][8] = $r['avatar'];
}
$query = "SELECT * FROM $forum_a";
$result = mysql_query($query);
while($r = mysql_fetch_array($result)) {
$in[$r['author']][9]++;
}
return $in;
}
}
###############################################################################
###############################################################################
###############################################################################
function user_logout() {
global $jpu_stat, $gnick, $gpass, $members, $guests;
if(file_exists('online/'.$_SESSION[gnick])) unlink('online/'.$_SESSION[gnick]);
$_SESSION[gnick] = '**************************';
$_SESSION[gpass] = '**************************';
$guests++;
$members = $members-1;
header("Location: index.php");
exit;
}
###############################################################################
###############################################################################
###############################################################################
function set_info($var_name, $data) {
global $gnick, $guest_tbl;
$query = "SELECT * FROM $guest_tbl WHERE nick='$_SESSION[gnick]' AND stat='ok'";
$result = mysql_query($query);
$r = mysql_fetch_array($result);
$info = $r['post'];
if($data=='allallall') {
eval($info);
eval($var_name);
foreach($p AS $v_name => $v_data) {
$inf = $inf."\n".'$p['.$v_name.']="'.$v_data.'";';
}
$info = $inf;
} else {
if(substr_count($info, '$p['.$var_name.']')==0) {
$info = $info."\n".'$p['.$var_name.']="'.$data.'";';
} else {
eval($info);
$p[$var_name] = $data;
foreach($p AS $v_name => $v_data) {
$inf = $inf."\n".'$p['.$v_name.']="'.$v_data.'";';
$info = $inf;
}
}
}
$query = "UPDATE $guest_tbl SET post='$info' WHERE nick='$_SESSION[gnick]'";
$result = mysql_query($query);
}
###############################################################################
###############################################################################
###############################################################################
function user_block($size, $punkt)
{
global $pw_tbl, $gnick;
if(is_user_login()=='yes')
{
$pw = (int) mysql_num_rows(mysql_query("SELECT * FROM $pw_tbl WHERE receiver='$_SESSION[gnick]' AND readed='no'"));
echo '
'.$punkt.'lista użytkowników| Brak dostępu! |
|
Dostęp dla IP tego komputera ('.$REMOTE_ADDR.') jest zablokowany! Jeżeli ten komputer jest ogólnie dostępny (kafejka internetowa, biblioteka, szkoła, świetlica itp.) poinformuj o tym administratora strony pisząc na ten adres. |