39 |
if ($val == $script) $pg = $var; |
if ($val == $script) $pg = $var; |
40 |
return $pg; |
return $pg; |
41 |
} |
} |
42 |
function HTML_escape($str) { |
function HTML_Escape($str) { |
43 |
$oldstr = $str; # KLUDGY!!! |
$oldstr = $str; # KLUDGY!!! |
44 |
$str = eregi_replace("\<BR\>", "\n", $str); # KLUDGY!!! |
$str = eregi_replace("\<BR\>", "\n", $str); # KLUDGY!!! |
45 |
$foo = ($str != $oldstr); # KLUDGY!!! |
$foo = ($str != $oldstr); # KLUDGY!!! |
92 |
function Compose() { |
function Compose() { |
93 |
global $_composed; |
global $_composed; |
94 |
if (!$_composed) { |
if (!$_composed) { |
95 |
global $sifra, $language; |
global $sifra, $language, $REMOTE_ADDR; |
96 |
$chars = preg_split("//", "ABCDEFGHIJKLMNOPQRSTUVW". |
$crc = md5($sifra."@".$REMOTE_ADDR); |
|
"XYZabcdefghijklmnopqrstuvwxyz0123456789", |
|
|
0, PREG_SPLIT_NO_EMPTY); |
|
|
$salt = ""; |
|
|
for ($i = 0; $i < CRYPT_SALT_LENGTH; $i++) |
|
|
$salt .= $chars[mt_rand(0, count($chars) - 1)]; |
|
|
$enc = substr(crypt($sifra, $salt), CRYPT_SALT_LENGTH); |
|
|
$lang_1 = $language[0]; |
|
|
$lang_2 = $language[1]; |
|
|
$salt_1 = substr($salt, 0, CRYPT_SALT_LENGTH / 2); |
|
|
$salt_2 = substr($salt, CRYPT_SALT_LENGTH / 2); |
|
97 |
$_composed = implode("|", array($sifra, |
$_composed = implode("|", array($sifra, |
98 |
$enc.$lang_1.$salt_1.$lang_2.$salt_2)); |
$language[1].$crc.$language[0])); |
|
$_composed = str_replace("/", "!", $_composed); |
|
99 |
} |
} |
100 |
return $_composed; |
return $_composed; |
101 |
} |
} |
102 |
function Decompose($str) { |
function Decompose($str) { |
103 |
global $sifra, $language; |
global $sifra, $language, $REMOTE_ADDR; |
104 |
$str = str_replace("!", "/", $str); |
list($sifra, $crc) = explode("|", $str); |
105 |
list($sifra, $lang) = explode("|", $str); |
$language = $crc[strlen($crc) - 1].$crc[0]; |
106 |
$enc = substr($lang, 0, -(CRYPT_SALT_LENGTH + 2)); |
if (md5($sifra."@".$REMOTE_ADDR) != substr($crc, 1, -1)) |
107 |
$lang = substr($lang, strlen($enc)); |
$sifra = ""; |
|
$lang_1 = $lang[0]; |
|
|
$salt_1 = substr($lang, 1, CRYPT_SALT_LENGTH / 2); |
|
|
$lang_2 = $lang[(CRYPT_SALT_LENGTH / 2) + 1]; |
|
|
$salt_2 = substr($lang, (CRYPT_SALT_LENGTH / 2) + 2); |
|
|
$language = $lang_1.$lang_2; |
|
|
$salt = $salt_1.$salt_2; |
|
|
$cry = substr(crypt($sifra, $salt), CRYPT_SALT_LENGTH); |
|
|
if ($cry != $enc) $sifra = ""; |
|
108 |
} |
} |
109 |
function Params($pg = -1, $more = array()) { |
function Params($pg = -1, $more = array()) { |
110 |
global $page; |
global $page; |
122 |
function nepoznato(&$sto) { |
function nepoznato(&$sto) { |
123 |
global $language; |
global $language; |
124 |
if (isset($sto) && $sto == "") { |
if (isset($sto) && $sto == "") { |
125 |
if ($language == "HR") $sto = "[nepoznato]"; |
switch ($language) { |
126 |
if ($language == "EN") $sto = "[unknown]"; |
case "HR": $sto = "[nepoznato]"; break; |
127 |
|
case "EN": $sto = "[unknown]"; break; |
128 |
|
} |
129 |
$sto = "<I>$sto</I>"; |
$sto = "<I>$sto</I>"; |
130 |
} |
} |
131 |
} |
} |
132 |
function Auth() { |
function Auth() { |
133 |
global $sifra; |
global $sifra, $PHP_SELF; |
134 |
if ($sifra) return true; |
if ($sifra) return true; |
135 |
Header("Location: index.php?x="); |
Header("Location: index.php?x="); |
136 |
return false; |
return false; |
137 |
} |
} |
138 |
Header("Pragma: no-cache"); |
Header("Pragma: no-cache"); |
139 |
|
if ($ID) Decompose($ID); |
140 |
if (!isset($language) || !$language) $language = "HR"; |
if (!isset($language) || !$language) $language = "HR"; |
141 |
if (!isset($sifra) || !$sifra) $sifra = ""; |
if (!isset($sifra) || !$sifra) $sifra = ""; |
|
if ($ID) Decompose($ID); |
|
|
unset($ID); |
|
142 |
include_once("inc/MySmarty.php"); |
include_once("inc/MySmarty.php"); |
143 |
?> |
?> |