View Single Post
  #28  
Old 04-23-2005, 12:38 AM
 
x-light x-light is offline
 

Member
  
Join Date: Mar 2005
Posts: 29
 

Default

Hi all,

I am glad to hear some feedbacks about this mod.

Quote:
Did anyone get the x-light code implemented for the 3.5x branch? I would really like this mod, but as soon as I changed the code to use 'func_query_first cell' it seemes to fall down.

Code:
Has anyone done this mod for 3.4.x ??

hey guys, unfortunately I don't have v3.4.x or 3.5x release so I would not know how much work is required to make it compatible. I only have v4.0.12 and v4.0.13 release. Also, I have been working on other mods to customize my store so I won't have too much time in looking at this. Hopefully, someone out there with your versions finds this mod useful and make the proper modifications. Good luck.

Quote:
Has anyone modify it in 4.13? Any problems?
I think register.php in /include is a bit different.

hello usiripakdi, actually, I switched from v4.0.12 to v4.0.13 so I have the updated code. There isn't much difference between these 2 versions as far as the mod is concerned. Here is the updated code.

------------------------------------
include/register.php v3

Code:
# mod1 # find original code snippet # # User registration info passed to register.php via POST method # $existing_user = func_query_first("select password, email from $sql_tbl[customers] where login='$uname'"); if (empty($existing_user)) { $existing_user = func_query_first("SELECT login FROM $sql_tbl[orders] WHERE login='$uname'"); } # end original code snippet # replace modified code snippet # # User registration info passed to register.php via POST method # $existing_user = func_query_first("select password, email from $sql_tbl[customers] where login='$uname'"); if (empty($existing_user)) { $existing_user = func_query_first("SELECT login FROM $sql_tbl[orders] WHERE login='$uname'"); # mod.use.email.rather.username # generate unique id number as username since email is used as unique key in customers and order table # only for non-anonymous users if( !$anonymous_user ){ for( $i=0; $i<3; $i++ ){ $u_tmp = uniqid(rand()); if( $login != $u_tmp ) break; } $uname = $u_tmp; } } # end modified code snippet # mod2 # find original code snippet if (!(@$uerror || @$eerror || @$fillerror || @$error)) { # # Fields filled without errors. User registered successfully # $crypted = addslashes(text_crypt($passwd1)); # end original code snippet # replace modified code snippet # mod.use.email.rather.username if(!$fillerror) { # check if email already exist in customers table $email = strtolower($email); if( $email == func_query_first_cell("select email from $sql_tbl[customers] where email='$email'")) { # duplicate email not allowed $eerror = true; } # exception checks to this rule if( $mode != "update") { # check if this is anonymous registration during checkout if( $eerror && func_query_first_cell("select status from $sql_tbl[customers] where email='$email' and usertype='C'") == 'A' ) { # delete this record since the user is anonymous requesting the same email # we can't assume that the email belongs to the user, but at least this way # the original user can use his/her same email to register again anonymously during another checkout # if an anonymous user already placed an order with this email, it will not effect the orders table # since it is a seperate record # note, if the user is already registered, we will never allow to automatically delete the registered user's record db_query("DELETE FROM $sql_tbl[customers] WHERE login LIKE 'anonymous%' AND email='$email' and usertype='C' AND status='A'"); # this is not an error since we have deleted this record $eerror = false; } } else { if( $email == func_query_first_cell("select email from $sql_tbl[customers] where login='$login' and email='$email'")) { # email match, user did not change email $eupdate = false; # this is not an error since the existing email belong to this user $eerror = false; } else { # email does not match, see if new requested email is taken if( !$eerror ) $eupdate = true; } } } // mod.use.email.rather.username if (!(@$uerror || @$eerror || @$fillerror || @$error)) { # # Fields filled without errors. User registered successfully # $crypted = addslashes(text_crypt($passwd1)); # end modified code snippet # mod3 # find original code snippet # # Update/Insert user info # if ($mode=="update") { $intershipper_recalc = "Y"; db_query("UPDATE $sql_tbl[customers] SET password='$crypted', password_hint='$password_hint', password_hint_answer='$password_hint_answer', title='$title', firstname='$firstname', lastname='$lastname', company='$company', b_address='".$b_address."\n".$b_address_2."', b_city='$b_city', b_county='".(@$b_county)."', b_state='$b_state', b_country='$b_country', b_zipcode='$b_zipcode', s_address='".$s_address."\n".$s_address_2."', s_city='$s_city', s_county='".(@$s_county)."', s_state='$s_state', s_country='$s_country', s_zipcode='$s_zipcode', phone='$phone', email='$email', fax='$fax', url='$url', card_name='$card_name', card_type='$card_type', card_number='".addslashes(text_crypt($card_number))."', card_expire='$card_expire', card_cvv2='$card_cvv2', pending_membership='$pending_membership', ssn='$ssn', change_password='$change_password', parent = '$parent', pending_plan_id = '$pending_plan_id' WHERE login='$login' AND usertype='$login_type'"); # end original code snippet # replace modified code snippet # # Update/Insert user info # if ($mode=="update") { $intershipper_recalc = "Y"; # mod.use.email.rather.username # update email only if eupdate is true if( !$eupdate ) db_query("UPDATE $sql_tbl[customers] SET password='$crypted', password_hint='$password_hint', password_hint_answer='$password_hint_answer', title='$title', firstname='$firstname', lastname='$lastname', company='$company', b_address='".$b_address."\n".$b_address_2."', b_city='$b_city', b_county='".(@$b_county)."', b_state='$b_state', b_country='$b_country', b_zipcode='$b_zipcode', s_address='".$s_address."\n".$s_address_2."', s_city='$s_city', s_county='".(@$s_county)."', s_state='$s_state', s_country='$s_country', s_zipcode='$s_zipcode', phone='$phone', fax='$fax', url='$url', card_name='$card_name', card_type='$card_type', card_number='".addslashes(text_crypt($card_number))."', card_expire='$card_expire', card_cvv2='$card_cvv2', pending_membership='$pending_membership', ssn='$ssn', change_password='$change_password', parent = '$parent', pending_plan_id = '$pending_plan_id' WHERE login='$login' AND usertype='$login_type'"); else db_query("UPDATE $sql_tbl[customers] SET password='$crypted', password_hint='$password_hint', password_hint_answer='$password_hint_answer', title='$title', firstname='$firstname', lastname='$lastname', company='$company', b_address='".$b_address."\n".$b_address_2."', b_city='$b_city', b_county='".(@$b_county)."', b_state='$b_state', b_country='$b_country', b_zipcode='$b_zipcode', s_address='".$s_address."\n".$s_address_2."', s_city='$s_city', s_county='".(@$s_county)."', s_state='$s_state', s_country='$s_country', s_zipcode='$s_zipcode', phone='$phone', email='$email', fax='$fax', url='$url', card_name='$card_name', card_type='$card_type', card_number='".addslashes(text_crypt($card_number))."', card_expire='$card_expire', card_cvv2='$card_cvv2', pending_membership='$pending_membership', ssn='$ssn', change_password='$change_password', parent = '$parent', pending_plan_id = '$pending_plan_id' WHERE login='$login' AND usertype='$login_type'"); # end modified code snippet

~x-light
__________________
X-Cart 4.xx Gold
Enterprise Linux
Reply With Quote