Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Can I ..

Status
Not open for further replies.

apphog

MIS
Nov 1, 2001
33
US
Hello People

I need a perl code that can stop a java script to run.

I did put a simple one line chatting box on my website but some people put java script on chatting box to mess up my website...

Is there any way to stop this??


thank you in advance

and sorry about my poor english


thank you again
 
Here is the code... I didn't write this code I got it from friend

thank you in advance..



#!/usr/bin/perl


print "Content-type: text/html\n\n";

#################### Here ReadParse() Routine #####################

if($ENV{'QUERY_STRING'}) { $buffer=$ENV{'QUERY_STRING'}; }

else { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); }

@pairs=split(/&/,$buffer);

foreach $pair (@pairs) {
($name, $value)=split(/=/, $pair);
$value=~tr/+/ /;
$value=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value=~s/\|/\&\#124\;/g;
$value =~ s/\n/<br>/g;
$FORM{$name}=$value;
}



$usr_ip=$ENV{'REMOTE_ADDR'};
$usr_count=0;

&GetDate();

open(DATA, &quot;>./logs/$usr_ip&quot;);
print DATA time;
close(DATA);

opendir(LOG_DIR, &quot;./logs&quot;);
@FILES=readdir(LOG_DIR);
closedir(LOG_DIR);

foreach $file (@FILES) {

if (($file ne &quot;.&quot;) && ($file ne &quot;..&quot;)) {

open(DATA, &quot;./logs/$file&quot;);
@LINES=<DATA>;
close(DATA);

if( (time - $LINES[0]) < 20 ) { ++$usr_count; }
else { system &quot;rm -rf ./logs/$file&quot;; }

}
}

if($FORM{'coment'}) {
open(CHAT,&quot;>./coment.log&quot;);
print CHAT $FORM{'coment'};
close(CHAT);
}

open(CHAT,&quot;./coment.log&quot;);
@LINE=<CHAT>;
close(CHAT);

$coment=$LINE[0];
$comment=~tr/</ /;
$comment=~tr/>/ /;


&PrintResult();

exit;


sub GetDate() {
($sec,$min,$hour,$mday,$mon,$wday,$yday,$isdst) = localtime(time);
if ($sec < 10) { $sec = &quot;0$sec&quot;; }
if ($min < 10) { $min = &quot;0$min&quot;; }
if ($hour < 10) { $hour = &quot;0$hour&quot;; }
if ($mday < 10) { $mday = &quot;0$mday&quot;; }
if ($mon < 10) { $mon = &quot;0$mon&quot;; }
$month = ($mon + 1);
if ($month < 10) { $month = &quot;0$month&quot;; }
$date = &quot; $month¿ù $mdayÀÏ $hour½Ã $minºÐ&quot;;
}


######################## Ãâ·ÂºÎ ÃëÇâ¿¡ µû¶ó ¼öÁ¤ »ç¿ëÇϼ¼¿ä ! ##############################


sub PrintResult() {
print<<END;
<title>¢º $coment </title>
<meta http-equiv=&quot;refresh&quot; content=&quot;7;url=./login.cgi&quot;>
<style type=&quot;text/css&quot;>
<!--
body,td,select,input,div,form,textarea,center,table {font-size:8pt;font-family:µ¸¿ò;}
P,clockquote,table,br {font-size:8pt;font-family:µ¸¿ò;}
a:link {color:white;text-decoration: none; }
a:visited {color:white;text-decoration: none; }
a:hover {color:white;text-decoration: none; }
-->
</style>
</head>

<body bgcolor=&quot;#000000&quot; link=&quot;blue&quot; vlink=&quot;purple&quot;
alink=&quot;red&quot;>

<div align=&quot;right&quot;><table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;
height=&quot;18&quot;>
<tr>
<td valign=&quot;bottom&quot;><p align=&quot;left&quot;>
<font size=&quot;2&quot; color=&quot;#999999&quot;>¡¼ $coment ¡½</font></td>
<td valign=&quot;bottom&quot;><p align=&quot;right&quot;>
<font size=&quot;2&quot; color=&quot;#555555&quot;> ÇöÀçÁ¢¼ÓÀÚ </font><font size=&quot;2&quot; color=&quot;#ffffff&quot;><b>$usr_count</b></font><font
size=&quot;2&quot; color=&quot;#555555&quot;>¸í </font></td>
</tr>
</table></div>
</body>

</html>
END
}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top