use DBI;
use CGI;
$CGI_PARAMS=new CGI;
#use POSIX qw(locale_h);
#include ../../inc/dbiconnect.inc
#setlocale(LC_CTYPE, "RU.Windows-1251");
#include ../../inc/head2.inc
####### Default/Startup paramters values #######
$DEFAULT_PART=1;
$SESSIONID=time().$$;
$PASSWD_FILE="/home/hobbydomru/secure/htpasswd.pwd";
$GROUP_FILE="/home/hobbydomru/secure/htgroup";
$MAIL_LOGS_DIR="/home/hobbydomru/secure/nadya_mail_logs";
$MAILER_PROG="/usr/sbin/sendmail -t -f info\@hobbydom.ru";
#$MAILER_PROG="/usr/bin/cyrtrans -t win-koi8 | /bin/mail ";
$FIRST_COME=1;
$ERROR=0;
$WELL_DONE=0;
$SENDER_PATH='/home/hobbydomru/maillist/';
$defaultpubliclastname=0;
$defaultpublicfirstname=0;
$defaultpublicmiddlename=0;
$defaultpublicemail=1;
$defaultpublicbirth=0;
$defaultpublicgender=1;
$defaultpublicprofession=0;
$defaultpublicwebpage=0;
$defaultpublicinterests=0;
if (defined($CGI_PARAMS->param('register')))
{
$login=$CGI_PARAMS->param('login');
$lastname=$CGI_PARAMS->param('lastname');
$firstname=$CGI_PARAMS->param('firstname');
$middlename=$CGI_PARAMS->param('middlename');
$email=$CGI_PARAMS->param('email');
if ($CGI_PARAMS->param('day')=~/^\d+$/ && ($CGI_PARAMS->param('day')<32)
&& $CGI_PARAMS->param('month')=~/^\d+$/ && ($CGI_PARAMS->param('month')<12)
&& $CGI_PARAMS->param('year')=~/^\d+$/ && ($CGI_PARAMS->param('year')>0))
{
$birth=$CGI_PARAMS->param('year').'-'.($CGI_PARAMS->param('month')+1).'-'.$CGI_PARAMS->param('day').' 00:00:00';
}
else
{
$birth='1900-01-01 00:00:00';
}
$gender=$CGI_PARAMS->param('gender');
$profession=$CGI_PARAMS->param('profession');
$webpage=$CGI_PARAMS->param('webpage');
$interests=$CGI_PARAMS->param('interests');
$publiclastname=($CGI_PARAMS->param('publiclastname') || '0');
$publicfirstname=($CGI_PARAMS->param('publicfirstname') || '0');
$publicmiddlename=($CGI_PARAMS->param('publicmiddlename') || '0');
$publicemail=($CGI_PARAMS->param('publicemail') || 0);
$publicbirth=($CGI_PARAMS->param('publicbirth') || '0');
$publicgender=($CGI_PARAMS->param('publicgender') || '0');
$publicprofession=($CGI_PARAMS->param('publicprofession') || '0');
$publicwebpage=($CGI_PARAMS->param('publicwebpage') || '0');
$publicinterests=($CGI_PARAMS->param('publicinterests') || '0');
if ($email =~ /^[\w\.\-]+\@[\w\.]+$/)
{
$q_lastname=$DB->quote($lastname);
$q_firstname=$DB->quote($firstname);
$q_middlename=$DB->quote($middlename);
$q_email=$DB->quote($email);
$q_user=$DB->quote($ENV{REMOTE_USER});
$query="update user set firstname=$q_firstname, middlename=$q_middlename, lastname=$q_lastname, email=$q_email where login=$q_user";
# print $query."
\n";
$result = $DB->prepare($query) or die "Can't prepare query: $query\n";
$result->execute or die "Can't execute query: $query\n";
$query="update anketa set ";
$query.="birth=".$DB->quote($birth).", gender=".$DB->quote($gender).", profession=".$DB->quote($profession).", webpage=".$DB->quote($webpage).", interests=".$DB->quote($interests).",";
$query.=" publiclastname=$publiclastname, publicfirstname=$publicfirstname, publicmiddlename=$publicmiddlename, publicemail=$publicemail, publicbirth=$publicbirth, publicgender=$publicgender, publicprofession=$publicprofession, publicwebpage=$publicwebpage, publicinterests=$publicinterests";
$query.=" where login=".$q_user;
# print $query."
\n";
$result = $DB->prepare($query) or die "Can't prepare query: $query\n";
$result->execute or die "Can't execute query: $query\n";
$result->finish;
}
else
{
$FIRST_COME=0;
$ERROR=1;
if ($email eq '')
{
$ERR_MSG="
Вы не заполнили поле e-mail."; } elsif (!($email =~ /[\w\.\-]+\@[\w\.\-]+/)) { $ERR_MSG="
Вы не правильно заполнили поле e-mail - попробуйте еще раз."; } } } !>
if ($ERROR)
{
print "$ERR_MSG
\n";
}
if ($FIRST_COME)
{
$query="select * from user where login='$ENV{REMOTE_USER}'";
#print $query;
$result = $DB->prepare($query) or die "Can't prepare query: $query\n";
$result->execute or die "Can't execute query: $query\n";
$n=$result->fetchrow_hashref;
#print $n;
$login=$n->{login};
$lastname=$n->{lastname};
$firstname=$n->{firstname};
$middlename=$n->{middlename};
$email=$n->{email};
$query="select * from anketa where login='$ENV{REMOTE_USER}'";
$result = $DB->prepare($query) or die "Can't prepare query: $query\n";
$result->execute or die "Can't execute query: $query\n";
$n=$result->fetchrow_hashref;
$birth=$n->{birth};
$gender=$n->{gender};
$profession=$n->{profession};
$webpage=$n->{webpage};
$interests=$n->{interests};
$publiclastname=$n->{publiclastname};
$publicfirstname=$n->{publicfirstname};
$publicmiddlename=$n->{publicmiddlename};
$publicemail=$n->{publicemail};
$publicbirth=$n->{publicbirth};
$publicgender=$n->{publicgender};
$publicprofession=$n->{publicprofession};
$publicwebpage=$n->{publicwebpage};
$publicinterests=$n->{publicinterests};
!>
Вы можете внести любые изменения в свои данные. Только ник изменить нельзя.
Успехов!
}
if (!$WELL_DONE)
{
!>
}
#include ../../inc/bottom2.inc
!>