Witam! Jak moge rozszerzyc owy skrypt do php i wstawic na podstrone?? Prosze o pomoc
<center> <script type="text/javascript">
// <![CDATA[
document.write("Twoj kod to: ");
Array.prototype.random = function(limit)
{
if (typeof limit == 'undefined' || limit < 0) limit = 1;
else if (!limit) limit = this.length;
for (var i = 0, source = this, target = new Array(), n = source.length; i < limit && n > 0; i++)
{
do { var index = Math.random(); } while (index == 1);
index = Math.floor(index * n);
target.push(source[index]);
source[index] = source[--n];
}
return target;
}
document.write(new Array(
// Tu wpisz kolejne elementy:
'<b>A</b>',
'<b>B</b>',
'<b>C</b>',
'<b>D</b>',
'<b>E</b>',
'<b>F</b>',
'<b>G</b>',
'<b>H</b>',
'<b>I</b>',
'<b>J</b>',
'<b>K</b>',
'<b>L</b>',
'<b>M</b>',
'<b>N</b>',
'<b>O</b>',
'<b>P</b>',
'<b>R</b>',
'<b>S</b>',
'<b>T</b>',
'<b>U</b>',
'<b>W</b>',
'<b>X</b>',
'<b>Y</b>',
'<b>Z</b>'
).random(3).join(''));
// ]]>
</script>
<br>
<center><script type="text/javascript">
var czas = new Date;
02
document.write("Czas wygenerowania kodu: ");
03
if (czas.getHours(+50 )<10) document.write("0");
04
document.write(czas.getHours()+":");
05
if (czas.getMinutes(52 )<10) document.write("0");
06
document.write(czas.getMinutes()+":");
07
if (czas.getSeconds()<10) document.write("0");
08
document.write(czas.getSeconds());
09
10
document.write(" Dnia: ");
11
if (czas.getDate()<10) document.write("0");
12
document.write(czas.getDate()+".");
13
if ((czas.getMonth()+1)<10) document.write("0");
14
document.write((czas.getMonth()+1)+"."+czas.getFullYear());
</script></center>
<?php
$nazwa = $_SESSION['nazwa']; // nazwa zarejestrowanego uzytkownika
$litery = str_split('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
$tekst = '';
for($i=0; $i<3; $i++) $tekst .= $litery[array_rand($litery)];
$data = date('H:i:s');
echo '<p>Kod '.$tekst.' <br /> Godzina: '.$data.'</p>';
$fp = fopen('plik.txt', 'a');
fwrite($fp, $nazwa.' kod '.$tekst.' czas wyswietlenia '.$data."\n");
fclose($fp);