updates
Showing
3 changed files
with
35 additions
and
5 deletions
| ... | @@ -88,6 +88,34 @@ function validateDate( $date, $format='YYYY-MM-DD') | ... | @@ -88,6 +88,34 @@ function validateDate( $date, $format='YYYY-MM-DD') |
| 88 | 88 | ||
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | function validate_creditcard($cc_num, $type) { | ||
| 92 | |||
| 93 | if($type == "amex") { | ||
| 94 | $pattern = "/^([34|37]{2})([0-9]{13})$/"; //American Express | ||
| 95 | if (preg_match($pattern,$cc_num)) { | ||
| 96 | $verified = true; | ||
| 97 | } else { | ||
| 98 | $verified = false; | ||
| 99 | } | ||
| 100 | } elseif ($type == "mc") { | ||
| 101 | $pattern = "/^([51|52|53|54|55]{2})([0-9]{14})$/"; //Mastercard | ||
| 102 | if (preg_match($pattern,$cc_num)) { | ||
| 103 | $verified = true; | ||
| 104 | } else { | ||
| 105 | $verified = false; | ||
| 106 | } | ||
| 107 | } elseif ( $type == "visa" ) { | ||
| 108 | $pattern = "/^([4]{1})([0-9]{12,15})$/"; //Visa | ||
| 109 | if (preg_match($pattern,$cc_num)) { | ||
| 110 | $verified = true; | ||
| 111 | } else { | ||
| 112 | $verified = false; | ||
| 113 | } | ||
| 114 | } | ||
| 115 | |||
| 116 | return $verified; | ||
| 117 | } | ||
| 118 | |||
| 91 | class Vars { | 119 | class Vars { |
| 92 | 120 | ||
| 93 | public static $prefixes = Array( | 121 | public static $prefixes = Array( |
| ... | @@ -102,9 +130,9 @@ class Vars { | ... | @@ -102,9 +130,9 @@ class Vars { |
| 102 | ); | 130 | ); |
| 103 | 131 | ||
| 104 | public static $countries = Array( | 132 | public static $countries = Array( |
| 105 | 'CAN' => 'Canada' | 133 | 'CA' => 'Canada' |
| 106 | , 'USA' => 'United States' | 134 | , 'US' => 'United States' |
| 107 | , 'MEX' => 'Mexico' | 135 | , 'MX' => 'Mexico' |
| 108 | , 'Other' => 'Other' | 136 | , 'Other' => 'Other' |
| 109 | ); | 137 | ); |
| 110 | 138 | ... | ... |
| ... | @@ -109,7 +109,7 @@ unset($rc, $roles['administrator']); | ... | @@ -109,7 +109,7 @@ unset($rc, $roles['administrator']); |
| 109 | <td> | 109 | <td> |
| 110 | <select name="user_role" id="create_user_role"> | 110 | <select name="user_role" id="create_user_role"> |
| 111 | <?php foreach($roles as $roled=>$name):?> | 111 | <?php foreach($roles as $roled=>$name):?> |
| 112 | <option value="<?php echo $roled;?>"><?php echo $name;?></option> | 112 | <option value="<?php echo $roled;?>" <?php echo ($roled=="guest") ? "selected" : "";?>><?php echo $name;?></option> |
| 113 | <?php endforeach;?> | 113 | <?php endforeach;?> |
| 114 | </select> | 114 | </select> |
| 115 | </td> | 115 | </td> | ... | ... |
| ... | @@ -195,7 +195,7 @@ use WP_User, WP_Roles; | ... | @@ -195,7 +195,7 @@ use WP_User, WP_Roles; |
| 195 | <div style="clear:both;"></div> | 195 | <div style="clear:both;"></div> |
| 196 | 196 | ||
| 197 | 197 | ||
| 198 | <div id="show_special_status" style="display:<?php echo ($role=="member") ? "block" : "none";?>"> | 198 | <div id="show_special_status" style="display:block;"> |
| 199 | <h3 style="margin-bottom:5px; padding-bottom:0px;">Special Status:</h3> | 199 | <h3 style="margin-bottom:5px; padding-bottom:0px;">Special Status:</h3> |
| 200 | <input type="hidden" name="special_status_active" value="true" /> | 200 | <input type="hidden" name="special_status_active" value="true" /> |
| 201 | <table cellpadding="0" cellspacing="0" border="0"> | 201 | <table cellpadding="0" cellspacing="0" border="0"> |
| ... | @@ -261,6 +261,7 @@ use WP_User, WP_Roles; | ... | @@ -261,6 +261,7 @@ use WP_User, WP_Roles; |
| 261 | <script src="<?php echo Tools\url('../UserManager.js', __FILE__);?>" type="text/javascript"></script> | 261 | <script src="<?php echo Tools\url('../UserManager.js', __FILE__);?>" type="text/javascript"></script> |
| 262 | <script type="text/javascript"> | 262 | <script type="text/javascript"> |
| 263 | jQuery(function() { | 263 | jQuery(function() { |
| 264 | /* Dan asked me to keep special status open for all in the backend. | ||
| 264 | jQuery('#user_role').change(function() { | 265 | jQuery('#user_role').change(function() { |
| 265 | if (jQuery(this).val() == "member") { | 266 | if (jQuery(this).val() == "member") { |
| 266 | jQuery('#show_special_status').show(); | 267 | jQuery('#show_special_status').show(); |
| ... | @@ -268,6 +269,7 @@ jQuery(function() { | ... | @@ -268,6 +269,7 @@ jQuery(function() { |
| 268 | jQuery('#show_special_status').hide(); | 269 | jQuery('#show_special_status').hide(); |
| 269 | } | 270 | } |
| 270 | }); | 271 | }); |
| 272 | */ | ||
| 271 | }); | 273 | }); |
| 272 | </script> | 274 | </script> |
| 273 | 275 | ... | ... |
-
Please register or sign in to post a comment