április 4th, 2007 by Tana
// auto set iframe container div height to content iframe height
function iFrameHeight(framename) {
if(document.getElementById && !(document.all))
{
h = document.getElementById(framename).contentDocument.body.scrollHeight;
document.getElementById(framename).height = h+40;
}
else if(document.all)
{
h = document.frames(framename).document.body.scrollHeight;
document.all.contframe.style.height = h;
}
Posted in php |
No Comments »
április 4th, 2007 by Tana
// Change textarea color, when focused :
$(function(){
$("TEXTAREA").focus(function(){
$(this).css({color: "black", background: "#F0F8FF"});
})
})
$(function(){
$("TEXTAREA").blur(function(){
$(this).css({color: "black", background: "white"});
})
})
// hide all element in frame : "contframe", which element class begin with "opciotetel" :
contframe.$("[@class^=opciotetel]").hide();
Posted in php |
No Comments »
február 5th, 2007 by Tana
set the div minimal height
min-height:400px;
height: expression(this.scrollHeight < 400? "400px" : "auto" );
Picture in other picture
<div style="height:30px;overflow:hidden;">
<a href=""><img src="/images/system/menu/kep_menu.png" /></a>
<a href=""><img style="position:relative;top:-26px;left:10px;" src="/button.png" /></a>
</div>
Posted in php |
No Comments »
január 22nd, 2007 by Tana
<body onLoad="loadtime()">
…..
function createtime()
{
var time = new Date()
var hours = time.getHours()
var minutes = time.getMinutes()
var seconds = time.getSeconds()
var abbrev = "AM"
if (hours==0) hours=12
if (minutes<=9) minutes="0"+minutes
if (seconds<=9) seconds="0"+seconds
var ctime=""+hours+":"+minutes+":"+seconds
if (document.all) document.all.clock.innerHTML=ctime
else if (document.getElementById) document.getElementById("clock").innerHTML=ctime
else
document.write(ctime)
}
if (!document.all&&!document.getElementById) createtime()
function loadtime()
{
if (document.all||document.getElementById) setInterval("createtime()",1000)
}
Posted in php |
No Comments »
január 22nd, 2007 by Tana
<a href="javascript: document.formneve.submit()"><img src="/submit.jpg" /></a>
Posted in php |
No Comments »
január 22nd, 2007 by Tana
Gyakran van rá szükség, hogy távolságtartás miatt divet hozzunk létre. Ha a div magassága kisebb, mint 1em és üres, az Explorer nem jeleníti meg rendesen. Ilyenkor kell a divbe egy kis tartalom :
<div id="topmenu_bottom"><!– –></div>
Posted in php |
2 Comments »
január 22nd, 2007 by Tana
// smarty változó létrehozása
{assign var=
"lastsites" value=$sites
[tetel
].
site}
// toggle color
{cycle values=‘white, #CCCCCC’ assign="sorszin"}
// get array size
{if $formdata|@count == "0"}
// cycle
{section name=tetel loop=$domainlist}
{$domainlist[tetel].mezoneve}
{/section}
// osztás maradék lekérdezése
{if $smarty.section.tetel.index%3 == "2"}
// truncate
{$kepek[tetel].picture_text|truncate:65:"…":true}
Posted in php |
No Comments »
január 20th, 2007 by Tana
Ez kerül a html-be az oldal betöltésekor :
tinyMCE.init({
content_css : "style/tinymce.css",
mode : "textareas",
external_image_list_url : "picfilelist.php",
});
Ez pedig a képlista generáló php (csak a tn_ kezdődő jpg file-kat teszi a listába) :
header("Content-type: text/javascript");
echo "var tinyMCEImageList = new Array(\n";
$d = dir(UPLOADED_IMAGES_DIR);
$counter=0;
while (false !== ($entry = $d->read()))
{
if (substr($entry,0,3)=="tn_")
{
$fullfile = UPLOADED_IMAGES_DIR. $entry;
if ($counter<>0)
{
echo ",";
}
echo "[’$entry’, ’$fullfile’]\n";
$counter = $counter + 1;
}
}
$d->close();
echo ");";
Posted in php |
No Comments »
január 20th, 2007 by Tana
function md5crypt
($pw,
$pw_db=
"",
$magic=
"")
{
$MAGIC =
"$1$";
$salt = "";
$split_salt = preg_split (‘/\$/’, $pw_db);
if (isset ($split_salt[2])) $salt = $split_salt[2];
if ($magic == "") $magic = $MAGIC;
if ($salt == "") $salt = create_salt ();
$slist = explode ("$", $salt);
if ($slist[0] == "1") $salt = $slist[1];
$salt = substr ($salt, 0, 8);
$ctx = $pw . $magic . $salt;
$final = hex2bin (md5 ($pw . $salt . $pw));
for ($i=strlen ($pw); $i>0; $i-=16)
{
if ($i > 16)
{
$ctx .= substr ($final,0,16);
}
else
{
$ctx .= substr ($final,0,$i);
}
}
$i = strlen ($pw);
while ($i > 0)
{
if ($i & 1) $ctx .= chr (0);
else $ctx .= $pw[0];
$i = $i >> 1;
}
$final = hex2bin (md5 ($ctx));
for ($i=0;$i<1000;$i++)
{
$ctx1 = "";
if ($i & 1)
{
$ctx1 .= $pw;
}
else
{
$ctx1 .= substr ($final,0,16);
}
if ($i % 3) $ctx1 .= $salt;
if ($i % 7) $ctx1 .= $pw;
if ($i & 1)
{
$ctx1 .= substr ($final,0,16);
}
else
{
$ctx1 .= $pw;
}
$final = hex2bin (md5 ($ctx1));
}
$passwd = "";
$passwd .= to64 (((ord ($final[0]) << 16) | (ord ($final[6]) << 8) | (ord ($final[12]))), 4);
$passwd .= to64 (((ord ($final[1]) << 16) | (ord ($final[7]) << 8) | (ord ($final[13]))), 4);
$passwd .= to64 (((ord ($final[2]) << 16) | (ord ($final[8]) << 8) | (ord ($final[14]))), 4);
$passwd .= to64 (((ord ($final[3]) << 16) | (ord ($final[9]) << 8) | (ord ($final[15]))), 4);
$passwd .= to64 (((ord ($final[4]) << 16) | (ord ($final[10]) << 8) | (ord ($final[5]))), 4);
$passwd .= to64 (ord ($final[11]), 2);
return "$magic$salt\$$passwd";
}
function create_salt ()
{
srand ((double) microtime ()*1000000);
$salt = substr (md5 (rand (0,9999999)), 0, 8);
return $salt;
}
function hex2bin ($str)
{
$len = strlen ($str);
$nstr = "";
for ($i=0;$i<$len;$i+=2)
{
$num = sscanf (substr ($str,$i,2), "%x");
$nstr.=chr ($num[0]);
}
return $nstr;
}
function to64 ($v, $n)
{
$ITOA64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
$ret = "";
while (($n - 1) >= 0)
{
$n–;
$ret .= $ITOA64[$v & 0×3f];
$v = $v >> 6;
}
return $ret;
}
Posted in php |
No Comments »