????

Your IP : 216.73.216.174


Current Path : /home2/morganrand/www/store/
Upload File :
Current File : /home2/morganrand/www/store/ajax_reg.php

<?php

        require('includes/application_top.php');
          
		    $action = $_POST['action'];

if($action == 'creat_account') {
				
				$firstname = $_POST['entry_firstname'];
				$lastname = $_POST['entry_lastname'];
				$email_address = $_POST['entry_email_address'];
				$password = $_POST['entry_password'];
				$confirmation = $_POST['entry_password_confirm'];
			
				
				$check_email_query = tep_db_query("select customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
					$check_email = tep_db_fetch_array($check_email_query);
					if (!tep_db_num_rows($check_email)){
						
					$sql_data_array = array(
						'customers_firstname' => $firstname,
						'customers_lastname' => $lastname,
						'customers_email_address' => $email_address);
	
					tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);
					
					$customer_id = tep_db_insert_id();						
					
					$sql_data_array_ab = array(
						'customers_id' => $customer_id,
						'entry_firstname' => $firstname,
						'entry_lastname' => $lastname);
					
					tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array_ab);
					$address_id = tep_db_insert_id();
					tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");
					tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$customer_id . "', '0', now())");
					if (SESSION_RECREATE == 'True') tep_session_recreate();
					$customer_first_name = $firstname;
					$customer_default_address_id = $address_id;
					
					
					tep_session_register('customer_id');
					tep_session_register('customer_first_name');
					tep_session_register('customer_default_address_id');
					
					$sessiontoken = md5(tep_rand() . tep_rand() . tep_rand() . tep_rand());
					
						$cart->restore_contents();
						$wishList->restore_wishlist();
						$name = $firstname . ' ' . $lastname;
						
					
					if(isset($HTTP_POST_VARS['products_id'])) {
							if(isset($HTTP_POST_VARS['id'])) {
								$attributes_id = $HTTP_POST_VARS['id'];
								tep_session_register('attributes_id');
							}
							$wishlist_id = $HTTP_POST_VARS['products_id'];
							tep_session_register('wishlist_id');
						}
						$success['success'] = 'true';				
						echo json_encode($success);
					
						
					 } else {
							$success['success'] = 'false';
                            $success['msg'] = 'email already exists';							
						    echo json_encode($success);
							exit;
						}
						
					
					
					
				
				}


 
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>