Torna indietro   Serverplan Forum > Risorse per Webmaster > PHP

Rispondi
 
LinkBack Strumenti discussione Modalità visualizzazione
  #1 (permalink)  
Vecchio 05-03-2004, 22.10.48
Member
 
Data registrazione: 23-06-2003
Residenza: Catanzaro
Messaggi: 48
vitcosca is on a distinguished road
Invia un messaggio via ICQ a vitcosca Invia un messaggio via MSN a vitcosca
Predefinito Inserire un javaScript in un file php

devo inserire questo Script:

<script type="text/javascript">
<!-- // Array ofmonth Names
var monthNames = new Array( "Gennaio","Febbraio","Marzo","Aprile","Maggio","Gi ugno","Luglio","Agosto","Settembre","Ottobre","Nov embre","Dicembre");
var now = new Date();
thisYear = now.getYear();
if(thisYear < 1900) {thisYear += 1900}; // corrections if Y2K display problem
document.write(now.getDate() + " " + monthNames[now.getMonth()] + " " + thisYear);
// -->
</script>


in questo file php (esattamente nella riga rimarcata in rosso)


<script language="JavaScript">
var speed = 100
var pause = 3000
var timerID = null
var bannerRunning = false
var ar = new Array()
ar[0] = " ..::..::..::..:: WWW.DIRITTOCANONICO.COM ::..::..::..::.. "
ar[1] = " Benvenuto!!! Qui puoi trovare..."
ar[2] = " ... materiale sul Diritto Canonico e sul Diritto Ecclesiastico......"
ar[3] = " ...se ancora non sei iscritto perch? aspetti ancora? Solo gli iscritti hanno accesso a tutte le aree del sito!"
ar[4] = " ...Iscriviti subito: ? gratis! "
var currentMessage = 0
var offset = 0
function stopBanner() {
if (bannerRunning)
clearTimeout(timerID)
bannerRunning = false
}
function startBanner() {
stopBanner()
showBanner()
}
function showBanner() {
var text = ar[currentMessage]
if (offset < text.length) {
if (text.charAt(offset) == " ")
offset++
var partialMessage = text.substring(0, offset + 1)
window.status = partialMessage
offset++ // IE sometimes has trouble with "++offset"
timerID = setTimeout("showBanner()", speed)
bannerRunning = true
} else {
offset = 0
currentMessage++
if (currentMessage == ar.length)
currentMessage = 0
timerID = setTimeout("showBanner()", pause)
bannerRunning = true
}
}
startBanner();
// -->
</script> <?php

################################################## #######
# Sunset Modificato theme for PHPNuke #
# Translation by Vittorio Coscarella #
# vittorio@coscarella.org #
################################################## #######



$thename = "Sunset";
$lnkcolor = "#035D8A";
$bgcolor1 = "#FFFFFF";
$bgcolor2 = "#006699";
$bgcolor3 = "#FFFFFF";
$bgcolor4 = "#FFFFFF";
$textcolor1 = "000000";
$textcolor2 = "000000";
$hr = 1; # 1 to have horizonal rule in comments instead of table bgcolor


function OpenTable() {
global $bgcolor1, $bgcolor2;
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"$bgcolor2\"><tr><td>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"8\" bgcolor=\"$bgcolor1\"><tr><td>\n";
}

function OpenTable2() {
global $bgcolor1, $bgcolor2;
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"$bgcolor2\" align=\"center\"><tr><td>\n";
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"8\" bgcolor=\"$bgcolor1\"><tr><td>\n";
}

function CloseTable() {
echo "</td></tr></table></td></tr></table>\n";
}

function CloseTable2() {
echo "</td></tr></table></td></tr></table>\n";
}

function FormatStory($thetext, $notes, $aid, $informant) {
global $anonymous;
if ($notes != "") {
$notes = ""._NOTE." $notes\n";
} else {
$notes = "";
}
if ("$aid" == "$informant") {
echo "<font size=\"2\" color=\"#505050\">$thetext
$notes</font>\n";
} else {
if($informant != "") {
$boxstuff = "<a href=\"modules.php?name=Your_Account&amp;op=userin fo&amp;uname=$informant\">$informant</a> ";
} else {
$boxstuff = "$anonymous ";
}
$boxstuff .= ""._WRITES." \"$thetext\" $notes\n";
echo "<font size=\"2\" color=\"#505050\">$boxstuff</font>\n";
}
}


function themeheader() {
global $slogan, $sitename, $banners;
echo "<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#035D8A\" vlink=\"#035D8A\">";
echo "
<center><table border=0 width=100% cellpadding=3 cellspacing=0><tr><td>\n\n";
echo "\n";
echo "</td>\n";
if ($banners) {
echo "<td>";
include("banners.php");
echo "</td>";
}
echo "</td></tr></table>\n";
echo "<center>[b].: <a href=\"index.php\">Home</a> [b]| Contatti [b]| Forums [b]| Il tuo Account | <a href=admin.php>Amministrazione</a> :.</center>\n";
echo "
\n";
$public_msg = public_message();
echo "$public_msg
";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td valign=top width=140>\n";

blocks(left);

echo "</td><td></td><td valign=top width=100%>\n\n\n";
}

function themefooter() {
global $index;
if ($index == 1) {
echo "</td><td></td><td valign=top width=200>\n";
blocks(right);
echo "</td>";
}
echo "</td></tr></table></td></tr></table>";
footmsg();
}


function themeindex ($aid, $informant, $time, $title, $counter, $topic, $thetext, $notes, $morelink, $topicname, $topicimage, $topictext) {
global $anonymous, $tipath;
$ThemeSel = get_theme();
if (file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
$t_image = "themes/$ThemeSel/images/topics/$topicimage";
} else {
$t_image = "$tipath$topicimage";
}
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=035D8A><tr><td>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\" bgcolor=FFFFFF><tr><td>\n";
echo "\n";
echo "<img src=\"themes/Sunset/images/bullet.gif\" border=0 hspace=3><font size=3>$title</font>
\n";
echo "<font size=1 color=035D8A>"._POSTEDBY." ";
formatAidHeader($aid);
echo " "._ON." $time $timezone ($counter "._READS.")

</font>\n";
if ("$aid" == "$informant") {
echo "<font size=2 color=000000>$thetext</font>

\n";
} else {
if ($informant != "") {
$boxstuff = "<a href=modules.php?name=Your_Account&amp;op=userinfo &uname=$informant>$informant</a> ";
} else {
$boxstuff = "$anonymous ";
}
$boxstuff .= ""._WRITES." \"$thetext\" $notes\n";
echo "<font size=2 color=000000>$boxstuff</font>

\n";
}
echo "<font size=2>$morelink</font>
<img src=themes/Sunset/images/line.gif border=0 vspace=4>\n";
echo "</td></tr></table>\n";
echo "</td></tr></table>\n";
echo "
\n\n\n";
}



function themearticle($aid, $informant, $datetime, $title, $thetext, $topic, $topicname, $topicimage, $topictext) {
global $admin, $sid, $tipath;
$ThemeSel = get_theme();
if (file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
$t_image = "themes/$ThemeSel/images/topics/$topicimage";
} else {
$t_image = "$tipath$topicimage";
}
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=035D8A><tr><td>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\" bgcolor=FFFFFF><tr><td>\n";
echo "\n";
echo "<img src=\"themes/Sunset/images/bullet.gif\" border=0 hspace=3><font size=2>$title</font>\n";
if ($admin) {
echo " [ <a href=admin.php?op=EditStory&sid=$sid>"._EDIT."</a> | <a href=admin.php?op=RemoveStory&sid=$sid>"._DELETE." </a> ]
\n";
} else {
echo "
\n";
}
echo "<font size=1 color=035D8A>"._POSTEDBY."";
formatAidHeader($aid);
echo " "._ON." $datetime
\n";
if ($informant != "") {
echo ""._CONTRIBUTEDBY." <a href=modules.php?name=Your_Account&amp;op=userinfo &uname=$informant>$informant</a>

\n";
} else {
echo ""._CONTRIBUTEDBY." $anonymous

</font>\n";
}
echo "<font size=2 color=000000>$thetext</font>

\n";
echo "</td></tr></table>\n";
echo "</td></tr></table>\n\n";
}



function themesidebox($title, $content) {
mt_srand((double)microtime()*1000000);
$rcolor = mt_rand(1, 4);
if ($rcolor == 1) {
$tcolor = "FFCC00";
} elseif ($rcolor == 2) {
$tcolor = "FFCC00";
} elseif ($rcolor == 3) {
$tcolor = "FFCC00";
} elseif ($rcolor == 4) {
$tcolor = "FFCC00";
}
echo "<table width=\"165\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td>\n";
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td>\n";
echo "<img src=\"themes/Sunset/images/left$rcolor.gif\" alt=\"\" border=\"0\" width=\"5\" height=\"19\"></td>\n";
echo "<td bgcolor=$tcolor width=\"100%\"><font size=\"2\" color=\"#000066\">..::: $title</font></td>\n";
echo "<td align=\"right\"><img src=\"themes/Sunset/images/right$rcolor.gif\" alt=\"\" border=\"0\" width=\"5\" height=\"19\"></td></tr></table>\n";
echo "</td></tr><tr><td align=\"center\" valign=\"top\">\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\" bgcolor=$tcolor><tr><td width=100%>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\" bgcolor=$tcolor><tr><td width=\"100%\" valign=\"top\" bgcolor=\"#FFFFFF\">\n";
echo "$content\n";
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td>\n";
echo "<img src=\"pixel.gif\" width=\"1\" height=\"4\" alt=\"\" border=\"0\"></td></tr></table>\n";
echo "</td></tr></table>\n";
echo "</td></tr></table>\n";
echo "</td></tr><tr>\n";
echo "<td align=\"center\" valign=\"bottom\">\n";
echo "<img width=\"100%\" height=\"5\" src=\"themes/Sunset/images/bottom$rcolor.gif\" vspace=\"0\" border=\"0\"></td></tr></table>\n";
echo "
\n\n\n";
}

?>

la riga rossa riproduce un menu testuale alla cui fine deve apparire lo Script.
Qualcuno mi puo' aiutare?
Grazie
__________________
Vittorio
http://www.coscarella.org
Rispondi citando
  #2 (permalink)  
Vecchio 08-03-2004, 21.37.00
Junior Member
 
Data registrazione: 25-02-2003
Messaggi: 20
Loth is on a distinguished road
Invia un messaggio via ICQ a Loth
Predefinito

Per inserire dell'Html (e quindi del Javascript) in un Php, puoi semplicemente chiudere il tag del php prima dell'inserimento e riaprirlo dopo.

Esempio:

Codice:
<? 
// codice php
?>
<script>alert("Io sono un Javascript");</script>
<?
// altro codice php 
?>
Ciao,
Loth
__________________
:: bruttastoria.com ::
Rispondi citando
  #3 (permalink)  
Vecchio 09-03-2004, 09.42.59
Member
 
Data registrazione: 23-06-2003
Residenza: Catanzaro
Messaggi: 48
vitcosca is on a distinguished road
Invia un messaggio via ICQ a vitcosca Invia un messaggio via MSN a vitcosca
Predefinito

GRAZIE !!! :lol:
__________________
Vittorio
http://www.coscarella.org
Rispondi citando
Rispondi

Strumenti discussione
Modalità visualizzazione

Regole di scrittura
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Attivato
Le faccine sono Attivato
Il codice [IMG] è Attivato
Il codice HTML è Disattivato
Trackbacks are Attivato
Pingbacks are Attivato
Refbacks are Attivato


Discussioni simili
Discussione Autore discussione Forum Risposte Ultimo messaggio
Inserire date con php plauto PHP 3 10-08-2005 15.13.02
javascript ed emoticons Mathew HTML 2 16-03-2004 23.05.39
Inject javascript url in history list (revisited) serverplan Vulnerabilità 0 05-02-2004 13.06.18
Javascript PopUp assone CGI - PERL - SCRIPT 0 24-11-2003 18.02.33
Forum - Inserire.. webbeloz PHP 3 23-07-2003 00.12.52


Tutti gli orari sono GMT +1. Adesso sono le 22.46.25.


Powered by vBulletin versione 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0
Traduzione italiana : www.vbulletin.it