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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Masking last 3 digits of IP? (Perl CGI Chat)

Status
Not open for further replies.

mnemo

Technical User
Jun 3, 2003
3
NL
Does anyone know how to mask the last 3 digits of an IP? I'm restoring an old chatroom to it's former state and this was included. Now I managed to include the whole IP along with the messages being posted, but I would like to mask out the last 3 digits (better the digits behind the last dot, may it be one, two or three digits behind it.) and replace them with ***. So It would look like this 213.84.7.*** instead of 213.84.7.13. Any help would be very appreciated, I know for someone with decent knowledge of perl, maybe with a good look at the script he or she could help me solve it.
For an example of the chat and the script, please see ( It's the upper room) If you know how this can be solved please let me know.

Regards, Marc (mnemo)
 
There are more elegant ways but this'll get you started

Code:
$ip ="213.84.7.13";

$rip = reverse $ip;
$rip =~ s/\d+\./***\./;
$ip=reverse $rip;

HTH
Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
Without the reverse, you need to anchor the pattern to the end of the string:

Code:
$ip = "213.84.7.13";
$ip =~ s/\.\d+$/.***/;
print $ip;

If the address is not the entire string,
Code:
$logline = "12:03 213.84.7.13 404 Not Found";
$logline =~ s/((:?\d+\.){3}\d+)/$1***/;
print $logline;

That looks better with my favourite /x modifier:

Code:
$logline =~
 s/            # Substitute
   (           # collect into $1
      (:?      # a group consisting of ...
         \d+   # ...some digits...
         \.    # ... then a period...
      ){3}     # ... whole group thrice.
      \d+      # then more digits
   )           # all of that into $1.
 /             # Replace with...
   $1***
 /x;           # Legible!

Yours,


fish

"As soon as we started programming, we found to our surprise that it wasn't as
easy to get programs right as we had thought. Debugging had to be discovered.
I can remember the exact instant when I realized that a large part of my life
from then on was going to be spent in finding mistakes in my own programs."
--Maurice Wilk
 
Aww! Your help is so much apreciated. But I lack the knowledge of Perl to get this solved. I got a little further in my understanding what to do if I would find the part of the script responsable for handeling the IP part. But it's not as easy as you make it look. There is no such thing as $ip in the script, if I would find that somewhere I would play and puzzle it out with time, but I'm completely lost somehow and now I have found some people who know and I don't understand them... lol .. irony.

Thanks for the help though,

marc (mnemo)
 
Do you want to post the code?


fish

"As soon as we started programming, we found to our surprise that it wasn't as
easy to get programs right as we had thought. Debugging had to be discovered.
I can remember the exact instant when I realized that a large part of my life
from then on was going to be spent in finding mistakes in my own programs."
--Maurice Wilk
 
#!/usr/bin/perl

$conf_file = "chat.conf";
$default_lang_file = "chat.lang";
$banip = "banip.php";

&main;

require($banip);

sub main {
$|=1;
require($conf_file);
if (-e "$plugin_dir/plugin.conf") {
require("$plugin_dir/plugin.conf");
}
&set_values;

$lang_file = $default_lang_file;
$lock_file = "lock";

$our_link = &quot; $our_image = &quot;<font size=-1>Sponsored by<br> <a target=\&quot;_new\&quot; href=\&quot;$our_link\&quot;>
if($profile_plugin) {
$profiles_active = 1;
require (&quot;$plugin_dir/profile.pl&quot;);
}

$oshow_status = $show_status;

$time = time() + ($time_zone * 3600);

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($time);

#Y2K Display Fix
$year =~ s/^\d(\d\d)$/$1/;

if ($sec < 10) {
$sec = &quot;0$sec&quot;;
}
if ($min < 10) {
$min = &quot;0$min&quot;;
}
if ($hour < 10) {
$hour = &quot;0$hour&quot;;
}

$mon++;

if ($mon < 10) {
$mon = &quot;0$mon&quot;;
}

if ($mday < 10) {
$mday = &quot;0$mday&quot;;
}

if($include_date == 1) {
$date = &quot;$mon/$mday/$year $hour\:$min\:$sec&quot;;
$archive_date = &quot;$mon/$mday/$year $hour\:$min\:$sec&quot;;
}
elsif($include_date == 2) {
$date = &quot;$hour\:$min\:$sec&quot;;
$archive_date = &quot;$mon/$mday/$year $hour\:$min\:$sec&quot;;
}
else {
$date = &quot;$hour\:$min\:$sec&quot;;
$archive_date = &quot;$hour\:$min\:$sec&quot;;
}

&lock;



if ($ENV{'QUERY_STRING'} =~ /^topframe/ && !$ENV{'CONTENT_LENGTH'}) {
require(&quot;$plugin_dir/frames.pl&quot;) || die &quot;Couldn't find frames part&quot;;
&topframe;
}
elsif ($ENV{'QUERY_STRING'} =~ /^ct--/) {
require(&quot;$plugin_dir/advertise.pl&quot;) || die &quot;Couldn't find ad part&quot;;
&lock;
&click_through;
&unlock;
exit;
}
elsif ($ENV{'PATH_INFO'} =~ /^\/bottomframe/) {
require(&quot;$plugin_dir/frames.pl&quot;) || die &quot;Couldn't find frames part&quot;;
$bottomframe = 1;
&bottomframe;
}
elsif ($ENV{'QUERY_STRING'} =~ /^ad_summary/) {
&unlock;
require(&quot;$plugin_dir/advertise.pl&quot;);
&ad_summary;
exit;
}

elsif ($ENV{'QUERY_STRING'} =~ /^register/) {
require(&quot;$plugin_dir/register.pl&quot;);
exit;
}
else {
if($ENV{'CONTENT_LENGTH'}) {
&parse_form;
&get_variables;
if ($admin_plugin && $adminyes && $message =~ /^command::/) {
require(&quot;$plugin_dir/admin.pl&quot;);
&admin_work;
}
if($admin_plugin && -s &quot;$file_dir/commands.txt&quot;) {
require(&quot;$plugin_dir/admin.pl&quot;);
&apply_commands;
}
&read_files;
}
else {
if ($ENV{'QUERY_STRING'}) {
($tentry,$tout_link) = split(/::/,$ENV{'QUERY_STRING'});
if($tentry) {
$entry = $tentry;
}
if($tout_link) {
$out_link = $tout_link;
}
}
$room = $entry;
if($custom_room_plugin) {
require(&quot;$plugin_dir/custom_room.pl&quot;);
&custom_room;
}
require(&quot;$lang_file&quot;) || die &quot;Could not find language file&quot;;
&misc_lang;
}

if($advertise_plugin && $ad_locations) {
require(&quot;$plugin_dir/advertise.pl&quot;);
}
&check_referer;
&prelocation;
&location;
}
exit;
}
sub set_values {
$visitors_time = $visitors_time * 60;
$chat_time = $chat_time * 60;
}
##########
# Lock
sub lock {

while(-e &quot;$file_dir/$lock_file&quot;) {
if($time + $lock_time < time()) {
unlink(&quot;$file_dir/$lock_file&quot;);
}
else {
select(undef, undef, undef, 0.25);
}
}

open(LOCK,&quot;>$file_dir/$lock_file&quot;) || die &quot;Could not create lock file&quot;;
close(LOCK);
}

########################
# Parse Form

sub parse_form {

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);

foreach $pair (@pairs) {
($nam, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(&quot;C&quot;, hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
if($allow_html == 0) {
$value =~ s/</&lt;/g;
$value =~ s/>/&gt;/g;
}
$FORM{$nam} = $value;
}
}

###########
# Get variables from form

sub get_variables {

if ($FORM{'room'}) {
$room = &quot;$FORM{'room'}&quot;;
$room =~ s/ /_/g;
$room =~ s/\//_/g;
}

if($custom_room_plugin) {
require(&quot;$plugin_dir/custom_room.pl&quot;);
&custom_room;
}
require(&quot;$lang_file&quot;) || die &quot;Could not find language file&quot;;
&misc_lang;

if ($FORM{'where'}) {
$where = &quot;$FORM{'where'}&quot;;
}

if($FORM{'frames'}) {
$frames = &quot;$FORM{'frames'}&quot;;
}

if ($FORM{'pubroom'}) {
$pubroom = &quot;$FORM{'pubroom'}&quot;;
$pubroom =~ s/ /_/g;
$pubroom =~ s/\//_/g;
if($pubroom eq &quot;$pubroom_title&quot;) {
undef($pubroom);
}
}

if ($FORM{'priroom'}) {
$priroom = &quot;$FORM{'priroom'}&quot;;
$priroom =~ s/ /_/g;
$priroom =~ s/\//_/g;
}

if ($FORM{'solo'}) {
$solo = &quot;$FORM{'solo'}&quot;;
if($solo eq &quot;$entire_room&quot;) {
undef($solo);
}
}

if ($FORM{'link'}) {
$link = &quot;$FORM{'link'}&quot;;
}

if ($FORM{'name'}) {
$name = &quot;$FORM{'name'}&quot;;

$name =~ s/\s+/ /g;
$name =~ s/^\s//g;
$name =~ s/\s$//g;
$name =~ s/^\.+//g;
$name =~ s/_/ /g;
$vname = $name;
$vname =~ s/ /_/g;

}

if ($FORM{'load_time'}) {
$load_time = &quot;$FORM{'load_time'}&quot;;
}

if ($FORM{'mail'} =~ /.*\@.*\..*/) {
$mail = &quot;$FORM{'mail'}&quot;;
$maillink = &quot;<a href=\&quot;mailto:$mail\&quot;>$mail</a>&quot;;
}

if ($FORM{'passwd'}) {
$passwd = &quot;$FORM{'passwd'}&quot;;
}

if ($FORM{'password'}) {
$password = &quot;$FORM{'password'}&quot;;
}

if ($FORM{'passwordb'}) {
$passwordb = &quot;$FORM{'passwordb'}&quot;;
}

if ($FORM{'regno'}) {
$regno = &quot;$FORM{'regno'}&quot;;
}

if ($FORM{'nummes'}) {
$nummes = $FORM{'nummes'};
}

if ($FORM{'message'}) {
$message = $FORM{'message'};
$message =~ s/\cM//g;
$tempmessage = $message;
$tempmessage =~ s/\s+//g;
if($where ne &quot;$reload_text&quot;) {
if($message =~ / /) {
@messagelines = split(/\n/,$message);
$count = 0;
while($count < @messagelines) {
if(length $messagelines[$count] > 80) {
$messagelines[$count] = &quot;</pre>$messagelines[$count]<pre>&quot;;
$longline = 1;
}
$count++;
}
if($longline) {
$message = join (&quot;\n&quot;, @messagelines);
}
$message = &quot;<pre>$message</pre>&quot;;
}

$message =~ s/https:\/\/\S+/<a href=&quot;$&&quot; target=&quot;new&quot;>$&<\/a>/g;
$message =~ s/ftp:\/\/\S+/<a href=&quot;$&&quot; target=&quot;new&quot;>$&<\/a>/g;
$message =~ s/\S+\@\S+\.\S+/<a href=&quot;mailto:$&&quot;>$&<\/a>/g;
$message =~ s/\n\n/ <p> /g;
$message =~ s/\n/ <br> /g;
}
$message =~ s/&quot/&quot;/g;
if($filter_plugin) {
require(&quot;$plugin_dir/filter.pl&quot;);
&lang_filter;
}
}

if ($FORM{'ignored'}) {
@ignored = split(/\(\)/,$FORM{'ignored'});
}

if($profile_plugin && -e &quot;$profile_dir/$vname&quot;) {
$profile_link = &quot;<a target=\&quot;profile\&quot; href=\&quot;$ENV{'SCRIPT_NAME'}/profile/$vname\&quot;>$profile_link_text</a>&quot;;
$maillink = &quot;$maillink $profile_link&quot;;
}
if($FORM{'admin'}) {
$adminyes = 1;
}
}

###########
# Read files

sub read_files {
if($where || $solo || $ENV{'PATH_INFO'}){
$origroom = $room;

open(MAIN,&quot;$file_dir/chat$room&quot;);
@main = <MAIN>;
close(MAIN);

@main = @main[(0 .. $max_mes)];

open(VISITORS,&quot;$file_dir/vis$room&quot;);
@visitors = <VISITORS>;
close(VISITORS);

$vname = $name;
$vname =~ s/ /_/g;
$vname =~ s/\//_/g;

open(VFILE,&quot;$vis_dir/$vname&quot;);
@vfile = <VFILE>;
close(VFILE);

@vfile = @vfile[(0 .. $max_mes)];

}
}

############
# Check Referer
sub check_referer {

if ($ENV{'HTTP_REFERER'} =~ /^http:\/\/([^\/]+)/) {
foreach$referer(@valid_referers) {
if ($ENV{'HTTP_REFERER'} =~ /$referer/) {
$okay_referer = 1;
}
}
}
if(!$ENV{'HTTP_REFERER'}) {
$okay_referer = 1;
}

if(!$okay_referer) {
&unlock;
&login;
exit;
}
}

##########
# Prepare for sending them places

sub prelocation {
if($where eq &quot;$ignore_text&quot; && $ignore_plugin) {
require(&quot;$plugin_dir/ignore.pl&quot;);
&ignore;
}

if($where eq &quot;$go_there&quot;) {
$oldroom = $room;
if ($priroom) {
$room = $priroom;
}
elsif($pubroom) {
$room = $pubroom;
}
else {
$where = $reload_text;
}
if ($room eq &quot;$oldroom&quot;) {
$where = &quot;$reload_text&quot;;
}
}

if($message_plugin) {
require(&quot;$plugin_dir/message.pl&quot;);
&message_prep;
}
}
##########
# Where are they coming from?

sub location {
if ($solo && $where eq &quot;$post_text&quot; && $solo ne $entire_room) {
&verify_password;
&main_page_lang;
&privmsg;
&update;
&write;
&unlock;
&reload;
}
elsif ($where eq &quot;register&quot;) {
if($frames eq &quot;yes&quot; && !$ENV{'QUERY_STRING'}) {
&unlock;
&check_name;
if($access_control_plugin) {
require(&quot;$plugin_dir/access_control.pl&quot;);
&admit_style;
}
if($admin_plugin) {
require(&quot;$plugin_dir/admin.pl&quot;);
&check_admin;
}
require(&quot;$plugin_dir/frames.pl&quot;) || die &quot;Couldn't find frames part&quot;;
&frames;
}
else {
&main_page_lang;
&check_name;
if($access_control_plugin) {
require(&quot;$plugin_dir/access_control.pl&quot;);
&admit_style;
}
if($admin_plugin) {
require(&quot;$plugin_dir/admin.pl&quot;);
&check_admin;
}
&create;
&register;
&write;
&unlock;
&reload;
}
}
elsif ($where eq &quot;$post_text&quot;) {
&verify_password;
&main_page_lang;
&create;
&post;
&update;
&write;
&unlock;
&reload;
}
elsif ($where eq &quot;$reload_text&quot;) {
&verify_password;
&main_page_lang;
&snag;
&create;
&update;
&write;
&unlock;
&reload;
}
elsif ($where eq &quot;$go_there&quot;) {
&verify_password;
if($pubroom || $priroom) {
$lang_file = $default_lang_file;
if($custom_room_plugin) {
require(&quot;$plugin_dir/custom_room.pl&quot;);
&custom_room;
if($message_plugin) {
require(&quot;$plugin_dir/message.pl&quot;);
&message_prep;
}
}
require(&quot;$lang_file&quot;) || die &quot;Could not find language file&quot;;
&misc_lang;
&main_page_lang;
&create;
&change;
&write;
&unlock;
&reload;
}
else {
&main_page_lang;
&snag;
&create;
&update;
&write;
&unlock;
&reload;
}
}
elsif ($where eq &quot;$leave_text&quot;) {
&verify_password;
&leave;
&write;
&unlock;
}
elsif ($profile_plugin && $where eq &quot;$edit_profile&quot;) {
&check_name;
if($access_control_plugin) {
require(&quot;$plugin_dir/access_control.pl&quot;);
&admit_style;
}
if($passlistok) {
&edit_profile;
}
else {
&name_taken
}
}
elsif($profile_plugin && $where eq &quot;$update_profile&quot;) {
&check_name;
if($access_control_plugin) {
require(&quot;$plugin_dir/access_control.pl&quot;);
&admit_style;
}
&update_profile;
}
elsif($profile_plugin && $where eq &quot;$change_password&quot;) {
&check_name;
if($access_control_plugin) {
require(&quot;$plugin_dir/access_control.pl&quot;);
&admit_style;
}
&change_password;
}
elsif($who_is_where_plugin && $where eq &quot;$who_is_where&quot;) {
&misc_lang;
if($where_locations =~ /A/ && !$load_time) {
&main_page_lang;
&check_name;
if($access_control_plugin) {
require(&quot;$plugin_dir/access_control.pl&quot;);
&admit_style;
}
if($admin_plugin) {
require(&quot;$plugin_dir/admin.pl&quot;);
&check_admin;
}
}
require(&quot;$plugin_dir/who_is_where.pl&quot;);
&who_is_where;
}
else {
&deletevfiles;
&unlock;
if(! -e &quot;$file_dir/.htaccess&quot;) {
$access_dir = $file_dir;
&write_htaccess;
}
if(! -e &quot;$vis_dir/.htaccess&quot;) {
$access_dir = $vis_dir;
&write_htaccess;
}
if(! -e &quot;$plugin_dir/.htaccess&quot; && -e $plugin_dir) {
$access_dir = $plugin_dir;
&write_htaccess;
}

&login;
}
}
############
# Login

sub login {
&reg_page_lang;
opendir(VFILES,$vis_dir);
@vfilelist = grep(!/^\.|^_/, readdir (VFILES));
closedir(VFILES);
$vtotal = @vfilelist - 1;

open(VISITORS,&quot;$file_dir/vis$room&quot;);
@visitors = <VISITORS>;
close(VISITORS);

foreach $visitors_line (@visitors) {
($bogus,$load,$bogus2) = split(/:/,$visitors_line);
if ($time - $load < $visitors_time && $load) {
push (@visitors_new,&quot;$visitors_line&quot;);
}
}
@visitors = @visitors_new;
undef @visitors_new;
$vnum = @visitors;

print &quot;Content-type: text/html\n\n&quot;;
print &quot;<html><head><title>$page_title $reg_page</title></head>\n&quot;;

print &quot;<body bgcolor=$bgcolor background=\&quot;$background\&quot; &quot;;
print &quot;text=$text_color link=$link_color vlink=$vlink_color>\n&quot;;
if($font_face ne &quot;&quot;) {
print &quot;<font face=\&quot;$font_face\&quot;>\n&quot;;
}
print &quot;<ul><center>\n&quot;;

if($advertise_plugin && $ad_locations =~ /a/) {
&advertise;
}

if ($title_graphic eq &quot;&quot;) {
print &quot;<H1>$page_title</h1>\n&quot;;
}
else {
print &quot;<h1><img src=\&quot;$title_graphic\&quot; alt=\&quot;$page_title\&quot;></h1>\n&quot;;
}
print &quot;<h2>$reg_page</h2><p></center>\n&quot;;

&register_body;
}

###########
# Body of Registration Page
# used on initial login, and when their chosen name is taken
# or other problem requires them to login again

sub register_body {
print &quot;<font size=4 color=$one_color><center>$you_must</font>\n&quot;;
print &quot;<p>$instruct<p>\n&quot;;
if ($vnum < 1) {
print &quot;$no_vis_a $room $no_vis_b<p>\n&quot;;
}
elsif ($vnum==1) {
print &quot;$one_vis_a $room $one_vis_b<p>\n&quot;;
}
else {
print &quot;$mult_vis_a $vnum $mult_vis_b $room $mult_vis_c<P>\n&quot;;
}
if ($vtotal < 1) {
print &quot;$no_vis_tot<p>\n&quot;;
}
elsif ($vtotal==1) {
print &quot;$one_vis_tot<P>\n&quot;;
}
else {
print &quot;$mult_vis_tot_a $vtotal $mult_vis_tot_b<P>\n&quot;;
}
print &quot;$enter_name<br>\n&quot;;
print &quot;<form method=POST action=\&quot;$ENV{'SCRIPT_NAME'}\&quot;>\n&quot;;
print &quot;<input type=hidden name=\&quot;where\&quot; value=\&quot;register\&quot;>\n&quot;;
print &quot;<input type=hidden name=\&quot;link\&quot; value=\&quot;$out_link\&quot;>\n&quot;;
print &quot;<input type=hidden name=\&quot;time\&quot; value=\&quot;$time\&quot;>\n&quot;;
print &quot;<table><tr><td>$name_blank</td>\n&quot;;
print &quot;<td><input type=text size=30 name=\&quot;name\&quot; maxlength=250>&quot;;
print &quot;<br></td></tr>\n&quot;;
print &quot;<tr><td>$passwd_blank</td>\n&quot;;
print &quot;<td><input type=hidden name=\&quot;passwd\&quot; value=swissboz size=30><br></td></tr>\n&quot;;
print &quot;<tr><td>$mail_blank</td>\n&quot;;
print &quot;<td><input type=hidden size=30 name=\&quot;mail\&quot;><br></td></tr>\n&quot;;
if($frames_plugin ||$lite_plugin) {
print &quot;<tr><td>$layout_blank</td><td>\n&quot;;
if($lite_plugin) {
print &quot;$layout_lite:<input type=radio name=\&quot;frames\&quot; value=\&quot;lite\&quot;>&nbsp;\n&quot;;
}
print &quot;$layout_std:<input type=radio name=\&quot;frames\&quot; value=\&quot;no\&quot;>&nbsp;\n&quot;;
if($frames_plugin) {
print &quot;$layout_frames:<input type=radio name=\&quot;frames\&quot; value=\&quot;yes\&quot; checked>\n&quot;;
}
print &quot;</td></tr>\n&quot;;
}
print &quot;</table><br><input type=hidden name=\&quot;room\&quot; value=\&quot;$room\&quot;>\n&quot;;
print &quot;<input type=submit value=\&quot;$enter_chat\&quot;>\n&quot;;
if($who_is_where_plugin && $where_locations =~ /a/i) {
print &quot;<input type=\&quot;submit\&quot; name=\&quot;where\&quot; value=\&quot;$who_is_where\&quot;>\n&quot;;
}
if ($profile_plugin) {
print &quot;<input type=submit name=\&quot;where\&quot; value=\&quot;$edit_profile\&quot;>\n&quot;;
}
print &quot;</form>\n&quot;;
if ($schedule_file) {
print &quot;$sched_note_a <a href=\&quot;$schedule_file\&quot;>&quot;;
print &quot;$sched_note_b</a> $sched_note_c<p>\n&quot;;
}
if ($help_file) {
print &quot;$help_a <a target=\&quot;profile\&quot; href=\&quot;$help_file\&quot;> $help_b</a> $help_c<p>\n&quot;;
}

if($advertise_plugin && $ad_locations =~ /b/) {
&advertise;
}

print &quot;<center>$our_image</center>\n&quot;;
print &quot;</body> </html>\n&quot;;
}
###########
# Name taken
sub name_taken {
&reg_page_lang;
print &quot;Content-type: text/html\n\n&quot;;
print &quot;<html><head><title>$page_title $reg_page</title></head>\n&quot;;
print &quot;<body bgcolor=$bgcolor background=\&quot;$background\&quot; &quot;;
print &quot;text=$text_color link=$link_color vlink=$vlink_color>\n&quot;;
if($font_face ne &quot;&quot;) {
print &quot;<font face=\&quot;$font_face\&quot;>\n&quot;;
}
print &quot;<ul><center>\n&quot;;

if($advertise_plugin && $ad_locations =~ /a/) {
&advertise;
}

if ($title_graphic eq &quot;&quot;) {
print &quot;<H1>$page_title</h1>\n&quot;;
}
else {
print &quot;<h1><img src=\&quot;$title_graphic\&quot; alt=\&quot;$page_title\&quot;></h1>\n&quot;;
}

print &quot;<h2>$reg_page</h2><p></center>\n&quot;;
print &quot;$wrong_name<p>\n&quot;;
&register_body;
&unlock;
exit;
}
############
# Check Name

sub check_name {
if (!$passwd || !$name) {
&name_taken;
}
elsif (-e &quot;$vis_dir/$vname&quot;){
open (VSAME,&quot;$vis_dir/$vname&quot;) || die $!;
$vsame = <VSAME>;
close (VSAME);
($bogus,$test,$bogus2) = split(/:/,$vsame);
$password = crypt($passwd,MW);
if ($password ne $test) {
&name_taken;
}
}
elsif($user_limit_plugin) {
require(&quot;$plugin_dir/user_limit.pl&quot;);
&overflow;
}
}



########################
# Maintain files
sub create {
open(INDEX,&quot;>$file_dir/index.html&quot;);
print INDEX &quot;$index_html\n&quot;;
close(INDEX);

open(INDEXB,&quot;>$vis_dir/index.html&quot;);
print INDEXB &quot;$index_html\n&quot;;
close(INDEXB);

if($message_plugin) {
require(&quot;$plugin_dir/message.pl&quot;);
&message_prep;
}

opendir(FILES,&quot;$file_dir&quot;);
@filelist = grep(!/^\./, readdir (FILES));
closedir(FILES);
foreach $file (@filelist) {
$tfile = $file;
$tfile =~ s/^chat//g;
if (-M &quot;$file_dir/$file&quot; > $chat_time / 86400 && ! $MESGROOMS{$tfile}) {
if ($file =~ /^chat/ || $file =~ /^vis/) {
unlink(&quot;$file_dir/$file&quot;);
}
}
}

&deletev;
}

sub deletev {
if (-e &quot;$file_dir/vis$room&quot;) {
foreach $visitors_line (@visitors) {
($bogus,$load,$bogus2) = split(/:/,$visitors_line);
if ($time - $load < $visitors_time) {
push (@visitors_new,&quot;$visitors_line&quot;);
}
}
}

@visitors = @visitors_new;
undef @visitors_new;

&deletevfiles;
}
sub deletevfiles {
opendir(VFILES,$vis_dir);
@vfilelist = grep(!/^\.|^_/, readdir (VFILES));
closedir(VFILES);
foreach $vfilelist (@vfilelist) {
if (-M &quot;$vis_dir/$vfilelist&quot; > ($visitors_time / 86400)) {
unlink(&quot;$vis_dir/$vfilelist&quot;);
}
}
if(!$where) {
opendir(VFILES,$vis_dir);
@ffilelist = grep(/^_/, readdir (VFILES));
closedir(VFILES);
foreach $ffilelist (@ffilelist) {
open(FFILE,&quot;$vis_dir/$ffilelist&quot;);
$ffile = <FFILE>;
close(FFILE);
$ffile =~ s/\n//g;
$ffile =~ s/ /_/g;
if(! -e &quot;$vis_dir/$ffile&quot;) {
unlink(&quot;$vis_dir/$ffilelist&quot;);
}
}
}

}

###########
# Register
sub register {

$login = $date;

foreach $visitors_line (@visitors) {
if ($visitors_line !~ /^<!--:\d+:-->$name($| \d+:\d\d:\d\d$)/) {
push (@visitors_new,&quot;$visitors_line&quot;);
}
}
@visitors = @visitors_new;
undef @visitors_new;
$temp = &quot;<!--:$time:-->$name\n&quot;;
unshift (@visitors,$temp);

shift(@vfile);
if($frame_remind && $frames eq &quot;yes&quot;) {
if ($initial_message_plugin) {
require(&quot;$plugin_dir/initial_message.pl&quot;);
$temp = &quot;<!--:$time:-->$name, $frame_remind<p>$countdown<p>$random_line<br><br>&quot;;
}
else {
$temp = &quot;<!--:$time:-->$name, $frame_remind<br><br>&quot;;
}
}
else {
if ($initial_message_plugin) {
require(&quot;$plugin_dir/initial_message.pl&quot;);
$temp = &quot;<!--:$time:-->$name, $reload_remind<p>$countdown<p>$random_line<br><br>&quot;;
}
else {
$temp = &quot;<!--:$time:-->$name, $reload_remind<br><br>&quot;;
}
}
unshift (@vfile,&quot;$temp\n&quot;);
$password = crypt($passwd,MW);
$temp = &quot;<!--:$password\:$room\:$mail\::0:-->\n&quot;;
unshift(@vfile,$temp);
$vmodified = 1;

if($show_status) {
$temp = &quot;<!--:$time:-->$name:&nbsp;.&nbsp;.&nbsp;.&nbsp;. $maillink $date CET (+0200 GMT) &nbsp; <!--$ENV{'REMOTE_ADDR'}--></font></font></font> <br>$joined_chat<br><br>\n&quot;;
unshift(@main,$temp);
$cmodified = 1;
}
}
##########
# Modify chat page

sub post {
if ($tempmessage) {
if($emoticon_plugin) {
require(&quot;$plugin_dir/emoticon.pl&quot;);
if ($FORM{'emoticon'} && $FORM{'emoticon'} ne $blank_emoticon) {
&post_emoticon;
}
else {
$temp = &quot;<!--:$time:-->$name:&nbsp;.&nbsp;.&nbsp;.&nbsp;. $maillink $date CET (+0200 GMT) &nbsp; <!--$ENV{'REMOTE_ADDR'}--></font></font></font><br>$message<br><br>\n&quot;;
}
}
else {
$temp = &quot;<!--:$time:-->$name:&nbsp;.&nbsp;.&nbsp;.&nbsp;. $maillink $date CET (+0200 GMT) &nbsp; <!--$ENV{'REMOTE_ADDR'}--></font></font></font><br>$message<br><br>\n&quot;;
}
unshift(@main,$temp);
$cmodified = 1;
}
}
#########
# Snag information when person hits reload

sub snag {
$mess = $message;
}

sub verify_password {

($bogus,$fpassword) = split(/:/,$vfile[0]);
if($where eq &quot;$leave_text&quot; && !$password) {
$password = $fpassword;
}
if($password ne $fpassword) {
&unlock;
&login;
exit;
}
}
##########
# Update Visitor's log

sub update {
foreach $visitors_line (@visitors) {
if ($visitors_line !~ /^<!--:\d+:-->$name$/ &&
$visitors_line !~ /^<!--:\d+:-->$name \d+:\d\d:\d\d$/ &&
$visitors_line !~ /^<!--:\d+:-->$name \d\d\/\d\d\/\d\d \d+:\d\d:\d\d$/) {
push (@visitors_new,&quot;$visitors_line&quot;);
}
}

@visitors = @visitors_new;
undef @visitors_new;

$temp =&quot;<!--:$time:-->$name $date\n&quot;;
unshift (@visitors,$temp);

$vmodified = 1;

if ($admonish) {
&admonish;
}
}


############
# Reload
sub reload {
$public_count = @public_rooms;
if($password_style == 2 && $access_control_plugin) {
require(&quot;$plugin_dir/access_control.pl&quot;);
&admit_style;
}
elsif($frames eq &quot;lite&quot;) {
require(&quot;$plugin_dir/lite.pl&quot;);
&lite_layout;
}
elsif($frames eq &quot;yes&quot;) {
require(&quot;$plugin_dir/frames.pl&quot;);
&topframe_reload;
}
elsif($bottomframe) {
require(&quot;$plugin_dir/frames.pl&quot;);
&bottomframe_reload;
}
else {
$ignoredlist = join(&quot;()&quot;,@ignored);
if(!$nummes) {
$nummes = $def_mes;
}
if(!$refreq) {
$refreq = $def_reload;
}
if($nummes =~ /\D/ && $nummes !~ /^($new_nummes||$all_nummes)$/i) {
$nummes = $def_mes ;
}
if($nummes > $max_mes && $nummes !~ /^($new_nummes||$all_nummes)$/i) {
$nummes = $max_mes;
}
print &quot;Content-type: text/html\n\n&quot;;

print &quot;<html><head><title>$page_title</title>\n&quot;;

print &quot;</head><body bgcolor=$bgcolor background=\&quot;$background\&quot;&quot;;
print &quot; text=$text_color link=$link_color vlink=$vlink_color>\n&quot;;
if($font_face ne &quot;&quot;) {
print &quot;<font face=\&quot;$font_face\&quot;>\n&quot;;
}

print &quot;<form name=\&quot;form\&quot; method=POST action=\&quot;$ENV{'SCRIPT_NAME'}\&quot;>\n&quot;;


if($advertise_plugin && $ad_locations =~ /c/) {
&advertise;
}

if($advertise_plugin && $ad_locations =~ /d/) {
&advertise;
}
if (!$title_graphic) {
print &quot;<H3>$page_title</h3>\n&quot;;
}
else {

print &quot;<img src=\&quot;$title_graphic\&quot; border=0 &quot;;
print &quot;alt=\&quot;$page_title\&quot;><hr>\n&quot;;
print &quot;<FONT SIZE=3 FONT COLOR=CYAN FONT FACE=ARIAL NARROW><B> Multi Lingual Chatroom!! Have manners and don't be rude to people.</B></FONT><br>\n&quot;;
}
print &quot;<input type=hidden name=\&quot;password\&quot; value=\&quot;$password\&quot;>\n&quot;;
print &quot;<input type=hidden name=\&quot;frames\&quot; value=\&quot;$frames\&quot;>\n&quot;;
print &quot;<input type=hidden name=\&quot;load_time\&quot; value=\&quot;$time\&quot;>\n&quot;;
print &quot;<input type=hidden name=\&quot;room\&quot; value=\&quot;$room\&quot;>\n&quot;;
print &quot;<input type=hidden name=\&quot;mail\&quot; value=\&quot;$mail\&quot;>\n&quot;;
print &quot;<input type=hidden name=\&quot;name\&quot; value=\&quot;$name\&quot;>\n&quot;;
print &quot;<input type=hidden name=\&quot;link\&quot; value=\&quot;$link\&quot;>\n&quot;;
print &quot;<input type=hidden name=\&quot;ignored\&quot; value=\&quot;$ignoredlist\&quot;>\n&quot;;
if($adminyes) {
print &quot;<input type=\&quot;hidden\&quot; name=\&quot;admin\&quot; value=\&quot;1\&quot;>\n&quot;;
}

print &quot;<input type=text size=68 name=\&quot;message\&quot;>\n&quot;;
print &quot;$mess</textarea>\n&quot;;


$vname = $name;
$vname =~ s/ /_/g;
if($emoticon_plugin) {
}
if($allow_one_on_one) {
print &quot;$send_to <select name=\&quot;solo\&quot;>\n&quot;;
print &quot;<option>$entire_room\n&quot;;
opendir(VFILES,$vis_dir);
@vfilelist = grep(!/^\.|^_/, readdir (VFILES));
closedir(VFILES);
@vfilelist = sort(@vfilelist);
foreach $vfilelist (@vfilelist) {
if ($vfilelist ne &quot;index.html&quot; && $vfilelist ne &quot;$vname&quot;) {
$vfilelist =~ s/_/ /g;
undef($vfilelistb);
if(@ignored) {
foreach$ignoree(@ignored) {
if($vfilelist eq &quot;$ignoree&quot;) {
$vfilelistb = &quot;$vfilelist$ignoremark&quot;;
}
}
if($solo eq &quot;$vfilelist&quot; && $vfilelistb) {
print &quot;<option selected value=\&quot;$vfilelist\&quot;>$vfilelistb\n&quot;;
}
elsif($solo eq &quot;$vfilelist&quot;) {
print &quot;<option selected>$vfilelist\n&quot;;
}
elsif($vfilelistb) {
print &quot;<option value=\&quot;$vfilelist\&quot;>$vfilelistb\n&quot;;
}
else {
print &quot;<option>$vfilelist\n&quot;;
}
}
else {
if($solo eq &quot;$vfilelist&quot;) {
print &quot;<option selected>$vfilelist\n&quot;;
}
else {
print &quot;<option>$vfilelist\n&quot;;
}
}
}
}
print &quot;</select>\n&quot;;
}
if($emoticon_plugin) {
print &quot;</td><td rowspan=2>\n&quot;;
}

if($ignore_plugin) {
print &quot;<input type=submit name=\&quot;where\&quot; value=\&quot;$ignore_text\&quot;>\n&quot;;
}

if(($password_style == 2 && $passpost) || $password_style != 2) {
print &quot;<input type=submit name=\&quot;where\&quot; value=\&quot;$post_text\&quot;>\n&quot;;
}
if($frames ne &quot;yes&quot;) {

}
if($frames ne &quot;yes&quot;) {
print &quot;<input type=submit name=\&quot;where\&quot; value=\&quot;$leave_text\&quot;><br>\n&quot;;
}

if($emoticon_plugin) {
require(&quot;$plugin_dir/emoticon.pl&quot;);
&emoticon_list;
}


if($who_is_where_plugin && $where_locations =~ /b/) {
print &quot;<input type=\&quot;submit\&quot; name=\&quot;where\&quot; value=\&quot;$who_is_where\&quot;><br>\n&quot;;
}
print &quot;<font size=2>Site Administrator\: <a href=mailto\:swissboz\@bigfoot.com>SwissBoz</a>\n&quot;;
print &quot; * Leave a message on the <A HREF= target=new>Notice Board</a> *\n&quot;;
print &quot;$nummes_a <input type=text name=\&quot;nummes\&quot; &quot;;
print &quot;value=\&quot;$nummes\&quot; size=3 maxlength=3> $nummes_b<hr></font>\n&quot;;

if($public_count > 1) {
print &quot;<select name=\&quot;pubroom\&quot;>\n&quot;;
print &quot;<option value=\&quot;\&quot;>$pub_room_title\n&quot;;
foreach$public_room(@public_rooms) {
print &quot;<option>$public_room\n&quot;;
}
print &quot;</select></center><br>\n&quot;;

}
if($allow_private) {
print &quot;$pri_room_title<br>\n&quot;;
print &quot;<input type=text size=15 name=\&quot;priroom\&quot;><br>\n&quot;;
}
if($public_count > 1 || $allow_private) {
print &quot;<input type=submit name=\&quot;where\&quot; value=\&quot;$go_there\&quot;>\n&quot;;
}


print &quot;</center></form>\n&quot;;
print &quot;<script language=\&quot;JavaScript\&quot;>\n<!--\n&quot;;
print &quot;document.form.message.focus();\n//-->\n</script>\n&quot;;



if($advertise_plugin && $ad_locations =~ /e/) {
&advertise;
print &quot;<br>&quot;;
}

print &quot;<a name=\&quot;messages\&quot;>\n&quot;;

if($bottomframe) {
print &quot;<br>\n&quot;;
}

&nummes;

if($advertise_plugin && $ad_locations =~ /f/) {
&advertise;
}

print &quot;<center>$our_image</center>\n&quot;;
print &quot;</body> </html>\n&quot;;
}
}
sub nummes {

if($nummes =~ /^$all_nummes$/i) {
$clinecount = 0;
$vlinecount = 1;
while($clinecount < @main || $vlinecount < @vfile) {
&print_chat;
}
}
elsif($nummes =~ /^$new_nummes$/i) {
$clinecount = 0;
$vlinecount = 1;
$clinetime = $time;
while(($vlinetime > $load_time - $new_time || $clinetime > $load_time - $new_time) && ($clinecount < @main || $vlinecount < @vfile)) {
&print_chat;
}
}
else {
$clinecount = 0;
$vlinecount = 1;
while($mlinecount < $nummes && ($clinecount < @main || $vlinecount < @vfile)) {
&print_chat;
}
}

}
sub print_chat {
foreach$ignoree(@ignored) {
while($main[$clinecount] =~ /$ignoree<\/b>/) {
$clinecount++;
undef($clinetime);
}
while($vfile[$vlinecount] =~ /$ignoree<\/b>/) {
$vlinecount++;
undef($vlinetime);
}
}
if(!$clinetime || $nummes =~ /$new_nummes/i) {
($bogus,$clinetime) = split(/:/,$main[$clinecount]);
}
if(!$vlinetime || $nummes =~ /$new_nummes/i) {
($bogus,$vlinetime) = split(/:/,$vfile[$vlinecount]);
}
if(!$clinetime && !$vlinetime) {
$clinecount++;
$vlinecount++;
}
elsif($clinetime > $vlinetime) {
$tcline = $main[$clinecount];
$tcline =~ s/^<!--:\d\d\d+:-->//g;
$tcline =~ s/<!--/[&nbsp;/g;
$tcline =~ s/-->/&nbsp;] &nbsp; /g;
if($adminyes && $show_ip == 1) {
$messtime = substr($clinetime, -5, 5);
$tcline =~ s/<!--/&nbsp;/g;
$tcline =~ s/-->/&nbsp; &nbsp; $messtime/g;
}
else {
$tcline =~ s/<!--\d+\.\d+\.\d+\.\d+-->//g;
}
if($clinetime > $load_time) {
if($tcline =~ /$joined_chat/ && $alert_sound_plugin) {
require(&quot;$plugin_dir/alert_sound.pl&quot;);
&alert_sound;
}
print &quot;$new_message $tcline&quot;;
}
elsif(!$old_timer) {
$old_timer = 1;
print &quot;<font color=$oldcolor>\n&quot;;
print $tcline;
}
else {
print $tcline;
}
$clinecount++;
if($nummes !~ /$new_nummes/i) {
undef($clinetime);
}
}

else {
$tvline = $vfile[$vlinecount];
$tvline =~ s/<font>/<font color=$one_color>/g;
$tvline =~ s/^<!--:\d\d\d+:-->//g;
if($adminyes && $show_ip == 1) {
$tvline =~ s/<!--/&nbsp;/g;
$tvline =~ s/-->//g;
}
else {
$tvline =~ s/<!--\d+\.\d+\.\d+\.\d+-->//g;
}
if($vlinetime > $load_time) {
print &quot;$new_message $tvline&quot;;
}
else {
print $tvline;
}
$vlinecount++;
if($nummes ne &quot;$new_nummes&quot;) {
undef($vlinetime);
}
}

$mlinecount++;

}

##############
# Change rooms
sub change {
$load_time = 0;

if($oshow_status) {
open(OLDMAIN,&quot;$file_dir/chat$oldroom&quot;);
@oldmain = <OLDMAIN>;
close(OLDMAIN);

$temp = &quot;<!--:$time:-->$name $maillink $left_room $date &nbsp; <!--$ENV{'REMOTE_ADDR'}--><br><br>\n&quot;;
unshift(@oldmain,$temp);

open(OLDMAIN,&quot;>$file_dir/tempc$oldroom&quot;);
foreach$oldmainline(@oldmain){
print OLDMAIN &quot;$oldmainline&quot;;
}
close(OLDMAIN);
rename(&quot;$file_dir/tempc$oldroom&quot;,&quot;$file_dir/chat$oldroom&quot;);

open(OLDVIS,&quot;$file_dir/vis$oldroom&quot;);
@oldvis = <OLDVIS>;
close(OLDVIS);
}
foreach $visitors_line (@oldvis) {
if ($visitors_line !~ /^<!--:\d+:-->$name($| \d+:\d\d:\d\d$)/) {
push (@visitors_old,&quot;$visitors_line&quot;);
}
}
@oldvis = @visitors_old;
undef @visitors_old;


open(OLDVIS,&quot;>$file_dir/tempv$oldroom&quot;);
foreach$oldvisline(@oldvis) {
print OLDVIS &quot;$oldvisline&quot;;
}
close(OLDVIS);
rename(&quot;$file_dir/tempv$oldroom&quot;,&quot;$file_dir/vis$oldroom&quot;);

undef(@oldmain);
undef(@oldvis);

open(MAIN,&quot;$file_dir/chat$room&quot;);
@main = <MAIN>;
close(MAIN);
@main = @main[(0 .. $max_mes)];

if($show_status) {
$temp = &quot;<!--:$time:-->$name $maillink $joined_chat $date &nbsp; <!--$ENV{'REMOTE_ADDR'}--><br><br>\n&quot;;
unshift(@main,$temp);
$cmodified = 1;
}

open(VISITORS,&quot;$file_dir/vis$room&quot;);
@visitors = <VISITORS>;
close(VISITORS);

$login = &quot;$date&quot;;

foreach $visitors_line (@visitors) {
if ($visitors_line !~ /^<!--:\d+:-->$name($| \d+:\d\d:\d\d$)/) {
push (@visitors_new,&quot;$visitors_line&quot;);
}
}

@visitors = @visitors_new;
undef @visitors_new;

$temp = &quot;<!--:$time:-->$name\n&quot;;
unshift (@visitors,$temp);

$vmodified = 1;
}

##############
# Send the private message
sub privmsg {

if ($tempmessage) {
$solo =~ s/ /_/g;
if(-e &quot;$vis_dir/$solo&quot;){
open (VFILES,&quot;$vis_dir/$solo&quot;) || die $!;
@vfiles = <VFILES>;
close (VFILES);

$vfilestemp = $vfiles[0];
shift(@vfiles);

if($emoticon_plugin) {
require(&quot;$plugin_dir/emoticon.pl&quot;);
if ($FORM{'emoticon'} && $FORM{'emoticon'} ne $blank_emoticon) {
&one_on_one_emoticon;
}
else {
$tempa =&quot;<!--:$time:--><font>$one_on_one_text:&quot;;
$tempb = &quot; $name:&nbsp;.&nbsp;.&nbsp;.&nbsp;. $date &nbsp; <!--$ENV{'REMOTE_ADDR'}--><br>$message</font><br><br>\n&quot;;
$temp = &quot;$tempa$tempb&quot;;
}
}
else {
$tempa =&quot;<!--:$time:--><font>$one_on_one_text:&quot;;
$tempb = &quot; $name:&nbsp;.&nbsp;.&nbsp;.&nbsp;. $maillink $date &nbsp; <!--$ENV{'REMOTE_ADDR'}--><br> $message</font><br><br>\n&quot;;
$temp = &quot;$tempa$tempb&quot;;
}
unshift(@vfiles,$temp);

unshift(@vfiles,&quot;$vfilestemp&quot;);

open(VFILES,&quot;>$vis_dir/$solo&quot;) || die $!;
foreach $vfiles_line(@vfiles) {
print VFILES &quot;$vfiles_line&quot;;
}

close(VFILES);

$primessage = $message;
}
else {
$primessage = &quot;$person_gone<br>$message&quot;;
}

$solo =~ s/_/ /g;
$vfiletemp = $vfile[0];
shift(@vfile);
if($emoticon_plugin) {
require(&quot;$plugin_dir/emoticon.pl&quot;);
if ($FORM{'emoticon'} && $FORM{'emoticon'} ne $blank_emoticon) {
&send_one_on_one_emoticon;
}
else {
$tempa =&quot;<!--:$time:--><font>$one_on_one_text:&quot;;
$tempb = &quot; To: $solo $date &nbsp; <!--$ENV{'REMOTE_ADDR'}--><br>$primessage</font><br><br>\n&quot;;
$temp = &quot;$tempa$tempb&quot;;
}
}
else {
$tempa =&quot;<!--:$time:--><font>$one_on_one_text:&quot;;
$tempb = &quot; To: $solo $date &nbsp; <!--$ENV{'REMOTE_ADDR'}--><br>$primessage</font><br><br>\n&quot;;
$temp = &quot;$tempa$tempb&quot;;
}
unshift (@vfile,$temp);
unshift (@vfile,&quot;$vfiletemp&quot;);
}
}
###############
# Leave
sub leave {

unlink(&quot;$vis_dir/$vname&quot;);

if($emoticon_plugin) {
require(&quot;$plugin_dir/emoticon.pl&quot;);
if ($FORM{'emoticon'} && $FORM{'emoticon'} ne $blank_emoticon) {
&leave_emoticon;
}
else {
$temp = &quot;<!--:$time:-->$name $maillink $left_chat $date &nbsp; <!--$ENV{'REMOTE_ADDR'}--><br><br>\n&quot;;
}
}
else {
$temp = &quot;<!--:$time:-->$name $maillink $left_chat $date &nbsp; <!--$ENV{'REMOTE_ADDR'}--><br><br>\n&quot;;
}
if($show_status) {
unshift(@main,$temp);
$cmodified = 1;
}

foreach $visitors_line (@visitors) {
if ($visitors_line !~ /^<!--:\d+:-->$name($| \d+:\d\d:\d\d$)/) {
push (@visitors_new,&quot;$visitors_line&quot;);
}
}
@visitors = @visitors_new;
undef @visitors_new;

print &quot;Location: $link\n\n&quot;;
$vmodified = 1;
}

###########
# Write Files
sub write {
if($cmodified) {
open(MAIN,&quot;>$file_dir/tempc$room&quot;);
print MAIN @main;
close(MAIN);
rename(&quot;$file_dir/tempc$room&quot;,&quot;$file_dir/chat$room&quot;)
}

if($vmodified) {
open(VISITORS,&quot;>$file_dir/tempv$room&quot;);
print VISITORS @visitors;
close(VISITORS);
rename(&quot;$file_dir/tempv$room&quot;,&quot;$file_dir/vis$room&quot;)
}

$vfile[0] = &quot;<!--:$password\:$room\:$mail\:$ignoredlist\:$time:-->\n&quot;;
if(!$vname) {
$vname = $name;
$vname =~ s/ /_/g;
}
if($where ne &quot;$leave_text&quot; && $vname){
open(VFILE,&quot;>$vis_dir/temp$vname&quot;);
print VFILE @vfile;
close(VFILE);
rename(&quot;$vis_dir/temp$vname&quot;,&quot;$vis_dir/$vname&quot;);
}
}
#############
# Write .htaccess file for security
sub write_htaccess {
open(HTACCESS,&quot;>$access_dir/.htaccess&quot;);
print HTACCESS &quot;AuthUserFile /etc/.htpasswd\nAuthGroupFile /dev/null\n&quot;;
print HTACCESS &quot;AuthName chat Restricted Area\nAuthType Basic\n\n&quot;;
print HTACCESS &quot;<Limit GET>require user chat\n</Limit>\n&quot;;
close(HTACCESS);
}
#############
# Unlock
sub unlock {

unlink(&quot;$file_dir/$lock_file&quot;);

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top