Toon posts:

Javascript in php plaatsen

Pagina: 1
Acties:
  • 50 views sinds 30-01-2008

Verwijderd

Topicstarter
Ik ben bezig met een soort woorden filter.
Nou wil ik de woorden die gefilterd moeten worden uit een txt bestand halen nou zet ik het javascript in php en zegt die
Parse error: parse error, unexpected T_INCLUDE in /home/skyclub/public_html/fotoboek/fotoboek1.php on line 48
lijn 48 is dit in het script
echo " cmp=" " "" include('woordenfilter.txt');"" " ";";
iemand een id ??

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<? 
echo "<SCRIPT LANGUAGE='JavaScript'>"; 
echo "<!-- Hide from JavaScript-Impaired Browsers "; 
/* This routine does not create an alert box.  Instead 
   it simply replaces any words you decide are offensive 
   at your Web Site with curse symbols. The "smut" string 
   may be replaced with "xxx" or anything you deem more 
   appropriate. The "cmp" string should be comprised only 
   of words you don't wish to appear in postings or 
   submissions at YOUR Web Site. (Some folks use this 
   function to "bleep out" competitor's names) If you 
   lengthen or shorten the list, be sure to change the 
   stop number in the "for" loop (i<16 here, because 16 
   words in the list. 
   Don't forget a space after the last word in your own 
   list of "forbidden" words. */ 
echo "function smutEngine() {"; 
echo " smut=" &quot; "#@&*%!#@&*%!#@&*%!" &quot; ";"; 
echo " cmp=" &quot; "" include('woordenfilter.txt');"" &quot; ";"; 
echo " txt=document.post.reactie.value;"; 
echo " tstx=" &quot; "" &quot; ";"; 
echo " for (var i=0;i<999999999999;i++){"; 
echo "  pos=cmp.indexOf(" &quot; " " &quot; ");"; 
echo "  wrd=cmp.substring(0,pos);"; 
echo "  wrdl=wrd.length"; 
echo "  cmp=cmp.substring(pos+1,cmp.length);"; 
echo "  while (txt.indexOf(wrd)>-1){"; 
echo "   pos=txt.indexOf(wrd);"; 
echo "   txt=txt.substring(0,pos)+smut.substring(0,wrdl)"; 
echo "   +txt.substring((pos+wrdl),txt.length);"; 
echo "  }"; 
echo " }" 
echo " document.post.reactie.value=txt;"; 
echo "}"; 
echo "</script>"; 
?>

  • LuCarD
  • Registratie: Januari 2000
  • Niet online

LuCarD

Certified BUFH

; vergeten
standaard debug werk

Programmer - an organism that turns coffee into software.


  • gorgi_19
  • Registratie: Mei 2002
  • Laatst online: 14:40

gorgi_19

Kruimeltjes zijn weer op :9

Niets verder aan te vullen op LuCarD :) Kijkenwaar het fout gaat en controleren of alle zaken goed escaped zijn en of je geen PHP afsluitingskarakters mist :) Hoewel ik me in dit geval afvraag of het niet beter is om de Javascript buiten de PHP code te zetten :)

Digitaal onderwijsmateriaal, leermateriaal voor hbo


Dit topic is gesloten.