#!/usr/bin/perl require "sm.pl"; require "sm_html.pl"; require "sm-lib.pl"; require "cookie-lib.pl"; require "Date.pl"; &formdata; $uid=$FORM{'uid'}; $mbr_id=$FORM{'i'}; $datenow=&today; $mode=$FORM{'m'}; $action=$FORM{'a'}; &chkuid; if ($mode eq ""){ if ($mbr_id eq ""){ if (&GetCookies($cookiename)){ &GetCompressedCookies($cookiename); $cookie_id=$Cookies{'a'}; if ($cookie_id ne ""){ &chkmbr_cookie; } else{ &delete_cookie($cookiename); } } } else{ &getmbrinfo; } if ($mbr_id ne ""){ if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); $mode=1; &tabs("AC"); &menubar; &leftbar; &mainmenu; ¶(6) } else{ if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); &tabs(AC); &menubar; &leftbar; &prelim; ¶(6) } } else{ $referer=$ENV{'HTTP_REFERER'}; $chkrefer=index($referer,$thisurl); if($chkrefer==-1){ $chkrefer=index($referer,$thisip); if($chkrefer==-1){ $chkrefer=index($referer,$thisip2); } } # if ($chkrefer==-1){ # if ($cookieset eq "N"){ # &sh_header; # } # &sh_title ("$title"); # &sh_body ($bg); # &tabs(0); # &menubar; # &leftbar; # ¶(1); # &sh_fmttext ($font2, $fsize, "Authorisation failed!
Unable to proceed."); # &sh_footer; # exit; # } if ($mode eq "1"){ if ($action eq "My Profile"){ if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); &tabs("AC"); &menubar; &leftbar; &getprofile; &mbrdetails; } elsif ($action eq "My Preferences"){ if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); &tabs("AC"); &menubar; &leftbar; &getprefs; } elsif ($action eq "Mailing Lists"){ if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); &tabs("AC"); &menubar; &leftbar; &getmlists; } elsif ($action eq "My Classified Ads"){ if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); &tabs("AC"); &menubar; &leftbar; &myads; } elsif ($action eq "Change My Password"){ if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); &tabs("AC"); &menubar; &leftbar; &mbrpassword; } } elsif ($mode eq "2"){ if ($action eq "My Profile"){ &chkmand; if ($errflg == 0){ $mbr_email=inputchk($FORM{'m_mbr_email'}); &chkemail($mbr_email); if ($errflg==0){ $q = "Select f_mbr_id from t_mbr WHERE f_mbr_email='$mbr_email' AND f_mbr_id <> '$mbr_id'"; &dbmain ($m1, $m2, $q); $numrows=$data->numrows; if ($numrows==0){ $mbr_fname=inputchk($FORM{'m_mbr_fname'}); $mbr_lname=inputchk($FORM{'m_mbr_lname'}); $mbr_address=inputchk($FORM{'mbr_address'}); $mbr_city=inputchk($FORM{'mbr_city'}); $mbr_county=inputchk($FORM{'mbr_county'}); $mbr_pcode=inputchk($FORM{'mbr_pcode'}); $mbr_country=inputchk($FORM{'mbr_country'}); $mbr_dpa=$FORM{'mbr_dpa'}; $q="Update t_mbr SET f_mbr_fname='$mbr_fname', f_mbr_lname='$mbr_lname', f_mbr_email='$mbr_email', f_mbr_address='$mbr_address', f_mbr_city='$mbr_city', f_mbr_county='$mbr_county', f_mbr_pcode='$mbr_pcode', f_mbr_country='$mbr_country', f_mbr_dpa='$mbr_dpa' WHERE f_mbr_id='$mbr_id'"; &dbmain ($m1, $m2, $q); if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); &tabs(0); &menubar; &leftbar; ¶(1); &sh_fmttext ($font2, $fsize, "Profile Updated!"); ¶(6); } else{ if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); &tabs(0); &menubar; &leftbar; ¶(1); &sh_fmttext ($font2, $fsize, "Duplicate!
Unable to update account because there is a Member with the same email address already on file. Please press the back Button"); ¶(6); } } else{ if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); &tabs(0); &menubar; &leftbar; ¶(1); &sh_fmttext ($font2, $fsize, "Email address appears to be incorrect format.
Please press the Back button."); ¶(6); } } else{ if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); &tabs(0); &menubar; &leftbar; ¶(1); &sh_fmttext ($font2, $fsize, "All fields marked * must be completed.
Please press the Back button."); ¶(6); } } elsif ($action eq "My Preferences"){ foreach $key (keys(%FORM)){ if (substr($key,0,2) eq "X_"){ $website_id=substr($key,2,2); $website_type=substr($key,4,2); if ($website_type eq "PG"){ $subject_id=$FORM{$key}; if (($subject_id ne "")&&($subject_id ne "none")){ $q = "Select f_mbr_id from t_mbrpref1 where f_mbr_id='$mbr_id' AND f_website_id='$website_id'"; &dbmain ($m1, $m2, $q); $numrows=$data->numrows; if ($numrows==0){ $q="Insert into t_mbrpref1 (f_mbr_id, f_website_id, f_subject_id) VALUES ('$mbr_id', '$website_id', '$subject_id')"; &dbmain ($m1, $m2, $q); } else{ $q="Update t_mbrpref1 SET f_subject_id='$subject_id' where f_mbr_id='$mbr_id' AND f_website_id='$website_id'"; &dbmain ($m1, $m2, $q); } } } elsif ($website_type eq "AR"){ $artist_id=$FORM{$key}; if (($artist_id ne "")&&($artist_id ne "none")){ $q = "Select f_mbr_id from t_mbrpref1 where f_mbr_id='$mbr_id' AND f_website_id='$website_id'"; &dbmain ($m1, $m2, $q); $numrows=$data->numrows; if ($numrows==0){ $q="Insert into t_mbrpref1 (f_mbr_id, f_website_id, f_subject_id) VALUES ('$mbr_id', '$website_id', '$artist_id')"; &dbmain ($m1, $m2, $q); } else{ $q="Update t_mbrpref1 SET f_subject_id='$artist_id' where f_mbr_id='$mbr_id' AND f_website_id='$website_id'"; &dbmain ($m1, $m2, $q); } } } } } if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); &tabs(0); &menubar; &leftbar; ¶(1); &sh_fmttext ($font2, $fsize, "Preferences updated!"); ¶(6); } elsif (substr($action,0,9) eq "Remove Ad"){ $ad_id=$FORM{'ei'}; if ($ad_id ne ""){ $image=$imgdir."cl"."$ad_id.jpg"; $image="$ENV{DOCUMENT_ROOT}$image"; unlink($image); $q = "Delete from t_ad where f_ad_id='$ad_id'"; &dbmain ($d1, $d2, $q); if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); &tabs("0"); &menubar; &leftbar; ¶(1); &sh_fmttext ($font2, $fsize, "Ad Removed!"); ¶(6); } else{ if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); &tabs("0"); &menubar; &leftbar; ¶(1); &sh_fmttext ($font2, $fsize, "Cannot Remove Ad!"); ¶(6); } } elsif ($action eq "Mailing List - Remove"){ $mlist_mbr=$FORM{'mlist_mbr'}; if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); &tabs("0"); &menubar; &leftbar; if ($mlist_mbr ne "none"){ $q = "Delete from t_mlist where f_mbr_id='$mbr_id' AND f_subject_id='$mlist_mbr'"; &dbmain ($m1, $m2, $q); &getmlists; } else{ ¶(1); &sh_fmttext_admin ($font2, $fsize, "Whoops!
You have not selected a Subject to Remove."); ¶(5); } } elsif ($action eq "Mailing List - Add"){ $mlist_all=$FORM{'mlist_all'}; if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); &tabs("0"); &menubar; &leftbar; if ($mlist_all ne "none"){ $q = "Select f_subject_id from t_mlist WHERE f_mbr_id='$mbr_id' AND f_subject_id='$mlist_all'"; &dbmain ($m1, $m2, $q); $numrows=$data->numrows; if ($numrows==0){ $q = "Insert into t_mlist (f_mbr_id, f_subject_id) VALUES ('$mbr_id', '$mlist_all')"; &dbmain ($m1, $m2, $q); } &getmlists; } else{ ¶(1); &sh_fmttext_admin ($font2, $fsize, "Whoops!
You have not selected a Subject to Add."); ¶(5); } } elsif ($action eq "Change My Password"){ $mbr_pw_new=inputchk($FORM{'mbr_pw_new'}); $mbr_pw_new2=inputchk($FORM{'mbr_pw_new2'}); &chkpw($mbr_pw_new, $mbr_pw_new2); if (($errflg == 0)&&($mbr_pw_new ne "")){ $q="Update t_mbr SET f_mbr_pw='$mbr_pw_new' WHERE f_mbr_id='$mbr_id'"; &dbmain ($m1, $m2, $q); if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); &tabs(0); &menubar; &leftbar; ¶(1); &sh_fmttext ($font2, $fsize, "Password updated!"); ¶(6); } else{ if ($cookieset eq "N"){ &sh_header; } &sh_title ("$title"); &sh_body ($bg); &tabs(0); &menubar; &leftbar; ¶(1); &sh_fmttext ($font2, $fsize, "Password has not been entered the same in both fields.
Please press the Back button."); ¶(6); } } } } &rightbar; &sh_mainpg4; &sh_footer; #************************************************************************ sub prelim{ print < Whoops
In order to access your account you must be a member and have signed in.

If you are already a member you can Sign In Here.

If you are not a member you can Join Here FREE. HTML } sub mainmenu{ print < Your Account

Member's Name: $mbr_fullname
Account No: $mbr_id


Use $remindme_name to ensure that you don't forget those all important dates (birthdays, anniversaries etc)


Manage any classified ads which you may have placed (upload an image, remove an ad etc)


Update the Profile held on file for you (ie name, address etc)


Update your favourite subjects and/or artist.


Would you like to receive email (eg to tell you about new prints/paintings which we have added to our catalogue) and occasionally FREE GIFT CERTIFICATES. Simply add your name to our subject-specific mailing lists.

HTML } sub myads{ print < My Classified Ads
Only Ads which have a status of Approved are displayed on the main web site.

HTML $q = "Select f_ad_id, f_ad_title, f_ad_status from t_ad WHERE f_mbr_id='$mbr_id' ORDER BY f_ad_status"; &dbmain ($m1, $m2, $q); $numrows=$data->numrows; if ($numrows>0){ $j=0; while($j<$numrows){ @record=$data->fetchrow; $ad_id_list=@record[0]; $ad_title_list=@record[1]; $ad_status_list=@record[2]; if ($ad_status_list eq "P"){ $ad_status_txt="Pending"; } elsif ($ad_status_list eq "L"){ $ad_status_txt="Approved"; } print < Ad id: $ad_id_list
Ad Status: $ad_status_txt
Title: $ad_title_list

HTML $picimage=$imgdir."cl"."$ad_id_list.jpg"; if (-e "$ENV{DOCUMENT_ROOT}$picimage"){ $showimage=$imgdir."cl"."$ad_id_list.jpg"; print <

HTML } else{ print <No image online

HTML } print <

HTML $j++; } } else{ print < HTML } sub mbrpassword{ print < Account No: $mbr_id

Change Password

New Password (max 9 chars)

Repeat New Password (max 9 chars)

HTML } sub mbrdetails{ print <

Fields marked * must be completed

Email Address*
(Your Login ID)

First Name*

Last Name*

 

Address

Town/City

County/State/Province

Post/Zip Code

Country
HTML if ($mbr_dpa eq "Y"){ print <YES HTML } else{ print <YES HTML } print <

HTML } sub chkmbr{ $q = "Select f_mbr_profupdate, f_teamcode, f_mbr_rpt from t_mbr where f_mbr_id='$mbr_id'"; &dbmain ($m1, $m2, $q); @record=$data->fetchrow; $mbr_profupdate=@record[0]; $mbr_team=@record[1]; $mbr_rpt=@record[2]; $rpt_visible=@record[3]; $q = "Select f_teamdesc from t_teams WHERE f_teamcode='$mbr_team'"; &dbmain ($d1, $d2, $q); @record=$data->fetchrow; $teamdesc=@record[0]; } sub getprefs{ print <

You can change the preferences we have on file for you (favourite subjects, artist) below:

HTML $q = "Select f_website_id, f_website_desc, f_website_type from t_website where f_website_status='1' AND f_website_type<>'EX' ORDER BY f_website_type, f_website_desc"; &dbmain ($m1, $m2, $q); $numrows=$data->numrows; $j=0; while($j<$numrows){ @record=$data->fetchrow; $website_id=@record[0]; $website_desc=@record[1]; $website_type=@record[2]; print "$website_desc
\n"; if ($website_type eq "PG"){ &getlistboxsubject_mbr; } if ($website_type eq "AR"){ &getlistboxartist_mbr; } $j++; } print < HTML } sub getlistboxsubject_mbr{ $q_plus = "Select f_subject_id from t_mbrpref1 WHERE f_mbr_id='$mbr_id' AND f_website_id='$website_id'"; &dbmain_plus ($d1, $d2, $q_plus); @record_plus=$data_plus->fetchrow; $mbr_pref_subject_id=@record_plus[0]; print < HTML if ($mbr_pref_subject_id eq ""){ print "\n"; } else{ print "\n"; } $q_plus = "Select f_subject_id, f_subject_desc from t_subject WHERE f_website_id='$website_id' ORDER BY f_subject_desc"; &dbmain_plus ($d1, $d2, $q_plus); $numrows_plus=$data_plus->numrows; $j_plus=0; while ($j_plus<$numrows_plus){ @record_plus=$data_plus->fetchrow; $show_subject_id=@record_plus[0]; $show_subject_desc=@record_plus[1]; if ($show_subject_id eq $mbr_pref_subject_id){ print "\n"; } else{ print "\n"; } $j_plus++; } print <

HTML } sub getlistboxartist_mbr{ $q_plus = "Select f_subject_id from t_mbrpref1 WHERE f_mbr_id='$mbr_id' AND f_website_id='$website_id'"; &dbmain_plus ($d1, $d2, $q_plus); @record_plus=$data_plus->fetchrow; $mbr_pref_subject_id=@record_plus[0]; print < HTML if ($mbr_pref_subject_id eq ""){ print "\n"; } else{ print "\n"; } $q_plus = "Select f_artist_id, f_artist_fname, f_artist_lname from t_artist ORDER BY f_artist_lname"; &dbmain_plus ($d1, $d2, $q_plus); $numrows_plus=$data_plus->numrows; $j_plus=0; while ($j_plus<$numrows_plus){ @record_plus=$data_plus->fetchrow; $show_artist_id=@record_plus[0]; $show_artist_fname=@record_plus[1]; $show_artist_lname=@record_plus[2]; $show_artist_fullname="$show_artist_fname $show_artist_lname"; if ($show_artist_id eq $mbr_pref_subject_id){ print "\n"; } else{ print "\n"; } $j_plus++; } print <


HTML } sub getmlists{ print < Mailing lists
Would you like to receive email (eg to tell you about new prints/paintings which we have added to our catalogue) and occasionally FREE GIFT CERTIFICATES. If so simply add your name to one or more of our subject-specific mailing lists below.

Important: You may also recieve email/gift certificates based upon the preferences which you have set up. If you do not wish to receive any email (or gift certificates) there is an option in Your Profile to state this preference.

All available Mailing Lists
If you would like to add your name to additional mailing lists please select the subject from the drop-down box below and press the Mailing List - Add button below.

Mailing lists which YOU are subscribed to
If you no longer wish to be on one of the mailing lists below please select the subject from the drop-down list box above and press the Mailing List - Remove button below.

HTML }