eAuction
  Not just another Perl script
Google
Welcome, Guest. Please Login or Register


If you use eAuction a lot and like it or if you make money from eAuction or from eAuction-related activities ...
then the project asks you for a donation in favor of the further development.



The forums are protected by
AccessControl
(written by Dieter Werner)
Click here if you want to check your IP against the most important RBLs of the net.
Click here in order to visite the AccessControl forums.


<< Visit the international e Auction Marketplace >>
Buy and sell PC and Consumer Electronic components






  HomeHelpSearchLoginRegister
 



Pages: 1 2 3 
New fields and Change Registration Information (Read 504 times)
mars
eAuction Expert
Tester
***
Offline

I love Perl

Posts: 149

New fields and Change Registration Information
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:
Multimedia file viewing and clickable links are available for registered members only!!  You need to Login or Register!!


Thank you.

mars
Back to top
 
 


Advertising
View Profile   IP Logged
Dieter Werner
Administrator
*****
Offline

Dipl. Paranoiac ®

Posts: 1162
Germany
Gender: male
Re: New fields and Change Registration Information
Reply #1 - 05/27/05 at 21:56:01
 
Let me see your code ...
Back to top
 
 

Multimedia file viewing and clickable links are available for registered members only!!  You need to Login or Register!!


Greetings from Germany
Dieter Werner




Advertising
View Profile | WWW   IP Logged
mars
eAuction Expert
Tester
***
Offline

I love Perl

Posts: 149

Re: New fields and Change Registration Information
Reply #2 - 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'};

} 

Back to top
 
« Last Edit: 05/28/05 at 14:37:52 by Dieter Werner »  


Advertising
View Profile   IP Logged
Pages: 1 2 3 


If you like eAuction, please Rate it.
If you don't like eAuction, please Rate it too.


1 is being poor and 10 is being excellent


EveryScript

ip-location


AccessControl - Members Only