da die Boardsuche nichts ergeben hat und ich per Google zu keinem Ergebniss komme, wende ich mich an euch.
Mein Anliegen: Ich möchte auf der Startseite meines Forums per Javascript ein wenig Schnee rieseln lassen.
Mein Problem: Wie kann ich in einer PHP-Datei Javascript unterbringen?
Hier mal die index.php des Forums:
<?php $filename = 'index.php'; require('./global.php'); $lang->load('START'); require('./acp/lib/class_useronline.php'); if (isset($_COOKIE[$cookieprefix.'hidecats'])) $hidecats = decode_cookie($_COOKIE[$cookieprefix.'hidecats']); else $hidecats = array(); if (isset($_GET['hidecat'])) { $hidecats[$_GET['hidecat']] = 1; if ($wbbuserdata['usecookies'] == 1) encode_cookie("hidecats", time() + 3600 * 24 * 365); else encode_cookie("hidecats"); } if (isset($_GET['showcat'])) { $hidecats[$_GET['showcat']] = 0; if ($wbbuserdata['usecookies'] == 1) encode_cookie("hidecats", time() + 3600 * 24 * 365); else encode_cookie("hidecats"); } $boardcache = array(); $permissioncache = array(); $modcache = array(); switch ($boardordermode) { case 1: $boardorder = 'b.title ASC'; break; case 2: $boardorder = 'b.title DESC'; break; case 3: $boardorder = 'b.lastposttime DESC'; break; default: $boardorder = 'b.boardorder ASC'; break; } $activtime = time() - 60 * $useronlinetimeout; $boardvisit = array(); $result = $db->unbuffered_query(" SELECT b.*".(($showlastposttitle == 1) ? (", t.topic, t.prefix AS threadprefix, i.*") : (""))." ".(($showuseronlineinboard == 1) ? (", COUNT(s.sessionhash) AS useronline") : (""))." ".(($wbbuserdata['userid']) ? (", bv.lastvisit") : (""))." FROM bb".$n."_boards b ".(($showlastposttitle == 1) ? ("LEFT JOIN bb".$n."_threads t ON (t.threadid=b.lastthreadid) LEFT JOIN bb".$n."_icons i USING (iconid)") : (""))." ".(($showuseronlineinboard == 1) ? ("LEFT JOIN bb".$n."_sessions s ON (s.boardid=b.boardid AND s.lastactivity>='$activtime')") : (""))." ".(($wbbuserdata['userid']) ? (" LEFT JOIN bb".$n."_boardvisit bv ON (bv.boardid=b.boardid AND bv.userid='".$wbbuserdata['userid']."')") : (""))." ".(($showuseronlineinboard == 1) ? ("GROUP BY b.boardid") : (""))." ORDER by b.parentid ASC, $boardorder"); while ($row = $db->fetch_array($result)) { $boardcache[$row['parentid']][$row['boardorder']][$row['boardid']] = $row; $boardvisit[$row['boardid']] = $row['lastvisit']; } if ($showuseronlineinboard == 2) { $userinboard = array(); $online = &new useronline($wbbuserdata['a_can_view_ghosts'], $wbbuserdata['buddylist']); $result = $db->unbuffered_query("SELECT s.userid, s.boardid, u.username, u.useronlinegroupid,g.useronlinemarking, u.invisible FROM bb".$n."_sessions s LEFT JOIN bb".$n."_users u USING (userid) LEFT JOIN bb".$n."_groups g ON g.groupid=u.useronlinegroupid WHERE s.lastactivity>='$activtime'".(($wbbuserdata['ignorelist']) ? (" AND s.userid NOT IN (".str_replace(" ", ",", $wbbuserdata['ignorelist']).")") : (""))." ORDER BY u.username ASC"); while ($row = $db->fetch_array($result)) $userinboard[$row['boardid']][] = $row; } $result = $db->unbuffered_query("SELECT t.boardid, t.threadid, t.lastposttime".(($wbbuserdata['userid']) ? (", tv.lastvisit") : (""))." FROM bb".$n."_threads t".(($wbbuserdata['userid']) ? (" LEFT JOIN bb".$n."_threadvisit tv ON (tv.threadid=t.threadid AND tv.userid='".$wbbuserdata['userid']."')") : (""))." WHERE t.visible = 1 AND t.lastposttime > '$wbbuserdata[lastvisit]' AND t.closed <> 3"); while ($row = $db->fetch_array($result)) { if ($row['lastposttime'] > $row['lastvisit']) $visitcache[$row['boardid']][$row['threadid']] = $row['lastposttime']; } // read permissions $permissioncache = getPermissions(); if ($hide_modcell == 0) { $result = $db->unbuffered_query("SELECT bb".$n."_moderators.*, username FROM bb".$n."_moderators LEFT JOIN bb".$n."_users USING (userid) ORDER BY username ASC"); while ($row = $db->fetch_array($result)) $modcache[$row['boardid']][] = $row; } $boardbit = makeboardbit(0); $index_pms = ''; $quicklogin = ''; $index_showevents = ''; $index_useronline = ''; $index_stats = ''; /* ############## STATS ############## */ if ($showstats == 1) { $stats = $db->query_first("SELECT s.*, u.username FROM bb".$n."_stats s LEFT JOIN bb".$n."_users u ON(u.userid=s.lastuserid)"); $stats['username'] = htmlconverter($stats['username']); $installdays = (time() - $installdate) / 86400; if ($installdays < 1) $postperday = $stats['postcount']; else $postperday = $stats['postcount'] / $installdays; $postperday = number_format($postperday, 2, $lang->get("LANG_GLOBAL_DEC_POINT"), $lang->get("LANG_GLOBAL_THOUSANDS_SEP")); if ($stats['usercount'] >= 1000) $stats['usercount'] = number_format($stats['usercount'], 0, "", $lang->get("LANG_GLOBAL_THOUSANDS_SEP")); if ($stats['threadcount'] >= 1000) $stats['threadcount'] = number_format($stats['threadcount'], 0, "", $lang->get("LANG_GLOBAL_THOUSANDS_SEP")); if ($stats['postcount'] >= 1000) $stats['postcount'] = number_format($stats['postcount'], 0, "", $lang->get("LANG_GLOBAL_THOUSANDS_SEP")); } /* ############## USERONLINE ############## */ if ($showuseronline == 1) { $guestcount = 0; $membercount = 0; $invisiblecount = 0; $online = &new useronline($wbbuserdata['a_can_view_ghosts'], $wbbuserdata['buddylist']); $result = $db->unbuffered_query("SELECT s.userid, username, useronlinegroupid, useronlinemarking, invisible FROM bb".$n."_sessions s LEFT JOIN bb".$n."_users u USING (userid) LEFT JOIN bb".$n."_groups g ON g.groupid=u.useronlinegroupid WHERE s.lastactivity >= '".(time() - 60 * $useronlinetimeout)."'".(($wbbuserdata['ignorelist']) ? (" AND s.userid NOT IN (".str_replace(" ", ",", $wbbuserdata['ignorelist']).")") : (""))." ORDER BY u.username ASC"); while ($row = $db->fetch_array($result)) { if ($row['userid'] == 0) { $guestcount++; continue; } $membercount++; if ($row['invisible'] == 1) $invisiblecount++; $online->user($row['userid'], htmlconverter($row['username']), $row['useronlinemarking'], $row['invisible']); } $useronline = $online->useronlinebit; $totaluseronline = $membercount + $guestcount; if ($totaluseronline > $rekord) { $rekord = $totaluseronline; $rekordtime = time(); $db->unbuffered_query("UPDATE bb".$n."_options SET value='$rekord' WHERE varname='rekord'", 1); $db->unbuffered_query("UPDATE bb".$n."_options SET value='$rekordtime' WHERE varname='rekordtime'", 1); require("./acp/lib/class_options.php"); $option = &new options("acp/lib"); $option->write(); } $rekorddate = formatdate($wbbuserdata['dateformat'], $rekordtime); $rekordtime = formatdate($wbbuserdata['timeformat'], $rekordtime); // format figures if ($guestcount >= 1000) $guestcount = number_format($guestcount, 0, "", $lang->get("LANG_GLOBAL_THOUSANDS_SEP")); if ($membercount >= 1000) $membercount = number_format($membercount, 0, "", $lang->get("LANG_GLOBAL_THOUSANDS_SEP")); if ($invisiblecount >= 1000) $invisiblecount = number_format($invisiblecount, 0, "", $lang->get("LANG_GLOBAL_THOUSANDS_SEP")); if ($totaluseronline >= 1000) $totaluseronline = number_format($totaluseronline, 0, "", $lang->get("LANG_GLOBAL_THOUSANDS_SEP")); if ($rekord >= 1000) $rekord = number_format($rekord, 0, "", $lang->get("LANG_GLOBAL_THOUSANDS_SEP")); if ($totaluseronline == 1) { $useronline_BE = $lang->items['LANG_START_USERONLINE_BE_ONE']; $useronline_USER = $lang->items['LANG_START_USERONLINE_USER_ONE']; } else { $useronline_BE = $lang->items['LANG_START_USERONLINE_BE']; $useronline_USER = $lang->items['LANG_START_USERONLINE_USER']; } if ($guestcount == 1) $useronline_GUEST = $lang->items['LANG_START_USERONLINE_GUEST_ONE']; elseif ($guestcount > 1) $useronline_GUEST = $lang->items['LANG_START_USERONLINE_GUEST']; else { $useronline_GUEST = ''; $guestcount = ''; } if ($membercount == 1) $useronline_MEMBERS = $lang->items['LANG_START_USERONLINE_MEMBERS_ONE']; elseif ($membercount > 1) $useronline_MEMBERS = $lang->items['LANG_START_USERONLINE_MEMBERS']; else { $useronline_MEMBERS = ''; $membercount = ''; } if ($invisiblecount == 1) $useronline_GHOSTS = $lang->items['LANG_START_USERONLINE_GHOSTS_ONE']; elseif ($invisiblecount > 1) $useronline_GHOSTS = $lang->get("LANG_START_USERONLINE_GHOSTS", array('$invisiblecount' => $invisiblecount)); else $useronline_GHOSTS = ''; if ($guestcount > 0 && $membercount > 0) $useronline_AND = $lang->items['LANG_START_USERONLINE_AND']; else $useronline_AND = ''; $lang->items['LANG_START_USERONLINE'] = $lang->get("LANG_START_USERONLINE", array('$useronline_BE' => $useronline_BE, '$membercount' => $membercount, '$useronline_MEMBERS' => $useronline_MEMBERS, '$useronline_GHOSTS' => $useronline_GHOSTS, '$useronline_AND' => $useronline_AND, '$guestcount' => $guestcount, '$useronline_GUEST' => $useronline_GUEST, '$rekord' => $rekord, '$useronline_USER' => $useronline_USER, '$rekorddate' => $rekorddate, '$rekordtime' => $rekordtime)); $lang->items['LANG_START_SHOWUSERONLINE'] = $lang->get("LANG_START_SHOWUSERONLINE", array('$useronline_BE' => $useronline_BE, '$totaluseronline' => $totaluseronline, '$useronline_USER' => $useronline_USER)); } /* ############## BIRTHDAYS ############## */ unset($birthdaybit); if ($showbirthdays == 1 && $wbbuserdata['can_view_calendar'] != 0) { $currentdate = formatdate("m-d", time()); $currentyear = intval(formatdate("Y", time())); $result = $db->unbuffered_query("SELECT userid, username, birthday FROM bb".$n."_users WHERE birthday LIKE '%-$currentdate' ORDER BY username ASC"); while ($row = $db->fetch_array($result)) { $row['username'] = htmlconverter($row['username']); $birthyear = intval(wbb_substr($row['birthday'], 0, 4)); $age = $currentyear - $birthyear; if ($age < 1 || $age > 200) $age = ''; else $age = " ($age)"; if (isset($birthdaybit)) eval("\$birthdaybit .= \"".$tpl->get("index_birthdaybit")."\";"); else eval("\$birthdaybit = \"".$tpl->get("index_birthdaybit")."\";"); } } /* ############## EVENTS ############## */ unset($eventbit); if ($showevents == 1 && $wbbuserdata['can_view_calendar'] != 0) { $currentdate = date("Y-m-d"); $result = $db->unbuffered_query("SELECT eventid, subject, public FROM bb".$n."_events WHERE eventdate = '$currentdate' AND (public=2 OR (public=0 AND userid = '$wbbuserdata[userid]')) ORDER BY public ASC, subject ASC"); while ($row = $db->fetch_array($result)) { $row['subject'] = htmlconverter($row['subject']); if (isset($eventbit)) eval("\$eventbit .= \"".$tpl->get("index_eventbit")."\";"); else eval("\$eventbit = \"".$tpl->get("index_eventbit")."\";"); } } if (!$wbbuserdata['userid']) { $lang->items['LANG_START_WELCOME_TITLE'] = $lang->get("LANG_START_WELCOME_TITLE", array('$master_board_name' => $master_board_name)); $lang->items['LANG_START_WELCOME'] = $lang->get("LANG_START_WELCOME", array('$SID_ARG_2ND' => $SID_ARG_2ND, '$SID_ARG_1ST' => $SID_ARG_1ST)); } else { $currenttime = formatdate($wbbuserdata['timeformat'], time()); $toffset = (($wbbuserdata['timezoneoffset'] >= 0) ? ("+") : ("")).$wbbuserdata['timezoneoffset']; $lang->items['LANG_START_TIMEZONE'] = $lang->get("LANG_START_TIMEZONE", array('$toffset' => $toffset)); $lastvisitdate = formatdate($wbbuserdata['dateformat'], $wbbuserdata['lastvisit'], 1); $lastvisittime = formatdate($wbbuserdata['timeformat'], $wbbuserdata['lastvisit']); if ($showpmonindex == 1 && $wbbuserdata['can_use_pms'] == 1 && $wbbuserdata['receivepm'] == 1) { $counttotal = $wbbuserdata['pminboxcount']; $countunread = $wbbuserdata['pmunreadcount']; $countnew = $wbbuserdata['pmnewcount']; if ($countnew == 1) $pms_NEWMESSAGE = $lang->items['LANG_START_PMS_MESSAGE']; else $pms_NEWMESSAGE = $lang->items['LANG_START_PMS_MESSAGES']; if ($counttotal == 1) $pms_TOTALMESSAGE = $lang->items['LANG_START_PMS_MESSAGE']; else $pms_TOTALMESSAGE = $lang->items['LANG_START_PMS_MESSAGES']; $lang->items['LANG_START_PMS'] = $lang->get("LANG_START_PMS", array('$countnew' => $countnew, '$pms_NEWMESSAGE' => $pms_NEWMESSAGE, '$countunread' => $countunread, '$counttotal' => $counttotal, '$pms_TOTALMESSAGE' => $pms_TOTALMESSAGE)); } } eval("\$tpl->output(\"".$tpl->get("index")."\");"); ?>
Und das java script:
<script language="JavaScript"> var snowsrc="gfxu/snow.gif" var no = 10; var ns4 = (document.layers) ? 1 : 0; var ie = (document.all ) ? 1 : 0; var dom = (document.getElementById && !document.all) ? 1 : 0; var dx, xp, yp; var am, stx, sty; var i; var doc_width = screen.availWidth; var doc_height = screen.availHeight; if (ns4) { doc_width = self.innerWidth; doc_height = self.innerHeight; } else if (ie) { doc_width = document.body.clientWidth; doc_height = document.body.clientHeight; } else if (dom) { doc_width = document.body.clientWidth; doc_height = document.body.clientHeight; } dx = new Array(); xp = new Array(); yp = new Array(); am = new Array(); stx = new Array(); sty = new Array(); for (i = 0; i < no; ++ i) { dx[i] = 0; xp[i] = Math.random()*(doc_width-50); yp[i] = Math.random()*doc_height; am[i] = Math.random()*20; stx[i] = 0.02 + Math.random()/10; sty[i] = 0.7 + Math.random(); if (ns4) { if (i == 0) { document.write("<layer name='dot"+ i +"' left='-20' top='-20' visibility='show'><img src='"+snowsrc+"' border='0'></layer>"); } else { document.write("<layer name='dot"+ i +"' left='-20' top='-20' visibility='show'><img src='"+snowsrc+"' border='0'></layer>"); } } else if (ie) { if (i == 0) { document.write("<div id='dot"+ i +"' style='position:absolute; z-index:"+ i +"; visibility:visible; top:-20px; left:-20px;'><img src='"+snowsrc+"' border='0'></div>"); } else { document.write("<div id='dot"+ i +"' style='position:absolute; z-index:"+ i +"; visibility:visible; top:-20px; left:-20px;'><img src='"+snowsrc+"' border='0'></div>"); } } else if (dom) { if (i == 0) { document.write("<div id='dot"+ i +"' style='position:absolute; z-index:"+ i +"; visibility:visible; top:-20px; left:-20px;'><img src='"+snowsrc+"' border='0'></div>"); } else { document.write("<div id='dot"+ i +"' style='position:absolute; z-index:"+ i +"; visibility:visible; top:-20px; left:-20px;'><img src='"+snowsrc+"' border='0'></div>"); } } } function snowNS4() { for (i = 0; i < no; ++ i) { yp[i] += sty[i]; if (yp[i] > doc_height-50) { xp[i] = Math.random()*(doc_width-am[i]-30); yp[i] = 0; stx[i] = 0.02 + Math.random()/10; sty[i] = 0.7 + Math.random(); doc_width = self.innerWidth; doc_height = self.innerHeight; } dx[i] += stx[i]; document.layers["dot"+i].top = yp[i]; document.layers["dot"+i].left = xp[i] + am[i]*Math.sin(dx[i]); } setTimeout("snowNS4()", 10); } function snowIE() { for (i = 0; i < no; ++ i) { yp[i] += sty[i]; if (yp[i] > doc_height-50) { xp[i] = Math.random()*(doc_width-am[i]-30); yp[i] = 0; stx[i] = 0.02 + Math.random()/10; sty[i] = 0.7 + Math.random(); doc_width = document.body.clientWidth; doc_height = document.body.clientHeight; } dx[i] += stx[i]; document.all["dot"+i].style.pixelTop = yp[i]; document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]); } setTimeout("snowIE()", 10); } function snowDOM() { for (i = 0; i < no; ++ i) { yp[i] += sty[i]; if (yp[i] > doc_height-50) { xp[i] = Math.random()*(doc_width-am[i]-30); yp[i] = 0; stx[i] = 0.02 + Math.random()/10; sty[i] = 0.7 + Math.random(); doc_width = document.body.clientWidth; doc_height = document.body.clientHeight; } dx[i] += stx[i]; document.getElementById("dot"+i).style.top = yp[i]; document.getElementById("dot"+i).style.left = xp[i] + am[i]*Math.sin(dx[i]); } setTimeout("snowDOM()", 10); } if (ns4) { snowNS4(); } else if (ie) { snowIE(); } else if (dom) { snowDOM(); } </script>
Ich würde gerne wissen wie ich das Script nun in PHP einbinden kann und würde mich sehr freuen wenn es mir jemand erklären könnte.
MfG Sanctus