The eAuction Support Forums
https://www.everyscript.de/cgi-bin/yabb/YaBB.pl
eAuction 1.6.1.x >> Start Up and more >> New fields and Change Registration Information
https://www.everyscript.de/cgi-bin/yabb/YaBB.pl?num=1117216728

Message started by mars on 05/27/05 at 19:58:48

Title: New fields and Change Registration Information
Post by mars on 05/27/05 at 19:58:48

I have successfully added some fields to the user registration form. The new field data gets written to the .dat files. The new user is able to bid (that presented a coding problem which I was able to finally overcome). However, I have spent a number of hours focused on the two sub routines:
Sub: Change Registration
Sub: Process Changed Registration

trying to allow a user to be able to change their registration information, like their password, but have been unsuccessful. Depending on what I have tried the newly added fields either return an evaluation error or one that says I have to complete the first of the new fields. The only way I have been successful is to completely fill in all the 5 new fields even if I only want to change the password.

The original registration form fields function just as they always have and I would like the additional 5 fields to function just as the Contact Information fields do ( that is, to be able to Leave blank if unchanged).
I could use some help on this one please.
If you want to take a look:
http://www.marscafe.com/cgi-bin/eAuction161/eAuction.pl?action=creg〈=1

Thank you.

mars

Title: Re: New fields and Change Registration Information
Post by Dieter Werner on 05/27/05 at 21:56:01

Let me see your code ...

Title: Re: New fields and Change Registration Information
Post by mars on 05/28/05 at 00:00:52

Dieter,
Thank you for offering to look at the code, which follows.
I am faily sure that my problem is in the handling of the evaluation logic...I just cannot see the way to handle it, but have tried using what is already there as a template of sorts.
Could it be possible that other sub routines (like  Sub: Display an Closed Item) also requires modification because of the additional fields in the Reg Form?
Regards,
mars

Code:

#-#############################################
# Sub: Change Registration
# This allows a user to change his reg-data
# Released by: EverySoft (Matt Hahnfeld)
# Modifications by: Dieter Werner
#-#############################################
sub creg {
   
print <<EO_HTML;
<div align="center">
<form action="$ENV{'SCRIPT_NAME'}" method="POST">
   <input type="HIDDEN" name="action" value="proccreg">
   <input type="HIDDEN" name="lang" value="$form{'lang'}">
   <h4>$txt{'Change Registration Data'}</h4>
   <table width="550" border="0" bgcolor="$config{'colortablehead'}" cellpadding="3" cellspacing="1">
       <tr bgcolor="$config{'colortablebody'}">
           <td valign="top"><b>$txt{'Your Username'}:<br></b>$txt{'Required for verification'}</td>
           <td><input name="Username" type="TEXT" size="30" maxlength="30"></td>
       </tr>
       <tr bgcolor="$config{'colortablebody'}">
           <td valign="top"><b>$txt{'Your Current Password'}:<br></b>$txt{'Required for verification'}</td>
           <td><input name="OLDPASS" type="PASSWORD" size="30"></td>
       </tr>
       <tr bgcolor="$config{'colortablebody'}">
           <td valign="top"><b>$txt{'Your New Password'}:<br></b>$txt{'Leave blank if unchanged'}</td>
           <td><input name="NEWPASS1" type="PASSWORD" size="30"></td>
       </tr>
       <tr bgcolor="$config{'colortablebody'}">
           <td valign="top"><b>$txt{'Your New Password Again'}:<br></b>$txt{'Leave blank if unchanged'}</td>
           <td><input name="NEWPASS2" type="PASSWORD" size="30"></td>
       </tr>
       <tr bgcolor="$config{'colortablebody'}">
           <td valign="top"><b>$txt{'Contact Information'}:<br></b>$txt{'Leave blank if unchanged'}</td>
           <td><tt>$txt{'Full Name'}:</tt><br>
               <input name="ADDRESS1" type="TEXT" size="30" value=""><br>
               <tt>$txt{'Street Address'}:</tt><br>
               <input name="ADDRESS2" type="TEXT" size="30" value=""><br>
               <tt>$txt{'City'}, $txt{'State'}, $txt{'ZIP'}:</tt><br>
               <input name="ADDRESS3" type="TEXT" size="30" value=""><br>
               <tt>$txt{'Phone'}:</tt><br>
               <input name="PHONE" type="TEXT" size="30" value=""><br>
               <tt>$txt{'Fax'}:</tt><br>
               <input name="FAX" type="TEXT" size="30" value="">
           </td>
       </tr>
                                    <td valign="top"><b>$txt{'Credit Card Information'}:<br></b>$txt{'-----'}</td>
           <td>
                   <tt>$txt{'Name on the Card'}:</tt><br>
               <input name="CCNAME" type="TEXT" size="30"><br>
                   <tt>$txt{'Credit Card Type'}:</tt><br>
                             <select name="CCTYPE" size="1">
                                   <option value="">$txt{''}</option>
                                   <option value="MASTERCARD">$txt{'MASTERCARD'}</option>
                                   <option value="VISA">$txt{'VISA'}</option>
                           </select><BR>
                   <tt>$txt{'Credit Card Number'}:</tt><br>
               <input name="CCINFO" type="TEXT" size="20"><br>
                   <tt>$txt{'Expiration date-Month'}:</tt><br>
                             <select name="CCEXPMONTH" size="1">
                           <option value="">$txt{''}</option>
                                   <option value="01">$txt{'01'}</option>
                                   <option value="02">$txt{'02'}</option>
                                   <option value="03">$txt{'03'}</option>
                                   <option value="04">$txt{'04'}</option>
                                   <option value="05">$txt{'05'}</option>
                                   <option value="06">$txt{'06'}</option>
                                   <option value="07">$txt{'07'}</option>
                                   <option value="08">$txt{'08'}</option>
                                   <option value="09">$txt{'09'}</option>
                                   <option value="10">$txt{'10'}</option>
                                   <option value="11">$txt{'11'}</option>
                                   <option value="12">$txt{'12'}</option>
                           </select><BR>
                   <tt>$txt{'Expiration date-Year'}:</tt><br>
                             <select name="CCEXPYEAR" size="1">
                           <option value="">$txt{''}</option>
                                   <option value="2005">$txt{'2005'}</option>
                                   <option value="2006">$txt{'2006'}</option>
                                   <option value="2007">$txt{'2007'}</option>
                                   <option value="2008">$txt{'2008'}</option>
                                   <option value="2009">$txt{'2009'}</option>
                                   <option value="2010">$txt{'2010'}</option>
                                   <option value="2011">$txt{'2011'}</option>
                                   <option value="2012">$txt{'2012'}</option>
                           </select><BR>            
       
       </td>
       </tr>
   </table>
   <br>
   <center><input type="SUBMIT" value="$txt{'Change Registration'}"></center>
</form>
<br>
@{[disp_banner('tbl')]}
</div>
<br>
EO_HTML

}

#-#############################################
# Sub: Process Changed Registration
# Contributed by: Dieter Werner
#-#############################################
sub proc_creg {
   my (
       $password, $email, $add1, $add2, $add3,
       $phone, $fax, $ccname, $CCTYPE, $CCINFO, $CCEXPMONTH, $CCEXPYEAR, $bid_data,
       @past_bids
   );

   oops($txt{'User Registration is Not Implemented on This Server'})
   unless $config{'regdir'};
   
   oops($txt{'You must enter your Username'})
   unless $form{'Username'};
       
   oops($txt{'You must enter your old password so we can validate your account'})
   unless $form{'OLDPASS'};

   oops($txt{'Your new passwords does not match up'})
   if $form{'NEWPASS1'} ne $form{'NEWPASS2'};
       
   oops($txt{'Please enter your street address'})
   if $form{'ADDRESS1'} and !$form{'ADDRESS2'};
   
   oops($txt{'Please enter your city, state, and zip'})
   if $form{'ADDRESS1'} and !$form{'ADDRESS3'};
   
   oops($txt{'Please enter your phone number'})
   if $form{'ADDRESS1'} and !$form{'PHONE'};

   oops($txt{'You must enter the Name on The Credit Card'})
    unless $form{'CCNAME'};

   oops($txt{'You must enter your Credit card Type'})
   unless $form{'CCTYPE'};

   oops($txt{'You must enter the Credit Card Number'})
   unless $form{'CCINFO'};

   oops($txt{'You must indicate the MONTH the Credit Card Expires'})
   unless $form{'CCEXPMONTH'};

   oops($txt{'You must indicate the YEAR the Credit Card Expires'})
   unless $form{'CCEXPYEAR'};
   
   (
       $password,
       $email,
       $add1,
       $add2,
       $add3,
       $phone,
       $fax,
       $ccname,
       $CCTYPE,
       $CCINFO,
       $CCEXPMONTH,
       $CCEXPYEAR,
       @past_bids
   ) = @{read_reg_file($form{'Username'})};

   oops($txt{'Your old password does not match up'})
   unless (lc $password) eq (lc $form{'OLDPASS'});
   $fax = '--' unless $fax;
   
   $form{'NEWPASS1'} = $password unless $form{'NEWPASS1'};
   $form{'ADDRESS1'} = $add1 unless $form{'ADDRESS1'};
   $form{'ADDRESS2'} = $add2 unless $form{'ADDRESS2'};
   $form{'ADDRESS3'} = $add3 unless $form{'ADDRESS3'};
   $form{'PHONE'} = $phone unless $form{'PHONE'};
   $form{'FAX'} = $fax unless $form{'FAX'};
   $form{'$CCNAME'} = $ccname unless $form{'$CCNAME'};
   $form{'$CCTYPE'} = $CCTYPE unless $form{'$CCTYPE'};
   $form{'$CCINFO'} = $CCINFO unless $form{'$CCINFO'};
   $form{'$CCEXPMONTH'} = $CCEXPMONTH unless $form{'$CCEXPMONTH'};
   $form{'$CCEXPYEAR'} = $CCEXPYEAR unless $form{'$CCEXPYEAR'};            

   $bid_data = join "\n", @past_bids;

   refresh_reg_file(
       $form{'Username'},
       $form{'NEWPASS1'},
       $email,
       $form{'ADDRESS1'},
       $form{'ADDRESS2'},
       $form{'ADDRESS3'},
       $form{'PHONE'},
       $form{'FAX'},
       $form{'CCNAME'},
       $form{'CCTYPE'},
     $form{'CCINFO'},
     $form{'CCEXPMONTH'},
     $form{'CCEXPYEAR'},
       $bid_data
   );
   
print <<EO_HTML;
<div align="center">
   <p><b>
   $txt{'Hello'} $form{'Username'}<br>
   $txt{'your personal data has been successfully changed'}.
   </b></p>
   <br>
   @{[disp_banner('tbl')]}
</div>
<br>                    
EO_HTML

}


#-#############################################
# Sub: Check User-Data
# Checks for valid user information
# Released by: EverySoft (Matt Hahnfeld)
# Modifications by: Dieter Werner
#-#############################################
sub check_user_data {
   
   oops($txt{'You must enter an Username to track your item'})
   unless $form{'Username'};

   oops($txt{'You must enter an Username that consists of alphanumeric characters'})
   unless $form{'Username'} !~ /\W/;
   
   oops($txt{'You must enter a valid e-mail address'})
   unless check_email();
   
   oops($txt{'You must enter your full name'})
   unless $form{'ADDRESS1'};
   
   oops($txt{'You must enter your street address'})
   unless $form{'ADDRESS2'};
   
   oops($txt{'You must enter your city, state, and zip code'})
   unless $form{'ADDRESS3'};
   
   oops($txt{'You must enter your phone number'})
   unless $form{'PHONE'};

   oops($txt{'You must enter the Name on The Credit Card'})
   unless $form{'CCNAME'};

   oops($txt{'You must enter your Credit Card Type'})
   unless $form{'CCTYPE'};

   oops($txt{'You must enter the Credit Card Number'})
   unless $form{'CCINFO'};

   oops($txt{'You must indicate the MONTH the Credit Card Expires'})
   unless $form{'CCEXPMONTH'};

   oops($txt{'You must indicate the YEAR the Credit Card Expires'})
   unless $form{'CCEXPYEAR'};

}

Title: Re: New fields and Change Registration Information
Post by Dieter Werner on 05/28/05 at 09:19:37

That's a bad thing ...
- don't ask for cc-data if you don't run a SSL server
- you don't use cc-data validation

Title: Re: New fields and Change Registration Information
Post by mars22 on 05/28/05 at 14:30:37

When it is auction time  the people who will be invited to participate (from our company contact list and customers) will be directed to an eAuction161 directory which will be password protected (.htaccess) also.

I am doing all of the testing and code modification on my personal website on a shared server, so therfore you see me logged in as mars22 (instead of mars) and the  testing code that needs help is located at at:
http://www.marscafe.com/cgi-bin/eAuction161/eAuction.pl?action=creg&#9001;=1

I have done some research/reading on cc-data validation and know it is considered inmportant and will address it if I can get past this hurdle.  

I also understand you are a very busy person and cannot help everyone and appreciate all you have done so far.

Regards,
mars22 / mars

Title: Re: New fields and Change Registration Information
Post by Dieter Werner on 05/28/05 at 14:57:41

OK ... but
this code can't work

Code:

   $form{'$CCNAME'} = $ccname unless $form{'$CCNAME'};
   $form{'$CCTYPE'} = $CCTYPE unless $form{'$CCTYPE'};
   $form{'$CCINFO'} = $CCINFO unless $form{'$CCINFO'};
   $form{'$CCEXPMONTH'} = $CCEXPMONTH unless $form{'$CCEXPMONTH'};
   $form{'$CCEXPYEAR'} = $CCEXPYEAR unless $form{'$CCEXPYEAR'};  


and this code will work:

Code:

   $form{'CCNAME'} = $ccname unless $form{'CCNAME'};
   $form{'CCTYPE'} = $CCTYPE unless $form{'CCTYPE'};
   $form{'CCINFO'} = $CCINFO unless $form{'CCINFO'};
   $form{'CCEXPMONTH'} = $CCEXPMONTH unless $form{'CCEXPMONTH'};
   $form{'CCEXPYEAR'} = $CCEXPYEAR unless $form{'CCEXPYEAR'};


do you see the difference?

BTW:
you have to add the new fields to some other subroutines too.

Title: Re: New fields and Change Registration Information
Post by mars22 on 05/28/05 at 16:51:19

Dieter,
Thank you very much and I am sorry to have bothered you for something that was just a "bad eyesight" problem and not really a coding issue. I did a quick test and seems all is OK. I have the new fields currently added to the following sub routines:

Sub: Display Item
Sub: Process New Item
Sub: Process Bid
Sub: New Registration
Sub: Process Pre-Registration
Sub: Change Registration
Sub: Process Changed Registration
Sub: Display an Closed Item
Sub: Check User-Data

We will be running the auction as a single user with only us permitted to post items for bidding.
A donation will be sent next week when we return from our long Memorial Day holiday weekend.

Regards again,

mars/mars22

Title: Re: New fields and Change Registration Information
Post by Dieter Werner on 05/28/05 at 17:22:04

You should add it to

- sub close_items
- sub clean_closed

too  :)

The eAuction Support Forums » Powered by YaBB 2.2!
YaBB © 2000-2007. All Rights Reserved.