|
@@ -1,40 +1,246 @@
|
|
|
-#!/usr/bin/perl -w
|
|
|
|
|
|
|
+#!/usr/bin/perl
|
|
|
|
|
|
|
|
use strict;
|
|
use strict;
|
|
|
-print "Content-Type: text/html\n\n";
|
|
|
|
|
|
|
+use CGI qw/:standard/;
|
|
|
|
|
+use CGI::Carp qw(fatalsToBrowser carpout);
|
|
|
|
|
|
|
|
-my (%oldnicks, @users, @nick, %form);
|
|
|
|
|
|
|
+###########################################################################
|
|
|
|
|
+# #
|
|
|
|
|
+# addalias version 2.0 by deadlock (deadlock@cheeseheadz.net) #
|
|
|
|
|
+# #
|
|
|
|
|
+# This script can be used on a webpage for users to enter and edit their #
|
|
|
|
|
+# own info for the pisg ircstats program by mbrix. #
|
|
|
|
|
+# #
|
|
|
|
|
+# addalias v2+ is based on the original addalias program by Doomshammer #
|
|
|
|
|
+# #
|
|
|
|
|
+###########################################################################
|
|
|
|
|
+
|
|
|
|
|
+######################
|
|
|
|
|
+### Config section ###
|
|
|
|
|
+######################
|
|
|
|
|
+
|
|
|
|
|
+# File locations:
|
|
|
|
|
+
|
|
|
|
|
+my $pisg_config="/path/to/pisg.cfg";
|
|
|
|
|
+
|
|
|
|
|
+# Page layout:
|
|
|
|
|
+
|
|
|
|
|
+my $c_bgcolor="#FFFFFF";
|
|
|
|
|
+my $c_text="#000000";
|
|
|
|
|
+my $c_link="blue";
|
|
|
|
|
+my $c_vlink="#C0C0C0";
|
|
|
|
|
+my $c_alink="#C0FFC0";
|
|
|
|
|
+my $c_border="#FFFFFF";
|
|
|
|
|
+
|
|
|
|
|
+my $title="IRC statistics - user addition page";
|
|
|
|
|
+
|
|
|
|
|
+# Text on the main page
|
|
|
|
|
+
|
|
|
|
|
+my $txthead1="In this form you can enter the settings (aliases, link and user picture) for your nickname in the IRC-stats.";
|
|
|
|
|
+my $txthead2="Nicknames are allowed only once.";
|
|
|
|
|
+my $txtnick="Nickname";
|
|
|
|
|
+my $txtalias="Alias(es)";
|
|
|
|
|
+my $txturl="URL/E-Mail";
|
|
|
|
|
+my $txtpic="Userpic";
|
|
|
|
|
+my $txtsex="Sex";
|
|
|
|
|
+my $txtmale="M";
|
|
|
|
|
+my $txtfemale="F";
|
|
|
|
|
+my $txtignore="Ignore me";
|
|
|
|
|
+my $btnsubmit="Submit";
|
|
|
|
|
+my $btnupdate="Update";
|
|
|
|
|
+my $txtfoot1="To update your settings, just enter your nickname and click Submit to retrieve your current settings.";
|
|
|
|
|
+my $txthelp="For help on this form click <a href=\"addalias.pl/help\" target=\"_blank\">here</a>.";
|
|
|
|
|
+my $txtupdate="These are your current settings. Edit them where needed and click Update to update your info.";
|
|
|
|
|
+my $txtaddok="Your nickname was successfully added.:";
|
|
|
|
|
+my $txtignoreon="You activated ignore and will not appear in the stats.";
|
|
|
|
|
+my $txtupdateok="Your info was successfully updated.:";
|
|
|
|
|
+
|
|
|
|
|
+# Helptext:
|
|
|
|
|
+
|
|
|
|
|
+my $nickhelp="Enter the name you want to use in the stats here.";
|
|
|
|
|
+my $aliashelp="Add all aliases you use here, seperated by spaces, so they will be joined in the stats. A * is allowed as a wildcard. For example: MyNick[Zzz], MyNick-afk and MyNick-work could be entered as 'MyNick[Zzz] MyNick-*' or just as 'MyNick*'";
|
|
|
|
|
+my $urlhelp="You can enter a webpage or e-mail adress here to be linked to your nick in the stats.";
|
|
|
|
|
+my $pichelp="If you enter a link to a picture here it will be added to your stats on the page.";
|
|
|
|
|
+my $sexhelp="This setting is used to determine if lines in the stats should read 'his' or 'her' when referring to you.";
|
|
|
|
|
+my $ignorehelp="If you don't want to be included in the stats, select this option.";
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+###################################
|
|
|
|
|
+### End config section ###
|
|
|
|
|
+### do not edit below this line ###
|
|
|
|
|
+###################################
|
|
|
|
|
+
|
|
|
|
|
+# Main program
|
|
|
|
|
+
|
|
|
|
|
+my $path = path_info();
|
|
|
|
|
+$path =~ s!^/!!;
|
|
|
|
|
+my (%oldnicks, @users, @nick);
|
|
|
|
|
+my ($frm_nick, $frm_alias, $frm_link, $frm_pic, $frm_sex, $frm_ignore);
|
|
|
|
|
+my ($old_nick, $old_alias, $old_link, $old_pic, $old_sex, $old_ignore);
|
|
|
|
|
+my ($old_sexm, $old_sexf, $old_ignr);
|
|
|
|
|
+my ($cfg, $fnd);
|
|
|
|
|
+my ($submitbtn, $frmaction);
|
|
|
|
|
+
|
|
|
|
|
+htmlheader();
|
|
|
|
|
+
|
|
|
|
|
+if (!$path) {
|
|
|
|
|
+ $submitbtn = $btnsubmit;
|
|
|
|
|
+ $frmaction="\"addalias.pl/input\"";
|
|
|
|
|
+ $txtupdate = "";
|
|
|
|
|
+ mainpage();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+elsif ($path eq 'help') {
|
|
|
|
|
+ helppage();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+elsif ($path eq 'input') {
|
|
|
|
|
+ readparams();
|
|
|
|
|
+ $cfg = read_config();
|
|
|
|
|
+ if ($cfg ne "1") {
|
|
|
|
|
+ $fnd = check_if_found();
|
|
|
|
|
+ if ($fnd eq "1") {
|
|
|
|
|
+ $submitbtn = $btnupdate;
|
|
|
|
|
+ $frmaction="\"update\"";
|
|
|
|
|
+ if ($old_sex eq "m" or $old_sex eq "M"){
|
|
|
|
|
+ $old_sexm = "checked";
|
|
|
|
|
+ }
|
|
|
|
|
+ elsif ($old_sex eq "f" or $old_sex eq "F"){
|
|
|
|
|
+ $old_sexf = "checked";
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($old_ignore eq "1"){
|
|
|
|
|
+ $old_ignr = "checked";
|
|
|
|
|
+ }
|
|
|
|
|
+ $txtfoot1="";
|
|
|
|
|
+ mainpage();
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ addinfo();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ addinfo();
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+elsif ($path eq 'update') {
|
|
|
|
|
+ readparams();
|
|
|
|
|
+ $cfg = read_config();
|
|
|
|
|
+ updateinfo();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+else {
|
|
|
|
|
+print "Illegal calling of script<br>\n";
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+htmlfooter();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+# Subs
|
|
|
|
|
|
|
|
sub htmlheader
|
|
sub htmlheader
|
|
|
{
|
|
{
|
|
|
- print <<HTML
|
|
|
|
|
|
|
+print <<HTML
|
|
|
|
|
+Content-Type: text/html
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
|
<html>
|
|
<html>
|
|
|
<head>
|
|
<head>
|
|
|
- <title>IRC statistics - user addition page</title>
|
|
|
|
|
|
|
+ <title>$title</title>
|
|
|
</head>
|
|
</head>
|
|
|
- <style type="text/css">
|
|
|
|
|
- body,td {
|
|
|
|
|
- font-family: verdana, arial, sans-serif;
|
|
|
|
|
- font-size: 12px;
|
|
|
|
|
- }
|
|
|
|
|
- </style>
|
|
|
|
|
- <body>
|
|
|
|
|
|
|
+ <body bgcolor="$c_bgcolor" text="$c_text" link="$c_link" vlink="$c_vlink" alink="$c_alink">
|
|
|
HTML
|
|
HTML
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
sub htmlfooter
|
|
sub htmlfooter
|
|
|
{
|
|
{
|
|
|
- print <<HTML
|
|
|
|
|
-</body>
|
|
|
|
|
|
|
+print <<HTML
|
|
|
|
|
+ </body>
|
|
|
</html>
|
|
</html>
|
|
|
HTML
|
|
HTML
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+sub mainpage
|
|
|
|
|
+{
|
|
|
|
|
+print <<HTML
|
|
|
|
|
+ <p>$txthead1<br> $txthead2</p>
|
|
|
|
|
+ $txtupdate<br>
|
|
|
|
|
+ <form action=$frmaction method="POST">
|
|
|
|
|
+ <table width="400" cellpadding="2" cellpadding="2" border="0" style="border: 1px
|
|
|
|
|
+ ridge $c_border">
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <td><b>$txtnick</b></td>
|
|
|
|
|
+ <td><input name="nick" type="text" width="30" value="$old_nick"></td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <td><b>$txtalias</b></td>
|
|
|
|
|
+ <td><input name="alias" type="text" width="30" value="$old_alias"></td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <td><b>$txturl</b></td>
|
|
|
|
|
+ <td><input name="link" type="text" width="30" value="$old_link"></td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <td><b>$txtpic</b></td>
|
|
|
|
|
+ <td><input name="pic" type="text" width="30" value="$old_pic"></td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <td><b>$txtsex</b></td>
|
|
|
|
|
+ <td>$txtmale<input type="radio" name="sex" value="m" $old_sexm>$txtfemale<input type="radio" name="sex" value="f" $old_sexf></td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <td><b>$txtignore</B></td>
|
|
|
|
|
+ <td><input type="checkbox" name="ignore" $old_ignr></td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <td colspan="2" align="center">
|
|
|
|
|
+ <input type="submit" value="$submitbtn">
|
|
|
|
|
+ </td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ </table>
|
|
|
|
|
+ </form>
|
|
|
|
|
+ $txtfoot1<br>
|
|
|
|
|
+ $txthelp<br>
|
|
|
|
|
+HTML
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+sub helppage
|
|
|
|
|
+{
|
|
|
|
|
+print <<HTML
|
|
|
|
|
+ <b>$txtnick:</b><br>
|
|
|
|
|
+ $nickhelp<br>
|
|
|
|
|
+ <b>$txtalias:</b><br>
|
|
|
|
|
+ $aliashelp<br>
|
|
|
|
|
+ <b>$txturl:</b><br>
|
|
|
|
|
+ $urlhelp<br>
|
|
|
|
|
+ <b>$txtpic:</b><br>
|
|
|
|
|
+ $pichelp<br>
|
|
|
|
|
+ <b>$txtsex:</b><br>
|
|
|
|
|
+ $sexhelp<br>
|
|
|
|
|
+ <b>$txtignore:</b><br>
|
|
|
|
|
+ $ignorehelp<br>
|
|
|
|
|
+HTML
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+sub readparams
|
|
|
|
|
+{
|
|
|
|
|
+ $frm_nick = param('nick');
|
|
|
|
|
+ $frm_alias = param('alias');
|
|
|
|
|
+ $frm_link = param('link');
|
|
|
|
|
+ $frm_pic = param('pic');
|
|
|
|
|
+ $frm_sex = param('sex');
|
|
|
|
|
+ $frm_ignore = param('ignore');
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
sub read_config
|
|
sub read_config
|
|
|
{
|
|
{
|
|
|
- open(FILE, "<pisg.cfg") or die("Error opening file: $!");
|
|
|
|
|
|
|
+ open(FILE, "<$pisg_config") or die("Error opening pisg config file: $!");
|
|
|
my $i = 0;
|
|
my $i = 0;
|
|
|
while(<FILE>) {
|
|
while(<FILE>) {
|
|
|
if($_ =~ /^<user/) {
|
|
if($_ =~ /^<user/) {
|
|
@@ -86,167 +292,192 @@ sub read_config
|
|
|
return $search;
|
|
return $search;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-sub get_request
|
|
|
|
|
-{
|
|
|
|
|
- my $input;
|
|
|
|
|
- if ($ENV{'REQUEST_METHOD'} eq 'GET') {
|
|
|
|
|
- $input = $ENV{'QUERY_STRING'}
|
|
|
|
|
- } else {
|
|
|
|
|
- read(STDIN, $input, $ENV{'CONTENT_LENGTH'});
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- my @formfields = split(/&/, $input);
|
|
|
|
|
- foreach my $field (@formfields) {
|
|
|
|
|
- my ($name, $value) = split(/=/, $field);
|
|
|
|
|
- $value =~ tr/+/ /;
|
|
|
|
|
- $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
|
|
|
|
|
- $value =~ s/<!--(.|\n)*-->//g;
|
|
|
|
|
- $form{$name} = $value;
|
|
|
|
|
- }
|
|
|
|
|
- if ($form{'ignore'} eq "on") { $form{'ignore'} = 1; }
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
sub check_if_found
|
|
sub check_if_found
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
my $found = 0;
|
|
my $found = 0;
|
|
|
foreach (@nick) {
|
|
foreach (@nick) {
|
|
|
- if ($oldnicks{$_}{'nick'} eq $form{'nick'}) {
|
|
|
|
|
|
|
+ if ($oldnicks{$_}{'nick'} eq $frm_nick) {
|
|
|
$found = 1;
|
|
$found = 1;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if ($found eq "1") {
|
|
|
|
|
- print "<p>The nickname you've choosen is already configured with the following settings:</p>\n";
|
|
|
|
|
- print "<table>\n <tr>\n";
|
|
|
|
|
- print " <td>Nickname:</td>\n <td>$oldnicks{$form{'nick'}}{'nick'}</td>\n";
|
|
|
|
|
- print " </tr>\n";
|
|
|
|
|
- if($oldnicks{$form{'nick'}}{'alias'}) {
|
|
|
|
|
- print " <tr>\n";
|
|
|
|
|
- print " <td>Aliases:</td>\n <td>$oldnicks{$form{'nick'}}{'alias'}</td>\n";
|
|
|
|
|
- print " </tr>\n";
|
|
|
|
|
- }
|
|
|
|
|
- if($oldnicks{$form{'nick'}}{'link'}) {
|
|
|
|
|
- print " <tr>\n";
|
|
|
|
|
- if($oldnicks{$form{'nick'}}{'link'} =~ /^http:|ftp:/) {
|
|
|
|
|
- print " <td>Link:</td>\n <td><a href=\"$oldnicks{$form{'nick'}}{'link'}\">$oldnicks{$form{'nick'}}{'link'}</a></td>\n";
|
|
|
|
|
- }
|
|
|
|
|
- elsif ($oldnicks{$form{'nick'}}{'link'} =~ /(.*)@(.*).(.*)/) {
|
|
|
|
|
- print " <td>Link:</td>\n <td><a href=\"mailto:$oldnicks{$form{'nick'}}{'link'}\">$oldnicks{$form{'nick'}}{'link'}</a></td>\n";
|
|
|
|
|
- } else {
|
|
|
|
|
- print " <td>Link:</td>\n <td>$oldnicks{$form{'nick'}}{'link'}</td>\n";
|
|
|
|
|
- }
|
|
|
|
|
- print " </tr>\n";
|
|
|
|
|
- }
|
|
|
|
|
- if($oldnicks{$form{'nick'}}{'pic'}) {
|
|
|
|
|
- print " <tr>\n";
|
|
|
|
|
- print " <td>Userpic:</td>\n <td valign=\"middle\"><a href=\"$oldnicks{$form{'nick'}}{'pic'}\"><img src=\"$oldnicks{$form{'nick'}}{'pic'}\" border=\"0\"></a></td>\n";
|
|
|
|
|
- print " </tr>\n";
|
|
|
|
|
- }
|
|
|
|
|
- if($oldnicks{$form{'nick'}}{'sex'}) {
|
|
|
|
|
- print " <tr>\n";
|
|
|
|
|
- print " <td>Sex:</td>\n <td valign=\"middle\">$oldnicks{$form{'nick'}}{'sex'}</td>\n";
|
|
|
|
|
- print " </tr>\n";
|
|
|
|
|
- }
|
|
|
|
|
- if($oldnicks{$form{'nick'}}{'ignore'} eq "1") {
|
|
|
|
|
- print " <tr>\n";
|
|
|
|
|
- print " <td>Ignore:</td>\n <td>Yes</td>\n";
|
|
|
|
|
- print " </tr>\n";
|
|
|
|
|
- }
|
|
|
|
|
- print "</table>\n";
|
|
|
|
|
- print "<p>Please click <a href=\"javascript:history.back()\">here</a> to choose an other nickname</p>\n";
|
|
|
|
|
- exit(0);
|
|
|
|
|
|
|
+ if ($found eq "1") {
|
|
|
|
|
+ $old_nick = $oldnicks{$frm_nick}{'nick'};
|
|
|
|
|
+ $old_alias = $oldnicks{$frm_nick}{'alias'};
|
|
|
|
|
+ $old_link = $oldnicks{$frm_nick}{'link'};
|
|
|
|
|
+ $old_pic = $oldnicks{$frm_nick}{'pic'};
|
|
|
|
|
+ $old_sex = $oldnicks{$frm_nick}{'sex'};
|
|
|
|
|
+ $old_ignore = $oldnicks{$frm_nick}{'ignore'};
|
|
|
}
|
|
}
|
|
|
|
|
+ return $found;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-sub checks
|
|
|
|
|
|
|
+sub addinfo
|
|
|
{
|
|
{
|
|
|
- if(!$form{'nick'}) {
|
|
|
|
|
- print "You haven't entered a nickname.. Your request will be ignored<br>";
|
|
|
|
|
- print "Please click <a href=\"javascript:history.back()\">here</a> to choose an other nickname";
|
|
|
|
|
- exit(0);
|
|
|
|
|
|
|
+ my $line_to_add = "<user";
|
|
|
|
|
+ if($frm_nick) {
|
|
|
|
|
+ $line_to_add .= " nick=\"$frm_nick\"";
|
|
|
|
|
+ }
|
|
|
|
|
+ if($frm_alias) {
|
|
|
|
|
+ $line_to_add .= " alias=\"$frm_alias\"";
|
|
|
|
|
+ }
|
|
|
|
|
+ if($frm_link) {
|
|
|
|
|
+ $line_to_add .= " link=\"$frm_link\"";
|
|
|
|
|
+ }
|
|
|
|
|
+ if($frm_pic) {
|
|
|
|
|
+ $line_to_add .= " pic=\"$frm_pic\"";
|
|
|
|
|
+ }
|
|
|
|
|
+ if($frm_sex) {
|
|
|
|
|
+ $line_to_add .= " sex=\"$frm_sex\"";
|
|
|
|
|
+ }
|
|
|
|
|
+ if($frm_ignore eq "on") {
|
|
|
|
|
+ $line_to_add .= " ignore=\"y\"";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if($form{'nick'} and !$form{'alias'} and !$form{'link'} and !$form{'pic'} and !$form{'ignore'} and !$form{'sex'}) {
|
|
|
|
|
- print "You've entered a nickname but haven't configured any settings for that nickname<br>\n";
|
|
|
|
|
- print "Please click <a href=\"javascript:history.back()\">here</a> to configure some settings for the nickname";
|
|
|
|
|
- exit(0);
|
|
|
|
|
|
|
+ $line_to_add .= ">";
|
|
|
|
|
+
|
|
|
|
|
+ open(FILE, ">>$pisg_config") or die("Error writing to configfile: $!");
|
|
|
|
|
+ print FILE "$line_to_add\n";
|
|
|
|
|
+ close(FILE);
|
|
|
|
|
+
|
|
|
|
|
+print <<HTML
|
|
|
|
|
+$txtaddok<br><br>\n
|
|
|
|
|
+<table>
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <td>$txtnick:</td><td>$frm_nick</td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+HTML
|
|
|
|
|
+;
|
|
|
|
|
+ if($frm_alias) {
|
|
|
|
|
+ print " <tr>\n";
|
|
|
|
|
+ print " <td>$txtalias:</td><td>$frm_alias</td>\n";
|
|
|
|
|
+ print " </tr>\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ if($frm_link) {
|
|
|
|
|
+ print " <tr>\n";
|
|
|
|
|
+ if($frm_link =~ /^http:|ftp:/) {
|
|
|
|
|
+ print " <td>$txturl:</td><td><a href=\"$frm_link\">$frm_link</a></td>\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ elsif ($frm_link =~ /(.*)@(.*).(.*)/) {
|
|
|
|
|
+ print " <td>$txturl:</td><td><a href=\"mailto:$frm_link\">$frm_link</a></td>\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ print " <td>$txturl:</td><td>$frm_link</td>\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ print " </tr>\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ if($frm_pic) {
|
|
|
|
|
+ print " <tr>\n";
|
|
|
|
|
+ print " <td>$txtpic:</td><td><img src=\"$frm_pic\"></td>\n";
|
|
|
|
|
+ print " </tr>\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ if($frm_sex eq "m") {
|
|
|
|
|
+ print " <tr>\n";
|
|
|
|
|
+ print " <td>$txtsex:</td><td>$txtmale</td>\n";
|
|
|
|
|
+ print " </tr>\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ if($frm_sex eq "f") {
|
|
|
|
|
+ print " <tr>\n";
|
|
|
|
|
+ print " <td>$txtsex:</td><td>$txtfemale</td>\n";
|
|
|
|
|
+ print " </tr>\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ if($frm_ignore eq "on") {
|
|
|
|
|
+ print " <tr>\n";
|
|
|
|
|
+ print " <td>$txtignore:</td><td>$txtignoreon</td>\n";
|
|
|
|
|
+ print " </tr>\n";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-sub add_line
|
|
|
|
|
|
|
+sub updateinfo
|
|
|
{
|
|
{
|
|
|
|
|
+ my $line;
|
|
|
my $line_to_add = "<user";
|
|
my $line_to_add = "<user";
|
|
|
- if($form{'nick'}) {
|
|
|
|
|
- $line_to_add .= " nick=\"$form{'nick'}\"";
|
|
|
|
|
|
|
+ if($frm_nick) {
|
|
|
|
|
+ $line_to_add .= " nick=\"$frm_nick\"";
|
|
|
}
|
|
}
|
|
|
- if($form{'alias'}) {
|
|
|
|
|
- $line_to_add .= " alias=\"$form{'alias'}\"";
|
|
|
|
|
|
|
+ if($frm_alias) {
|
|
|
|
|
+ $line_to_add .= " alias=\"$frm_alias\"";
|
|
|
}
|
|
}
|
|
|
- if($form{'link'}) {
|
|
|
|
|
- $line_to_add .= " link=\"$form{'link'}\"";
|
|
|
|
|
|
|
+ if($frm_link) {
|
|
|
|
|
+ $line_to_add .= " link=\"$frm_link\"";
|
|
|
}
|
|
}
|
|
|
- if($form{'pic'}) {
|
|
|
|
|
- $line_to_add .= " pic=\"$form{'pic'}\"";
|
|
|
|
|
|
|
+ if($frm_pic) {
|
|
|
|
|
+ $line_to_add .= " pic=\"$frm_pic\"";
|
|
|
}
|
|
}
|
|
|
- if($form{'sex'}) {
|
|
|
|
|
- $line_to_add .= " sex=\"$form{'sex'}\"";
|
|
|
|
|
|
|
+ if($frm_sex) {
|
|
|
|
|
+ $line_to_add .= " sex=\"$frm_sex\"";
|
|
|
}
|
|
}
|
|
|
- if($form{'ignore'} eq "1") {
|
|
|
|
|
|
|
+ if($frm_ignore eq "on") {
|
|
|
$line_to_add .= " ignore=\"y\"";
|
|
$line_to_add .= " ignore=\"y\"";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$line_to_add .= ">";
|
|
$line_to_add .= ">";
|
|
|
|
|
|
|
|
- print <<HTML
|
|
|
|
|
-You nickname was successfully added.:<br>\n
|
|
|
|
|
|
|
+ open(OLDFILE, "$pisg_config") or die("Error reading configfile: $!");
|
|
|
|
|
+ &lock_file(*OLDFILE);
|
|
|
|
|
+ my @lines = <OLDFILE>;
|
|
|
|
|
+ close(OLDFILE);
|
|
|
|
|
+ open(NEWFILE, ">$pisg_config") or die("Error updating configfile: $!");
|
|
|
|
|
+ &lock_file(*NEWFILE);
|
|
|
|
|
+ foreach $line (@lines) {
|
|
|
|
|
+ if ($line =~ /^<user.*nick=\"$frm_nick\"/) {
|
|
|
|
|
+ print NEWFILE "$line_to_add\n"
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ print NEWFILE $line;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ close (NEWFILE);
|
|
|
|
|
+print <<HTML
|
|
|
|
|
+$txtupdateok<br><br>\n
|
|
|
<table>
|
|
<table>
|
|
|
<tr>
|
|
<tr>
|
|
|
- <td>Nickname:</td><td>$form{'nick'}</td>
|
|
|
|
|
|
|
+ <td>$txtnick:</td><td>$frm_nick</td>
|
|
|
</tr>
|
|
</tr>
|
|
|
HTML
|
|
HTML
|
|
|
;
|
|
;
|
|
|
- if($form{'alias'}) {
|
|
|
|
|
|
|
+ if($frm_alias) {
|
|
|
print " <tr>\n";
|
|
print " <tr>\n";
|
|
|
- print " <td>Aliases:</td><td>$form{'alias'}</td>\n";
|
|
|
|
|
|
|
+ print " <td>$txtalias:</td><td>$frm_alias</td>\n";
|
|
|
print " </tr>\n";
|
|
print " </tr>\n";
|
|
|
}
|
|
}
|
|
|
- if($form{'link'}) {
|
|
|
|
|
|
|
+ if($frm_link) {
|
|
|
print " <tr>\n";
|
|
print " <tr>\n";
|
|
|
- print " <td>Link:</td><td><a href=\"$form{'link'}\">$form{'link'}</a></td>\n";
|
|
|
|
|
|
|
+ if($frm_link =~ /^http:|ftp:/) {
|
|
|
|
|
+ print " <td>$txturl:</td><td><a href=\"$frm_link\">$frm_link</a></td>\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ elsif ($frm_link =~ /(.*)@(.*).(.*)/) {
|
|
|
|
|
+ print " <td>$txturl:</td><td><a href=\"mailto:$frm_link\">$frm_link</a></td>\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ print " <td>$txturl:</td><td>$frm_link</td>\n";
|
|
|
|
|
+ }
|
|
|
print " </tr>\n";
|
|
print " </tr>\n";
|
|
|
}
|
|
}
|
|
|
- if($form{'pic'}) {
|
|
|
|
|
|
|
+ if($frm_pic) {
|
|
|
print " <tr>\n";
|
|
print " <tr>\n";
|
|
|
- print " <td>Userpic:</td><td><img src=\"$form{'pic'}\"></td>\n";
|
|
|
|
|
|
|
+ print " <td>$txtpic:</td><td><img src=\"$frm_pic\"></td>\n";
|
|
|
print " </tr>\n";
|
|
print " </tr>\n";
|
|
|
}
|
|
}
|
|
|
- if($form{'sex'}) {
|
|
|
|
|
|
|
+ if($frm_sex eq "m") {
|
|
|
print " <tr>\n";
|
|
print " <tr>\n";
|
|
|
- print " <td>Sex:</td><td>$form{'sex'}</td>\n";
|
|
|
|
|
|
|
+ print " <td>$txtsex:</td><td>$txtmale</td>\n";
|
|
|
print " </tr>\n";
|
|
print " </tr>\n";
|
|
|
}
|
|
}
|
|
|
- if($form{'ignore'} eq "1") {
|
|
|
|
|
|
|
+ if($frm_sex eq "f") {
|
|
|
print " <tr>\n";
|
|
print " <tr>\n";
|
|
|
- print " <td>Ignore:</td><td>Yes</td>\n";
|
|
|
|
|
|
|
+ print " <td>$txtsex:</td><td>$txtfemale</td>\n";
|
|
|
print " </tr>\n";
|
|
print " </tr>\n";
|
|
|
}
|
|
}
|
|
|
- open(FILE, ">>pisg.cfg") or die("Error opening file: $!");
|
|
|
|
|
- print FILE "$line_to_add\n";
|
|
|
|
|
- close(FILE);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-sub main
|
|
|
|
|
-{
|
|
|
|
|
- htmlheader();
|
|
|
|
|
-
|
|
|
|
|
- my $search = read_config();
|
|
|
|
|
- get_request();
|
|
|
|
|
- if ($search ne "1") {
|
|
|
|
|
- check_if_found();
|
|
|
|
|
|
|
+ if($frm_ignore eq "on") {
|
|
|
|
|
+ print " <tr>\n";
|
|
|
|
|
+ print " <td>$txtignore:</td><td>$txtignoreon</td>\n";
|
|
|
|
|
+ print " </tr>\n";
|
|
|
}
|
|
}
|
|
|
- checks();
|
|
|
|
|
- add_line();
|
|
|
|
|
- htmlfooter();
|
|
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
+sub lock_file {
|
|
|
|
|
+ my $lock = 2;
|
|
|
|
|
+ flock($_[0], $lock);
|
|
|
}
|
|
}
|
|
|
-main();
|
|
|