@@ -22,128 +22,128 @@ |
||
22 | 22 | ############################################################################### |
23 | 23 | |
24 | 24 | class Astpp_common extends CI_Model { |
25 | - // ------------------------------------------------------------------------ |
|
26 | - /** |
|
27 | - * initialises the class inheriting the methods of the class Model |
|
28 | - * |
|
29 | - * @return Usermodel |
|
30 | - */ |
|
31 | - function Astpp_common() { |
|
32 | - parent::__construct(); |
|
33 | - } |
|
34 | - /** |
|
35 | - * -------Here we write code for model astpp_common_model functions list_applyable_charges------ |
|
36 | - * Purpose: build array for applyable charge dropdown list. |
|
37 | - * @param |
|
38 | - * @return return array of applyable chargelist. |
|
39 | - */ |
|
40 | - function list_applyable_charges($accountid = '') { |
|
41 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
42 | - $reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : 0; |
|
25 | + // ------------------------------------------------------------------------ |
|
26 | + /** |
|
27 | + * initialises the class inheriting the methods of the class Model |
|
28 | + * |
|
29 | + * @return Usermodel |
|
30 | + */ |
|
31 | + function Astpp_common() { |
|
32 | + parent::__construct(); |
|
33 | + } |
|
34 | + /** |
|
35 | + * -------Here we write code for model astpp_common_model functions list_applyable_charges------ |
|
36 | + * Purpose: build array for applyable charge dropdown list. |
|
37 | + * @param |
|
38 | + * @return return array of applyable chargelist. |
|
39 | + */ |
|
40 | + function list_applyable_charges($accountid = '') { |
|
41 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
42 | + $reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : 0; |
|
43 | 43 | $q= " SELECT * FROM `charges` where reseller_id =$reseller_id and id NOT IN(select charge_id from charge_to_account where accountid =$accountid) AND pricelist_id = '0'"; |
44 | - $item_arr = array(); |
|
45 | - $query = $this->db->query($q); |
|
46 | - if ($query->num_rows() > 0) { |
|
47 | - foreach ($query->result_array() as $row) { |
|
48 | - if ($row['charge'] > 0) { |
|
49 | - $row['charge'] = $this->common_model->calculate_currency($row['charge']); |
|
50 | - } |
|
51 | - $item_arr[$row['id']] = $row['description'] . ' - ' . $row['charge']; |
|
52 | - } |
|
53 | - } |
|
54 | - return $item_arr; |
|
55 | - } |
|
56 | - function quote($inp) { |
|
57 | - return "'" . $this->db->escape_str($inp) . "'"; |
|
58 | - } |
|
59 | - function db_get_item($q, $colname) { |
|
60 | - $item_arr = array(); |
|
61 | - $query = $this->db->query($q); |
|
62 | - if ($query->num_rows() > 0) { |
|
63 | - $row = $query->row_array(); |
|
64 | - return $row[$colname]; |
|
65 | - } |
|
66 | - return ''; |
|
67 | - } |
|
68 | - // Return the balance for a specific ASTPP account. |
|
69 | - function accountbalance($account) { |
|
70 | - $debit = 0; |
|
71 | - $q = "SELECT SUM(debit) as val1 FROM cdrs WHERE accountid=" . $this->quote($account) . " AND status NOT IN (1, 2)"; |
|
72 | - $query = $this->db->query($q); |
|
73 | - if ($query->num_rows() > 0) { |
|
74 | - $row = $query->row_array(); |
|
75 | - $debit = $row['val1']; |
|
76 | - } |
|
77 | - $credit = 0; |
|
78 | - $q = "SELECT SUM(credit) as val1 FROM cdrs WHERE accountid= " . $this->quote($account) . " AND status NOT IN (1, 2)"; |
|
79 | - $query = $this->db->query($q); |
|
80 | - if ($query->num_rows() > 0) { |
|
81 | - $row = $query->row_array(); |
|
82 | - $credit = $row['val1']; |
|
83 | - } |
|
84 | - $posted_balance = 0; |
|
85 | - $q = "SELECT * FROM accounts WHERE id = " . $this->quote($account); |
|
86 | - $query = $this->db->query($q); |
|
87 | - if ($query->num_rows() > 0) { |
|
88 | - $row = $query->row_array(); |
|
89 | - $posted_balance = $row['balance']; |
|
90 | - } |
|
91 | - $balance = ( $debit - $credit + $posted_balance ); |
|
92 | - return $balance; |
|
93 | - } |
|
94 | - function accounts_total_balance($reseller) { |
|
95 | - $debit = 0; |
|
96 | - $credit = 0; |
|
97 | - if ($reseller == "") { |
|
98 | - $q = "SELECT SUM(debit) as val1 FROM cdrs WHERE status NOT IN (1, 2)"; |
|
99 | - $debit = $this->db_get_item($q, 'val1'); |
|
44 | + $item_arr = array(); |
|
45 | + $query = $this->db->query($q); |
|
46 | + if ($query->num_rows() > 0) { |
|
47 | + foreach ($query->result_array() as $row) { |
|
48 | + if ($row['charge'] > 0) { |
|
49 | + $row['charge'] = $this->common_model->calculate_currency($row['charge']); |
|
50 | + } |
|
51 | + $item_arr[$row['id']] = $row['description'] . ' - ' . $row['charge']; |
|
52 | + } |
|
53 | + } |
|
54 | + return $item_arr; |
|
55 | + } |
|
56 | + function quote($inp) { |
|
57 | + return "'" . $this->db->escape_str($inp) . "'"; |
|
58 | + } |
|
59 | + function db_get_item($q, $colname) { |
|
60 | + $item_arr = array(); |
|
61 | + $query = $this->db->query($q); |
|
62 | + if ($query->num_rows() > 0) { |
|
63 | + $row = $query->row_array(); |
|
64 | + return $row[$colname]; |
|
65 | + } |
|
66 | + return ''; |
|
67 | + } |
|
68 | + // Return the balance for a specific ASTPP account. |
|
69 | + function accountbalance($account) { |
|
70 | + $debit = 0; |
|
71 | + $q = "SELECT SUM(debit) as val1 FROM cdrs WHERE accountid=" . $this->quote($account) . " AND status NOT IN (1, 2)"; |
|
72 | + $query = $this->db->query($q); |
|
73 | + if ($query->num_rows() > 0) { |
|
74 | + $row = $query->row_array(); |
|
75 | + $debit = $row['val1']; |
|
76 | + } |
|
77 | + $credit = 0; |
|
78 | + $q = "SELECT SUM(credit) as val1 FROM cdrs WHERE accountid= " . $this->quote($account) . " AND status NOT IN (1, 2)"; |
|
79 | + $query = $this->db->query($q); |
|
80 | + if ($query->num_rows() > 0) { |
|
81 | + $row = $query->row_array(); |
|
82 | + $credit = $row['val1']; |
|
83 | + } |
|
84 | + $posted_balance = 0; |
|
85 | + $q = "SELECT * FROM accounts WHERE id = " . $this->quote($account); |
|
86 | + $query = $this->db->query($q); |
|
87 | + if ($query->num_rows() > 0) { |
|
88 | + $row = $query->row_array(); |
|
89 | + $posted_balance = $row['balance']; |
|
90 | + } |
|
91 | + $balance = ( $debit - $credit + $posted_balance ); |
|
92 | + return $balance; |
|
93 | + } |
|
94 | + function accounts_total_balance($reseller) { |
|
95 | + $debit = 0; |
|
96 | + $credit = 0; |
|
97 | + if ($reseller == "") { |
|
98 | + $q = "SELECT SUM(debit) as val1 FROM cdrs WHERE status NOT IN (1, 2)"; |
|
99 | + $debit = $this->db_get_item($q, 'val1'); |
|
100 | 100 | |
101 | - $q = "SELECT SUM(credit) as val1 FROM cdrs WHERE status NOT IN (1, 2)"; |
|
102 | - $credit = $this->db_get_item($q, 'val1'); |
|
101 | + $q = "SELECT SUM(credit) as val1 FROM cdrs WHERE status NOT IN (1, 2)"; |
|
102 | + $credit = $this->db_get_item($q, 'val1'); |
|
103 | 103 | |
104 | - $tmp = "SELECT SUM(balance) as val1 FROM accounts WHERE reseller_id = ''"; |
|
105 | - } else { |
|
106 | - $tmp = "SELECT SUM(balance) as val1 FROM accounts WHERE reseller_id = " . $this->quote($reseller); |
|
107 | - } |
|
108 | - $posted_balance = $this->db_get_item($tmp, "val1"); |
|
104 | + $tmp = "SELECT SUM(balance) as val1 FROM accounts WHERE reseller_id = ''"; |
|
105 | + } else { |
|
106 | + $tmp = "SELECT SUM(balance) as val1 FROM accounts WHERE reseller_id = " . $this->quote($reseller); |
|
107 | + } |
|
108 | + $posted_balance = $this->db_get_item($tmp, "val1"); |
|
109 | 109 | |
110 | - $balance = ( $debit - $credit + $posted_balance ); |
|
111 | - return $balance; |
|
112 | - } |
|
113 | - function count_dids($test) { |
|
114 | - $tmp = "SELECT COUNT(*) as val1 FROM dids " . $test; |
|
115 | - return $this->db_get_item($tmp, 'val1'); |
|
116 | - } |
|
110 | + $balance = ( $debit - $credit + $posted_balance ); |
|
111 | + return $balance; |
|
112 | + } |
|
113 | + function count_dids($test) { |
|
114 | + $tmp = "SELECT COUNT(*) as val1 FROM dids " . $test; |
|
115 | + return $this->db_get_item($tmp, 'val1'); |
|
116 | + } |
|
117 | 117 | |
118 | - function count_callingcards($where, $field = 'COUNT(*)') { |
|
119 | - $tmp = "SELECT $field as val FROM callingcards " . $where; |
|
120 | - return $this->db_get_item($tmp, 'val'); |
|
121 | - } |
|
118 | + function count_callingcards($where, $field = 'COUNT(*)') { |
|
119 | + $tmp = "SELECT $field as val FROM callingcards " . $where; |
|
120 | + return $this->db_get_item($tmp, 'val'); |
|
121 | + } |
|
122 | 122 | |
123 | - function count_accounts($test) { |
|
124 | - $tmp = "SELECT COUNT(*) as val1 FROM accounts " . $test; |
|
125 | - return $this->db_get_item($tmp, 'val1'); |
|
126 | - } |
|
123 | + function count_accounts($test) { |
|
124 | + $tmp = "SELECT COUNT(*) as val1 FROM accounts " . $test; |
|
125 | + return $this->db_get_item($tmp, 'val1'); |
|
126 | + } |
|
127 | 127 | |
128 | - function count_rategroup($test){ |
|
128 | + function count_rategroup($test){ |
|
129 | 129 | $tmp = "SELECT COUNT(*) as val1 FROM pricelists " . $test; |
130 | - return $this->db_get_item($tmp, 'val1'); |
|
131 | - } |
|
130 | + return $this->db_get_item($tmp, 'val1'); |
|
131 | + } |
|
132 | 132 | |
133 | - function count_termination($test = ''){ |
|
133 | + function count_termination($test = ''){ |
|
134 | 134 | $tmp = "SELECT COUNT(*) as val1 FROM outbound_routes " . $test; |
135 | - return $this->db_get_item($tmp, 'val1'); |
|
136 | - } |
|
135 | + return $this->db_get_item($tmp, 'val1'); |
|
136 | + } |
|
137 | 137 | |
138 | - function count_trunk($test = ''){ |
|
138 | + function count_trunk($test = ''){ |
|
139 | 139 | $tmp = "SELECT COUNT(*) as val1 FROM trunks " . $test; |
140 | - return $this->db_get_item($tmp, 'val1'); |
|
141 | - } |
|
140 | + return $this->db_get_item($tmp, 'val1'); |
|
141 | + } |
|
142 | 142 | |
143 | - function count_origination($test = ''){ |
|
143 | + function count_origination($test = ''){ |
|
144 | 144 | $tmp = "SELECT COUNT(*) as val1 FROM routes " . $test; |
145 | - return $this->db_get_item($tmp, 'val1'); |
|
146 | - } |
|
145 | + return $this->db_get_item($tmp, 'val1'); |
|
146 | + } |
|
147 | 147 | |
148 | 148 | } |
149 | 149 | ?> |
@@ -10,8 +10,8 @@ |
||
10 | 10 | function send_csv_mail ($csvData, $body, $to, $subject,$file_name) { |
11 | 11 | //print_r($csvData); |
12 | 12 | $where = array('group_title' =>'email'); |
13 | - $query = $this->CI->db_model->getSelect("*", "system", $where); |
|
14 | - $query = $query->result_array(); |
|
13 | + $query = $this->CI->db_model->getSelect("*", "system", $where); |
|
14 | + $query = $query->result_array(); |
|
15 | 15 | foreach($query as $key=>$val){ |
16 | 16 | $from=$val['value']; |
17 | 17 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | if(strtolower(trim($value)) == strtolower(trim($selected))) |
38 | 38 | { |
39 | 39 | |
40 | - $form .= ' selected="selected" >'; |
|
40 | + $form .= ' selected="selected" >'; |
|
41 | 41 | |
42 | 42 | } |
43 | 43 | else |
@@ -24,464 +24,464 @@ |
||
24 | 24 | |
25 | 25 | class Signup extends MX_Controller { |
26 | 26 | |
27 | - function signup() { |
|
28 | - parent::__construct(); |
|
29 | - $this->load->model('signup_model'); |
|
30 | - $this->load->helper('captcha'); |
|
31 | - $this->load->helper('template_inheritance'); |
|
32 | - //$this->load->library('form_validation'); |
|
33 | - $this->load->library('astpp/common'); |
|
34 | - $this->load->library('astpp/email_lib'); |
|
35 | - $this->load->model('db_model'); |
|
36 | - $this->load->model('common_model'); |
|
37 | - $this->load->library('session'); |
|
38 | - $this->load->library('encrypt'); |
|
39 | - $this->load->model('Astpp_common'); |
|
40 | - |
|
41 | - error_reporting(-1); |
|
42 | - ini_set('display_errors', 'On'); |
|
43 | - |
|
44 | - $data['row'] = $this->signup_model->get_rate(); |
|
45 | - } |
|
46 | - |
|
47 | - function index($key = "") { |
|
48 | - |
|
49 | - if (Common_model::$global_config['system_config']['enable_signup'] == 1) |
|
27 | + function signup() { |
|
28 | + parent::__construct(); |
|
29 | + $this->load->model('signup_model'); |
|
30 | + $this->load->helper('captcha'); |
|
31 | + $this->load->helper('template_inheritance'); |
|
32 | + //$this->load->library('form_validation'); |
|
33 | + $this->load->library('astpp/common'); |
|
34 | + $this->load->library('astpp/email_lib'); |
|
35 | + $this->load->model('db_model'); |
|
36 | + $this->load->model('common_model'); |
|
37 | + $this->load->library('session'); |
|
38 | + $this->load->library('encrypt'); |
|
39 | + $this->load->model('Astpp_common'); |
|
40 | + |
|
41 | + error_reporting(-1); |
|
42 | + ini_set('display_errors', 'On'); |
|
43 | + |
|
44 | + $data['row'] = $this->signup_model->get_rate(); |
|
45 | + } |
|
46 | + |
|
47 | + function index($key = "") { |
|
48 | + |
|
49 | + if (Common_model::$global_config['system_config']['enable_signup'] == 1) |
|
50 | 50 | { |
51 | - redirect(base_url()); |
|
51 | + redirect(base_url()); |
|
52 | 52 | } |
53 | 53 | |
54 | - $userCaptcha = $this->input->post('userCaptcha'); |
|
55 | - $random_number = substr(number_format(time() * rand(), 0, '', ''), 0, 6); |
|
56 | - $accountinfo=(array)$this->db->get_where('accounts',array('type'=>-1))->first_row(); |
|
57 | - $data['timezone_id'] = (!$accountinfo['timezone_id']) ? 1 : $accountinfo['timezone_id']; |
|
58 | - $data['currency_id'] = (!$accountinfo['currency_id']) ? 1 : $accountinfo['currency_id']; |
|
59 | - $data['country_id'] = (!$accountinfo['country_id']) ? 1 : $accountinfo['country_id']; |
|
60 | - |
|
61 | - $vals = array( |
|
62 | - 'word' => $random_number, |
|
63 | - 'img_path' => getcwd() . '/assets/captcha/', |
|
64 | - 'img_url' => base_url() . 'assets/captcha/', |
|
65 | - //'font_path' => './fonts/impact.ttf', |
|
66 | - 'img_width' => '243', |
|
67 | - 'img_height' => '50', |
|
68 | - 'expiration' => '3600' |
|
69 | - ); |
|
70 | - |
|
71 | - if (isset($key) && $key != '') { |
|
72 | - $data['key_unique'] = $key; |
|
73 | - } else { |
|
74 | - $data['key_unique'] = "admin"; |
|
75 | - } |
|
76 | - $unique = $data['key_unique']; |
|
77 | - |
|
78 | - if ($unique != "admin") { |
|
79 | - $unique = $this->common->decode_params(trim($unique)); |
|
80 | - $decoded_str = $this->common->decode($unique); |
|
81 | - $unique = $decoded_str; |
|
82 | - $query = $this->db_model->getSelect("*", 'accounts', array('id' => $unique, "deleted" => "0")); |
|
83 | - if ($query->num_rows() == 0) { |
|
84 | - redirect(base_url() . "signup/signup_inactive"); |
|
85 | - } |
|
86 | - if ($query->num_rows() > 0) { |
|
87 | - $query = $query->result_array(); |
|
88 | - $query = $query[0]; |
|
89 | - |
|
90 | - if ($query['status'] != 0) { |
|
91 | - redirect(base_url() . "signup/signup_inactive"); |
|
92 | - } |
|
93 | - } |
|
94 | - } |
|
95 | - $data['captcha'] = create_captcha($vals); |
|
96 | - $this->session->set_userdata('captchaWord', $data['captcha']['word']); |
|
97 | - $this->load->view('view_signup', $data); |
|
98 | - } |
|
99 | - |
|
100 | - public function check_captcha($str) { |
|
101 | - $word = $this->session->userdata('captchaWord'); |
|
102 | - if (strcmp(strtoupper($str), strtoupper($word)) == 0) { |
|
103 | - return true; |
|
104 | - } else { |
|
105 | - $this->form_validation->set_message('check_captcha', 'Please enter correct words!'); |
|
106 | - return false; |
|
107 | - } |
|
108 | - } |
|
109 | - |
|
110 | - function terms_check() { |
|
111 | - if (isset($_POST['agreeCheck'])) |
|
112 | - return true; |
|
113 | - $this->form_validation->set_message('terms_check', 'THIS IS SOOOOO REQUIRED, DUDE!'); |
|
114 | - return false; |
|
115 | - } |
|
116 | - |
|
117 | - function signup_save($id = "") { |
|
118 | - if (empty($_POST)) { |
|
119 | - redirect(base_url() . "signup/"); |
|
120 | - } else { |
|
121 | - $post_values = $this->input->post(); |
|
122 | - $userCaptcha = $this->input->post('userCaptcha'); |
|
123 | - $cnt_result = $this->db_model->countQuery("*", 'accounts', array('email' => $post_values['email'])); |
|
124 | - |
|
125 | - if ($userCaptcha != $this->session->userdata('captchaWord') || !filter_var($this->input->post('email'), FILTER_VALIDATE_EMAIL) || $cnt_result > 0) { |
|
126 | - if (!filter_var($this->input->post('email'), FILTER_VALIDATE_EMAIL)) { |
|
127 | - $data['error']['email'] = "<div style='color: red;'> Please enter proper email </div>"; |
|
128 | - } |
|
129 | - if ($userCaptcha != $this->session->userdata('captchaWord')) { |
|
130 | - $data['error']['userCaptcha'] = "<div style='color: red;'>Please enter valid Captcha code</div>"; |
|
131 | - } |
|
132 | - if ($cnt_result > 0) { |
|
133 | - $data['error']['email'] = "<div style='color: red;'>Email Address already exists</div>"; |
|
134 | - } |
|
135 | - $random_number = substr(number_format(time() * rand(), 0, '', ''), 0, 6); |
|
136 | - $vals = array( |
|
137 | - 'word' => $random_number, |
|
138 | - 'img_path' => getcwd() . '/assets/captcha/', |
|
139 | - 'img_url' => base_url() . 'assets/captcha/', |
|
140 | - //'font_path' => './fonts/impact.ttf', |
|
141 | - 'img_width' => '243', |
|
142 | - 'img_height' => '50', |
|
143 | - 'expiration' => '3600' |
|
144 | - ); |
|
145 | - //echo "<pre>"; print_r($_POST); exit; |
|
146 | - if (isset($_POST['key_unique']) && $_POST['key_unique'] == "admin") { |
|
147 | - $data['key_unique'] = $_POST['key_unique']; |
|
148 | - } |
|
54 | + $userCaptcha = $this->input->post('userCaptcha'); |
|
55 | + $random_number = substr(number_format(time() * rand(), 0, '', ''), 0, 6); |
|
56 | + $accountinfo=(array)$this->db->get_where('accounts',array('type'=>-1))->first_row(); |
|
57 | + $data['timezone_id'] = (!$accountinfo['timezone_id']) ? 1 : $accountinfo['timezone_id']; |
|
58 | + $data['currency_id'] = (!$accountinfo['currency_id']) ? 1 : $accountinfo['currency_id']; |
|
59 | + $data['country_id'] = (!$accountinfo['country_id']) ? 1 : $accountinfo['country_id']; |
|
60 | + |
|
61 | + $vals = array( |
|
62 | + 'word' => $random_number, |
|
63 | + 'img_path' => getcwd() . '/assets/captcha/', |
|
64 | + 'img_url' => base_url() . 'assets/captcha/', |
|
65 | + //'font_path' => './fonts/impact.ttf', |
|
66 | + 'img_width' => '243', |
|
67 | + 'img_height' => '50', |
|
68 | + 'expiration' => '3600' |
|
69 | + ); |
|
70 | + |
|
71 | + if (isset($key) && $key != '') { |
|
72 | + $data['key_unique'] = $key; |
|
73 | + } else { |
|
74 | + $data['key_unique'] = "admin"; |
|
75 | + } |
|
76 | + $unique = $data['key_unique']; |
|
77 | + |
|
78 | + if ($unique != "admin") { |
|
79 | + $unique = $this->common->decode_params(trim($unique)); |
|
80 | + $decoded_str = $this->common->decode($unique); |
|
81 | + $unique = $decoded_str; |
|
82 | + $query = $this->db_model->getSelect("*", 'accounts', array('id' => $unique, "deleted" => "0")); |
|
83 | + if ($query->num_rows() == 0) { |
|
84 | + redirect(base_url() . "signup/signup_inactive"); |
|
85 | + } |
|
86 | + if ($query->num_rows() > 0) { |
|
87 | + $query = $query->result_array(); |
|
88 | + $query = $query[0]; |
|
89 | + |
|
90 | + if ($query['status'] != 0) { |
|
91 | + redirect(base_url() . "signup/signup_inactive"); |
|
92 | + } |
|
93 | + } |
|
94 | + } |
|
95 | + $data['captcha'] = create_captcha($vals); |
|
96 | + $this->session->set_userdata('captchaWord', $data['captcha']['word']); |
|
97 | + $this->load->view('view_signup', $data); |
|
98 | + } |
|
99 | + |
|
100 | + public function check_captcha($str) { |
|
101 | + $word = $this->session->userdata('captchaWord'); |
|
102 | + if (strcmp(strtoupper($str), strtoupper($word)) == 0) { |
|
103 | + return true; |
|
104 | + } else { |
|
105 | + $this->form_validation->set_message('check_captcha', 'Please enter correct words!'); |
|
106 | + return false; |
|
107 | + } |
|
108 | + } |
|
109 | + |
|
110 | + function terms_check() { |
|
111 | + if (isset($_POST['agreeCheck'])) |
|
112 | + return true; |
|
113 | + $this->form_validation->set_message('terms_check', 'THIS IS SOOOOO REQUIRED, DUDE!'); |
|
114 | + return false; |
|
115 | + } |
|
116 | + |
|
117 | + function signup_save($id = "") { |
|
118 | + if (empty($_POST)) { |
|
119 | + redirect(base_url() . "signup/"); |
|
120 | + } else { |
|
121 | + $post_values = $this->input->post(); |
|
122 | + $userCaptcha = $this->input->post('userCaptcha'); |
|
123 | + $cnt_result = $this->db_model->countQuery("*", 'accounts', array('email' => $post_values['email'])); |
|
124 | + |
|
125 | + if ($userCaptcha != $this->session->userdata('captchaWord') || !filter_var($this->input->post('email'), FILTER_VALIDATE_EMAIL) || $cnt_result > 0) { |
|
126 | + if (!filter_var($this->input->post('email'), FILTER_VALIDATE_EMAIL)) { |
|
127 | + $data['error']['email'] = "<div style='color: red;'> Please enter proper email </div>"; |
|
128 | + } |
|
129 | + if ($userCaptcha != $this->session->userdata('captchaWord')) { |
|
130 | + $data['error']['userCaptcha'] = "<div style='color: red;'>Please enter valid Captcha code</div>"; |
|
131 | + } |
|
132 | + if ($cnt_result > 0) { |
|
133 | + $data['error']['email'] = "<div style='color: red;'>Email Address already exists</div>"; |
|
134 | + } |
|
135 | + $random_number = substr(number_format(time() * rand(), 0, '', ''), 0, 6); |
|
136 | + $vals = array( |
|
137 | + 'word' => $random_number, |
|
138 | + 'img_path' => getcwd() . '/assets/captcha/', |
|
139 | + 'img_url' => base_url() . 'assets/captcha/', |
|
140 | + //'font_path' => './fonts/impact.ttf', |
|
141 | + 'img_width' => '243', |
|
142 | + 'img_height' => '50', |
|
143 | + 'expiration' => '3600' |
|
144 | + ); |
|
145 | + //echo "<pre>"; print_r($_POST); exit; |
|
146 | + if (isset($_POST['key_unique']) && $_POST['key_unique'] == "admin") { |
|
147 | + $data['key_unique'] = $_POST['key_unique']; |
|
148 | + } |
|
149 | 149 | |
150 | 150 | $accountinfo=(array)$this->db->get_where('accounts',array('type'=>-1))->first_row(); |
151 | 151 | $data['timezone_id'] = (!$accountinfo['timezone_id']) ? 1 : $accountinfo['timezone_id']; |
152 | 152 | $data['currency_id'] = (!$accountinfo['currency_id']) ? 1 : $accountinfo['currency_id']; |
153 | 153 | $data['country_id'] = (!$accountinfo['country_id']) ? 1 : $accountinfo['country_id']; |
154 | 154 | |
155 | - $data['timezone_id'] = (!$data['timezone_id']) ? 1 : $data['timezone_id']; |
|
156 | - $data['currency_id'] = (!$data['currency_id']) ? 1 : $data['currency_id']; |
|
157 | - $data['country_id'] = (!$data['country_id']) ? 1 : $data['country_id']; |
|
155 | + $data['timezone_id'] = (!$data['timezone_id']) ? 1 : $data['timezone_id']; |
|
156 | + $data['currency_id'] = (!$data['currency_id']) ? 1 : $data['currency_id']; |
|
157 | + $data['country_id'] = (!$data['country_id']) ? 1 : $data['country_id']; |
|
158 | 158 | |
159 | - $data['value'] = $post_values; |
|
160 | - $data['captcha'] = create_captcha($vals); |
|
159 | + $data['value'] = $post_values; |
|
160 | + $data['captcha'] = create_captcha($vals); |
|
161 | 161 | |
162 | - $this->session->set_userdata('captchaWord', $data['captcha']['word']); |
|
163 | - $data['key_unique'] = $_POST['key_unique']; |
|
164 | - $this->load->view('view_signup', $data); |
|
165 | - } else { |
|
166 | - //AVTLATP |
|
167 | - $user_data = $this->input->post(); |
|
162 | + $this->session->set_userdata('captchaWord', $data['captcha']['word']); |
|
163 | + $data['key_unique'] = $_POST['key_unique']; |
|
164 | + $this->load->view('view_signup', $data); |
|
165 | + } else { |
|
166 | + //AVTLATP |
|
167 | + $user_data = $this->input->post(); |
|
168 | 168 | |
169 | - if (!isset($_POST['key_unique']) || !isset($_POST['email'])) { |
|
170 | - redirect(base_url() . "signup/"); |
|
171 | - } |
|
172 | - $reseller_id = 0; |
|
173 | - if (isset($_POST['key_unique']) && $_POST['key_unique'] != "admin") { |
|
174 | - $_POST['key_unique'] = $this->common->decode_params(trim($_POST['key_unique'])); |
|
175 | - $decoded_str = $this->common->decode($_POST['key_unique']); |
|
176 | - $_POST['key_unique'] = $decoded_str; |
|
177 | - $user_data['key_unique'] = $_POST['key_unique']; |
|
178 | - $reseller_id = $user_data['key_unique']; |
|
179 | - } |
|
180 | - //echo "<pre>"; print_r($_POST); exit; |
|
181 | - //AVTLATP |
|
182 | - //Data want to insert or update |
|
183 | - $user_data['status'] = "1"; |
|
184 | - $user_data['number'] = $this->common->find_uniq_rendno_customer(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts'); |
|
185 | - |
|
186 | - $user_data['password'] = $this->common->encode($this->common->generate_password()); |
|
187 | - $user_data['pin'] = $this->common->generate_password(); |
|
188 | - $user_data['reseller_id'] = $reseller_id; |
|
189 | - $user_data['posttoexternal'] = "0"; |
|
190 | - |
|
191 | - unset($user_data['userCaptcha']); |
|
192 | - unset($user_data['action']); |
|
193 | - |
|
194 | - $system_config = common_model::$global_config['system_config']; |
|
195 | - $balance = $system_config["balance"]; |
|
196 | - |
|
197 | - /* $query = $this->db_model->getSelect("*", 'invoice_conf ', array('id' => $unique ,"deleted" => "0")); |
|
169 | + if (!isset($_POST['key_unique']) || !isset($_POST['email'])) { |
|
170 | + redirect(base_url() . "signup/"); |
|
171 | + } |
|
172 | + $reseller_id = 0; |
|
173 | + if (isset($_POST['key_unique']) && $_POST['key_unique'] != "admin") { |
|
174 | + $_POST['key_unique'] = $this->common->decode_params(trim($_POST['key_unique'])); |
|
175 | + $decoded_str = $this->common->decode($_POST['key_unique']); |
|
176 | + $_POST['key_unique'] = $decoded_str; |
|
177 | + $user_data['key_unique'] = $_POST['key_unique']; |
|
178 | + $reseller_id = $user_data['key_unique']; |
|
179 | + } |
|
180 | + //echo "<pre>"; print_r($_POST); exit; |
|
181 | + //AVTLATP |
|
182 | + //Data want to insert or update |
|
183 | + $user_data['status'] = "1"; |
|
184 | + $user_data['number'] = $this->common->find_uniq_rendno_customer(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts'); |
|
185 | + |
|
186 | + $user_data['password'] = $this->common->encode($this->common->generate_password()); |
|
187 | + $user_data['pin'] = $this->common->generate_password(); |
|
188 | + $user_data['reseller_id'] = $reseller_id; |
|
189 | + $user_data['posttoexternal'] = "0"; |
|
190 | + |
|
191 | + unset($user_data['userCaptcha']); |
|
192 | + unset($user_data['action']); |
|
193 | + |
|
194 | + $system_config = common_model::$global_config['system_config']; |
|
195 | + $balance = $system_config["balance"]; |
|
196 | + |
|
197 | + /* $query = $this->db_model->getSelect("*", 'invoice_conf ', array('id' => $unique ,"deleted" => "0")); |
|
198 | 198 | $query = $query->result_array(); */ |
199 | 199 | |
200 | - $company_website = $system_config["company_website"]; |
|
201 | - $company_name = $system_config["company_name"]; |
|
200 | + $company_website = $system_config["company_website"]; |
|
201 | + $company_name = $system_config["company_name"]; |
|
202 | 202 | |
203 | - //echo $company_name; exit; |
|
204 | - $selection_rategroup_signup = $system_config["default_signup_rategroup"]; |
|
203 | + //echo $company_name; exit; |
|
204 | + $selection_rategroup_signup = $system_config["default_signup_rategroup"]; |
|
205 | 205 | |
206 | - if ($reseller_id != 0) { |
|
207 | - $result = $this->db_model->getSelect("*", "pricelists", array("reseller_id" => $reseller_id), "ASC"); |
|
208 | - $result_arr = $result->result_array(); |
|
209 | - $selection_rategroup_signup = $result_arr[0]['id']; |
|
210 | - $user_data['pricelist_id'] = (isset($selection_rategroup_signup) && $selection_rategroup_signup > 0 ) ? $selection_rategroup_signup : 0; |
|
211 | - } else { |
|
212 | - $pricelist_id = $this->common->get_field_name('id', 'pricelists', array('name' => $selection_rategroup_signup)); |
|
213 | - /* if($pricelis_id != "") |
|
206 | + if ($reseller_id != 0) { |
|
207 | + $result = $this->db_model->getSelect("*", "pricelists", array("reseller_id" => $reseller_id), "ASC"); |
|
208 | + $result_arr = $result->result_array(); |
|
209 | + $selection_rategroup_signup = $result_arr[0]['id']; |
|
210 | + $user_data['pricelist_id'] = (isset($selection_rategroup_signup) && $selection_rategroup_signup > 0 ) ? $selection_rategroup_signup : 0; |
|
211 | + } else { |
|
212 | + $pricelist_id = $this->common->get_field_name('id', 'pricelists', array('name' => $selection_rategroup_signup)); |
|
213 | + /* if($pricelis_id != "") |
|
214 | 214 | $user_data['pricelist_id'] = $pricelis_id; |
215 | 215 | else |
216 | 216 | $user_data['pricelist_id'] = 0; */ |
217 | - $user_data['pricelist_id'] = ($pricelist_id != "") ? $pricelist_id : 0; |
|
218 | - } |
|
219 | - $last_id='0'; |
|
220 | - //Insert or Update record |
|
221 | - $signup_sipdevice_flag = $system_config['create_sipdevice']; |
|
222 | - $last_id = $this->signup_model->add_user($user_data); |
|
223 | - if ($last_id == "") { |
|
224 | - redirect(base_url() . "signup/signup_inactive"); |
|
225 | - } |
|
226 | - if ($signup_sipdevice_flag == '0') { |
|
227 | - $query = $this->db_model->select("*", "sip_profiles", array('name' => "default"), "id", "ASC", '1', '0'); |
|
228 | - $sip_id = $query->result_array(); |
|
229 | - if($reseller_id > 0){ |
|
217 | + $user_data['pricelist_id'] = ($pricelist_id != "") ? $pricelist_id : 0; |
|
218 | + } |
|
219 | + $last_id='0'; |
|
220 | + //Insert or Update record |
|
221 | + $signup_sipdevice_flag = $system_config['create_sipdevice']; |
|
222 | + $last_id = $this->signup_model->add_user($user_data); |
|
223 | + if ($last_id == "") { |
|
224 | + redirect(base_url() . "signup/signup_inactive"); |
|
225 | + } |
|
226 | + if ($signup_sipdevice_flag == '0') { |
|
227 | + $query = $this->db_model->select("*", "sip_profiles", array('name' => "default"), "id", "ASC", '1', '0'); |
|
228 | + $sip_id = $query->result_array(); |
|
229 | + if($reseller_id > 0){ |
|
230 | 230 | $reseller_id = $reseller_id; |
231 | 231 | }else{ |
232 | 232 | $reseller_id = '0'; |
233 | 233 | } |
234 | - $free_switch_array = array('fs_username' => $user_data['number'], |
|
235 | - 'fs_password' => $user_data['password'], |
|
236 | - 'context' => 'default', |
|
237 | - 'effective_caller_id_name' => $user_data['number'], |
|
238 | - 'effective_caller_id_number' => $user_data['number'], |
|
239 | - 'sip_profile_id' => $sip_id[0]['id'], |
|
240 | - 'reseller_id' => $reseller_id, |
|
241 | - 'pricelist_id' => $user_data['pricelist_id'], |
|
242 | - 'accountcode' => $last_id, |
|
243 | - 'status' => $user_data['status'], |
|
244 | - 'voicemail_enabled'=>true, |
|
245 | - 'voicemail_password'=>'', |
|
246 | - 'voicemail_mail_to'=>'', |
|
247 | - 'voicemail_attach_file'=>true, |
|
248 | - 'vm_keep_local_after_email'=>true, |
|
249 | - 'vm_send_all_message'=>true, |
|
250 | - ); |
|
251 | - $user_custom_array=array_merge($user_data,$free_switch_array); |
|
252 | - $user_custom_array['id']=$last_id; |
|
253 | - $user_custom_array['email']=$user_data['email']; |
|
234 | + $free_switch_array = array('fs_username' => $user_data['number'], |
|
235 | + 'fs_password' => $user_data['password'], |
|
236 | + 'context' => 'default', |
|
237 | + 'effective_caller_id_name' => $user_data['number'], |
|
238 | + 'effective_caller_id_number' => $user_data['number'], |
|
239 | + 'sip_profile_id' => $sip_id[0]['id'], |
|
240 | + 'reseller_id' => $reseller_id, |
|
241 | + 'pricelist_id' => $user_data['pricelist_id'], |
|
242 | + 'accountcode' => $last_id, |
|
243 | + 'status' => $user_data['status'], |
|
244 | + 'voicemail_enabled'=>true, |
|
245 | + 'voicemail_password'=>'', |
|
246 | + 'voicemail_mail_to'=>'', |
|
247 | + 'voicemail_attach_file'=>true, |
|
248 | + 'vm_keep_local_after_email'=>true, |
|
249 | + 'vm_send_all_message'=>true, |
|
250 | + ); |
|
251 | + $user_custom_array=array_merge($user_data,$free_switch_array); |
|
252 | + $user_custom_array['id']=$last_id; |
|
253 | + $user_custom_array['email']=$user_data['email']; |
|
254 | 254 | |
255 | - $this->load->model('freeswitch/freeswitch_model'); |
|
256 | - $this->freeswitch_model->add_freeswith($user_custom_array); |
|
257 | - } |
|
258 | - // echo "<pre>"; print_r ($user_data); exit; |
|
259 | - $activation = $this->encrypt->encode($user_data['number']); |
|
260 | - $message = base_url() . 'signup/signup_confirm?email=' . urlencode($user_data['email']) . "&key=" . urlencode($activation); |
|
261 | - $user_data['confirm'] = $message; |
|
262 | - |
|
263 | - $this->send_mail($last_id, 'email_signup_confirmation', $user_data); |
|
264 | - redirect(base_url() . "signup/signup_success"); |
|
265 | - } |
|
266 | - } |
|
267 | - } |
|
268 | - |
|
269 | - function signup_confirm() { |
|
270 | - if (!empty($_GET)) { |
|
271 | - |
|
272 | - $system_config = common_model::$global_config['system_config']; |
|
273 | - $balance = $system_config["balance"]; |
|
274 | - $accno = $this->encrypt->decode($_GET['key']); |
|
275 | - $email = $_GET['email']; |
|
276 | - $success = $this->signup_model->check_user($accno, $email, $balance); |
|
277 | - $query = $this->db_model->getSelect("*", "accounts", array('number' => $accno)); |
|
278 | - $data = $query->result_array(); |
|
279 | - $user_data = $data[0]; |
|
280 | - $user_data['accountid'] = $user_data['id']; |
|
281 | - $user_data['success'] = $success; |
|
282 | - $user_data['balance'] = $balance; |
|
283 | - $user_data['confirm'] = base_url(); |
|
284 | - $this->active($user_data, $success); |
|
285 | - } else { |
|
286 | - redirect(base_url()); |
|
287 | - } |
|
288 | - } |
|
289 | - |
|
290 | - function signup_success() { |
|
291 | - $this->load->view('view_signup_success'); |
|
292 | - } |
|
293 | - |
|
294 | - function signup_inactive() { |
|
295 | - $this->load->view('view_signup_inactive'); |
|
296 | - } |
|
297 | - |
|
298 | - function active($user_data, $success) { |
|
299 | - $data['user_data'] = $user_data; |
|
300 | - $data['user_data']['success'] = $success; |
|
301 | - |
|
302 | - if ($user_data['success']) { |
|
255 | + $this->load->model('freeswitch/freeswitch_model'); |
|
256 | + $this->freeswitch_model->add_freeswith($user_custom_array); |
|
257 | + } |
|
258 | + // echo "<pre>"; print_r ($user_data); exit; |
|
259 | + $activation = $this->encrypt->encode($user_data['number']); |
|
260 | + $message = base_url() . 'signup/signup_confirm?email=' . urlencode($user_data['email']) . "&key=" . urlencode($activation); |
|
261 | + $user_data['confirm'] = $message; |
|
262 | + |
|
263 | + $this->send_mail($last_id, 'email_signup_confirmation', $user_data); |
|
264 | + redirect(base_url() . "signup/signup_success"); |
|
265 | + } |
|
266 | + } |
|
267 | + } |
|
268 | + |
|
269 | + function signup_confirm() { |
|
270 | + if (!empty($_GET)) { |
|
271 | + |
|
272 | + $system_config = common_model::$global_config['system_config']; |
|
273 | + $balance = $system_config["balance"]; |
|
274 | + $accno = $this->encrypt->decode($_GET['key']); |
|
275 | + $email = $_GET['email']; |
|
276 | + $success = $this->signup_model->check_user($accno, $email, $balance); |
|
277 | + $query = $this->db_model->getSelect("*", "accounts", array('number' => $accno)); |
|
278 | + $data = $query->result_array(); |
|
279 | + $user_data = $data[0]; |
|
280 | + $user_data['accountid'] = $user_data['id']; |
|
281 | + $user_data['success'] = $success; |
|
282 | + $user_data['balance'] = $balance; |
|
283 | + $user_data['confirm'] = base_url(); |
|
284 | + $this->active($user_data, $success); |
|
285 | + } else { |
|
286 | + redirect(base_url()); |
|
287 | + } |
|
288 | + } |
|
289 | + |
|
290 | + function signup_success() { |
|
291 | + $this->load->view('view_signup_success'); |
|
292 | + } |
|
293 | + |
|
294 | + function signup_inactive() { |
|
295 | + $this->load->view('view_signup_inactive'); |
|
296 | + } |
|
297 | + |
|
298 | + function active($user_data, $success) { |
|
299 | + $data['user_data'] = $user_data; |
|
300 | + $data['user_data']['success'] = $success; |
|
301 | + |
|
302 | + if ($user_data['success']) { |
|
303 | 303 | $user_data['password'] = $this->common->decode($user_data['password']); |
304 | - $this->send_mail($user_data['id'], 'email_add_user', $user_data); |
|
305 | - } |
|
306 | - $this->load->view('view_signup_active', $data); |
|
307 | - } |
|
308 | - |
|
309 | - function forgotpassword() { |
|
310 | - $this->load->view('view_forgotpassword'); |
|
311 | - } |
|
312 | - |
|
313 | - function confirmpassword() { |
|
314 | - $email = $_POST['email']; |
|
315 | - unset($_POST['action']); |
|
316 | - $where = array('email' => $email); |
|
317 | - $this->db->where($where); |
|
318 | - $this->db->or_where('number',$email); |
|
319 | - $cnt_result = $this->db_model->countQuery("*", 'accounts', ""); |
|
320 | - if (!empty($email)) { |
|
321 | - $names = array('0', '1', '3'); |
|
322 | - $this->db->where_in('type', $names); |
|
323 | - $where_arr = array("email" => $email); |
|
324 | - $this->db->where($where_arr); |
|
304 | + $this->send_mail($user_data['id'], 'email_add_user', $user_data); |
|
305 | + } |
|
306 | + $this->load->view('view_signup_active', $data); |
|
307 | + } |
|
308 | + |
|
309 | + function forgotpassword() { |
|
310 | + $this->load->view('view_forgotpassword'); |
|
311 | + } |
|
312 | + |
|
313 | + function confirmpassword() { |
|
314 | + $email = $_POST['email']; |
|
315 | + unset($_POST['action']); |
|
316 | + $where = array('email' => $email); |
|
317 | + $this->db->where($where); |
|
318 | + $this->db->or_where('number',$email); |
|
319 | + $cnt_result = $this->db_model->countQuery("*", 'accounts', ""); |
|
320 | + if (!empty($email)) { |
|
321 | + $names = array('0', '1', '3'); |
|
322 | + $this->db->where_in('type', $names); |
|
323 | + $where_arr = array("email" => $email); |
|
324 | + $this->db->where($where_arr); |
|
325 | 325 | $this->db->or_where('number',$email); |
326 | - $acountdata = $this->db_model->getSelect("*", "accounts", ""); |
|
327 | - if ($acountdata->num_rows() > 0) { |
|
328 | - $user_data = $acountdata->result_array(); |
|
329 | - $user_data = $user_data[0]; |
|
330 | - if ($user_data['status'] > 0) { |
|
331 | - $data['error']['email'] = "<div id='error_mail' style='color:red; margin: 1% 22%; float: left;'>This account is not Active.</div>"; |
|
332 | - $this->load->view('view_forgotpassword', $data); |
|
333 | - exit; |
|
334 | - } |
|
335 | - } |
|
336 | - if ($acountdata->num_rows() == 0 && !filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
337 | - if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
338 | - $data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left; width:100%;'>Please enter proper Username or Email.</div>"; |
|
339 | - |
|
340 | - $this->load->view('view_forgotpassword', $data); |
|
341 | - } else { |
|
342 | - $data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left;width:100%;'>This Username or Email is not valid</div>"; |
|
343 | - |
|
344 | - $this->load->view('view_forgotpassword', $data); |
|
345 | - } |
|
346 | - } else if($acountdata->num_rows() == 0){ |
|
347 | - $data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left; width:100%;'>Please enter proper Username or Email.</div>"; |
|
348 | - $this->load->view('view_forgotpassword', $data); |
|
349 | - } else { |
|
350 | - $acountdata = $acountdata->result_array(); |
|
351 | - $user_data = $acountdata[0]; |
|
326 | + $acountdata = $this->db_model->getSelect("*", "accounts", ""); |
|
327 | + if ($acountdata->num_rows() > 0) { |
|
328 | + $user_data = $acountdata->result_array(); |
|
329 | + $user_data = $user_data[0]; |
|
330 | + if ($user_data['status'] > 0) { |
|
331 | + $data['error']['email'] = "<div id='error_mail' style='color:red; margin: 1% 22%; float: left;'>This account is not Active.</div>"; |
|
332 | + $this->load->view('view_forgotpassword', $data); |
|
333 | + exit; |
|
334 | + } |
|
335 | + } |
|
336 | + if ($acountdata->num_rows() == 0 && !filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
337 | + if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
338 | + $data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left; width:100%;'>Please enter proper Username or Email.</div>"; |
|
339 | + |
|
340 | + $this->load->view('view_forgotpassword', $data); |
|
341 | + } else { |
|
342 | + $data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left;width:100%;'>This Username or Email is not valid</div>"; |
|
343 | + |
|
344 | + $this->load->view('view_forgotpassword', $data); |
|
345 | + } |
|
346 | + } else if($acountdata->num_rows() == 0){ |
|
347 | + $data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left; width:100%;'>Please enter proper Username or Email.</div>"; |
|
348 | + $this->load->view('view_forgotpassword', $data); |
|
349 | + } else { |
|
350 | + $acountdata = $acountdata->result_array(); |
|
351 | + $user_data = $acountdata[0]; |
|
352 | 352 | |
353 | - $email = $this->encrypt->encode($user_data['email']); |
|
354 | - $activation = $this->encrypt->encode($user_data['number']); |
|
355 | - $message = base_url() . 'confirm_pass?email=' . urlencode($email) . "&key=" . urlencode($activation); |
|
356 | - $user_data['confirm'] = $message; |
|
357 | - $where = array("email" => $user_data['email']); |
|
358 | - $data = array("pass_link_status" => 1); |
|
359 | - $this->db->where($where); |
|
360 | - $this->db->update('accounts', $data); |
|
361 | - $system_config = common_model::$global_config['system_config']; |
|
362 | - $balance = $system_config["balance"]; |
|
363 | - $this->send_mail($user_data['id'], 'email_forgot_confirmation', $user_data); |
|
364 | - $this->load->view('view_forgot_success'); |
|
365 | - } |
|
366 | - } else { |
|
367 | - redirect(base_url()); |
|
368 | - } |
|
369 | - } |
|
370 | - |
|
371 | - function confirm_pass() { |
|
372 | - $confirm_pass = $_GET; |
|
373 | - $accno = ''; |
|
374 | - $balance = ''; |
|
375 | - $email1 = $this->encrypt->decode($confirm_pass['email']); |
|
376 | - $success = $this->signup_model->check_user($accno, $email1, $balance); |
|
377 | - if (!empty($confirm_pass)) { |
|
378 | - $where_arr = array("email" => $email1, "status" => 0); |
|
379 | - $acountdata = $this->db_model->getSelect("*", "accounts", $where_arr); |
|
380 | - if ($acountdata->num_rows() > 0) { |
|
381 | - $acountdata = $acountdata->result_array(); |
|
382 | - $user_data = $acountdata[0]; |
|
383 | - $updateArr = array("pass_link_status" => 0); |
|
384 | - $this->db->where(array("email" => $email1)); |
|
385 | - $this->db->update("accounts", $updateArr); |
|
386 | - if ($user_data['pass_link_status'] == '0') { |
|
387 | - $user_data['success'] = $success; |
|
388 | - $data['user_data'] = $user_data; |
|
389 | - $this->active($user_data, $success); |
|
390 | - } else { |
|
391 | - $data['email'] = $_GET['email']; |
|
392 | - $this->load->view('view_confirmpassword', $data); |
|
393 | - } |
|
394 | - } |
|
395 | - } |
|
396 | - } |
|
397 | - |
|
398 | - function confirmpass() { |
|
399 | - $passwordconf = $_POST; |
|
400 | - $email1 = $this->encrypt->decode($passwordconf['email']); |
|
401 | - if (!empty($passwordconf)) { |
|
402 | - $acountdata = $this->db_model->getSelect("*", "accounts", array("email" => $email1)); |
|
403 | - //echo $this->db->last_query();exit; |
|
404 | - if ($acountdata->num_rows() > 0) { |
|
405 | - $acountdata = $acountdata->result_array(); |
|
406 | - $user_data = $acountdata[0]; |
|
407 | - } |
|
408 | - $user_data['password'] = $this->common->encode($passwordconf['password']); |
|
409 | - $updateArr = array("password" => $user_data['password']); |
|
410 | - $where_arr = array("email" => $email1, "status" => 0); |
|
411 | - $this->db->where($where_arr); |
|
412 | - $this->db->update("accounts", $updateArr); |
|
413 | - //$activation = $this->encrypt->encode($user_data['number']); |
|
414 | - $message = base_url(); |
|
415 | - $user_data['confirm'] = $message; |
|
416 | - $user_data['password'] = $passwordconf['password']; |
|
417 | - |
|
418 | - |
|
419 | - |
|
420 | - $system_config = common_model::$global_config['system_config']; |
|
421 | - $balance = $system_config["balance"]; |
|
422 | - |
|
423 | - $this->send_mail($user_data['id'], 'email_forgot_user', $user_data); |
|
424 | - |
|
425 | - $this->successpassword(); |
|
426 | - } |
|
427 | - } |
|
428 | - |
|
429 | - function send_mail($account_id, $temp_name, $user_data) { |
|
353 | + $email = $this->encrypt->encode($user_data['email']); |
|
354 | + $activation = $this->encrypt->encode($user_data['number']); |
|
355 | + $message = base_url() . 'confirm_pass?email=' . urlencode($email) . "&key=" . urlencode($activation); |
|
356 | + $user_data['confirm'] = $message; |
|
357 | + $where = array("email" => $user_data['email']); |
|
358 | + $data = array("pass_link_status" => 1); |
|
359 | + $this->db->where($where); |
|
360 | + $this->db->update('accounts', $data); |
|
361 | + $system_config = common_model::$global_config['system_config']; |
|
362 | + $balance = $system_config["balance"]; |
|
363 | + $this->send_mail($user_data['id'], 'email_forgot_confirmation', $user_data); |
|
364 | + $this->load->view('view_forgot_success'); |
|
365 | + } |
|
366 | + } else { |
|
367 | + redirect(base_url()); |
|
368 | + } |
|
369 | + } |
|
370 | + |
|
371 | + function confirm_pass() { |
|
372 | + $confirm_pass = $_GET; |
|
373 | + $accno = ''; |
|
374 | + $balance = ''; |
|
375 | + $email1 = $this->encrypt->decode($confirm_pass['email']); |
|
376 | + $success = $this->signup_model->check_user($accno, $email1, $balance); |
|
377 | + if (!empty($confirm_pass)) { |
|
378 | + $where_arr = array("email" => $email1, "status" => 0); |
|
379 | + $acountdata = $this->db_model->getSelect("*", "accounts", $where_arr); |
|
380 | + if ($acountdata->num_rows() > 0) { |
|
381 | + $acountdata = $acountdata->result_array(); |
|
382 | + $user_data = $acountdata[0]; |
|
383 | + $updateArr = array("pass_link_status" => 0); |
|
384 | + $this->db->where(array("email" => $email1)); |
|
385 | + $this->db->update("accounts", $updateArr); |
|
386 | + if ($user_data['pass_link_status'] == '0') { |
|
387 | + $user_data['success'] = $success; |
|
388 | + $data['user_data'] = $user_data; |
|
389 | + $this->active($user_data, $success); |
|
390 | + } else { |
|
391 | + $data['email'] = $_GET['email']; |
|
392 | + $this->load->view('view_confirmpassword', $data); |
|
393 | + } |
|
394 | + } |
|
395 | + } |
|
396 | + } |
|
397 | + |
|
398 | + function confirmpass() { |
|
399 | + $passwordconf = $_POST; |
|
400 | + $email1 = $this->encrypt->decode($passwordconf['email']); |
|
401 | + if (!empty($passwordconf)) { |
|
402 | + $acountdata = $this->db_model->getSelect("*", "accounts", array("email" => $email1)); |
|
403 | + //echo $this->db->last_query();exit; |
|
404 | + if ($acountdata->num_rows() > 0) { |
|
405 | + $acountdata = $acountdata->result_array(); |
|
406 | + $user_data = $acountdata[0]; |
|
407 | + } |
|
408 | + $user_data['password'] = $this->common->encode($passwordconf['password']); |
|
409 | + $updateArr = array("password" => $user_data['password']); |
|
410 | + $where_arr = array("email" => $email1, "status" => 0); |
|
411 | + $this->db->where($where_arr); |
|
412 | + $this->db->update("accounts", $updateArr); |
|
413 | + //$activation = $this->encrypt->encode($user_data['number']); |
|
414 | + $message = base_url(); |
|
415 | + $user_data['confirm'] = $message; |
|
416 | + $user_data['password'] = $passwordconf['password']; |
|
417 | + |
|
418 | + |
|
419 | + |
|
420 | + $system_config = common_model::$global_config['system_config']; |
|
421 | + $balance = $system_config["balance"]; |
|
422 | + |
|
423 | + $this->send_mail($user_data['id'], 'email_forgot_user', $user_data); |
|
424 | + |
|
425 | + $this->successpassword(); |
|
426 | + } |
|
427 | + } |
|
428 | + |
|
429 | + function send_mail($account_id, $temp_name, $user_data) { |
|
430 | 430 | |
431 | 431 | |
432 | - $system_config = common_model::$global_config['system_config']; |
|
433 | - //$screen_path = getcwd()."/cron"; |
|
434 | - //$screen_filename = "Email_Broadcast_".strtotime('now'); |
|
435 | - //$command = "cd ".$screen_path." && /usr/bin/screen -d -m -S $screen_filename php cron.php BroadcastEmail"; |
|
436 | - //exec($command); |
|
432 | + $system_config = common_model::$global_config['system_config']; |
|
433 | + //$screen_path = getcwd()."/cron"; |
|
434 | + //$screen_filename = "Email_Broadcast_".strtotime('now'); |
|
435 | + //$command = "cd ".$screen_path." && /usr/bin/screen -d -m -S $screen_filename php cron.php BroadcastEmail"; |
|
436 | + //exec($command); |
|
437 | 437 | |
438 | 438 | |
439 | 439 | |
440 | 440 | |
441 | - $where = array('name' => $temp_name); |
|
442 | - $EmailTemplate = $this->db_model->getSelect("*", "default_templates", $where); |
|
443 | - $reseller_id = ($user_data['reseller_id'] >0) ? $user_data['reseller_id'] : 1; |
|
444 | - $where="accountid IN ('".$reseller_id."','1')"; |
|
445 | - $this->db->where($where); |
|
446 | - $this->db->select('*'); |
|
447 | - $this->db->order_by('accountid', 'desc'); |
|
448 | - $this->db->limit(1); |
|
449 | - $invoiceconf = $this->db->get('invoice_conf'); |
|
450 | - $invoiceconf = (array)$invoiceconf->first_row(); |
|
451 | - $company_email = $invoiceconf['emailaddress']; |
|
452 | - $company_website = $invoiceconf["website"]; |
|
453 | - $company_name = $invoiceconf["company_name"]; |
|
441 | + $where = array('name' => $temp_name); |
|
442 | + $EmailTemplate = $this->db_model->getSelect("*", "default_templates", $where); |
|
443 | + $reseller_id = ($user_data['reseller_id'] >0) ? $user_data['reseller_id'] : 1; |
|
444 | + $where="accountid IN ('".$reseller_id."','1')"; |
|
445 | + $this->db->where($where); |
|
446 | + $this->db->select('*'); |
|
447 | + $this->db->order_by('accountid', 'desc'); |
|
448 | + $this->db->limit(1); |
|
449 | + $invoiceconf = $this->db->get('invoice_conf'); |
|
450 | + $invoiceconf = (array)$invoiceconf->first_row(); |
|
451 | + $company_email = $invoiceconf['emailaddress']; |
|
452 | + $company_website = $invoiceconf["website"]; |
|
453 | + $company_name = $invoiceconf["company_name"]; |
|
454 | 454 | |
455 | - $TemplateData = array(); |
|
455 | + $TemplateData = array(); |
|
456 | 456 | |
457 | 457 | |
458 | - foreach ($EmailTemplate->result_array() as $value) { |
|
459 | - $TemplateData = $value; |
|
460 | - $TemplateData['subject'] = str_replace('#NAME#', $user_data['first_name'] . " " . $user_data['last_name'], $TemplateData['subject']); |
|
461 | - $TemplateData['template'] = str_replace('#NAME#', $user_data['first_name'] . " " . $user_data['last_name'], $TemplateData['template']); |
|
462 | - $TemplateData['template'] = str_replace('#NUMBER#', $user_data['number'], $TemplateData['template']); |
|
463 | - $TemplateData['template'] = str_replace('#PASSWORD#', $user_data['password'], $TemplateData['template']); |
|
464 | - $TemplateData['template'] = str_replace('#COMPANY_WEBSITE#', $company_website, $TemplateData['template']); |
|
465 | - $TemplateData['template'] = str_replace('#LINK#', $user_data['confirm'], $TemplateData['template']); |
|
466 | - $TemplateData['template'] = str_replace('#COMPANY_EMAIL#', $company_email, $TemplateData['template']); |
|
467 | - $TemplateData['template'] = str_replace('#COMPANY_NAME#', $company_name, $TemplateData['template']); |
|
468 | - } |
|
469 | - $email_array = array('accountid' => $account_id, |
|
470 | - 'subject' => $TemplateData['subject'], |
|
471 | - 'body' => $TemplateData['template'], |
|
472 | - 'from' => $invoiceconf['emailaddress'], |
|
473 | - 'to' => $user_data['email'], |
|
474 | - 'status' => "1", |
|
475 | - //'attachment'=> $Filenm, |
|
476 | - 'template' => ''); |
|
477 | - //echo "<pre>"; print_r($TemplateData); exit; |
|
478 | - $this->db->insert("mail_details", $email_array); |
|
479 | - return true; |
|
480 | - } |
|
481 | - |
|
482 | - function successpassword() { |
|
483 | - $this->load->view('view_successpassword'); |
|
484 | - } |
|
458 | + foreach ($EmailTemplate->result_array() as $value) { |
|
459 | + $TemplateData = $value; |
|
460 | + $TemplateData['subject'] = str_replace('#NAME#', $user_data['first_name'] . " " . $user_data['last_name'], $TemplateData['subject']); |
|
461 | + $TemplateData['template'] = str_replace('#NAME#', $user_data['first_name'] . " " . $user_data['last_name'], $TemplateData['template']); |
|
462 | + $TemplateData['template'] = str_replace('#NUMBER#', $user_data['number'], $TemplateData['template']); |
|
463 | + $TemplateData['template'] = str_replace('#PASSWORD#', $user_data['password'], $TemplateData['template']); |
|
464 | + $TemplateData['template'] = str_replace('#COMPANY_WEBSITE#', $company_website, $TemplateData['template']); |
|
465 | + $TemplateData['template'] = str_replace('#LINK#', $user_data['confirm'], $TemplateData['template']); |
|
466 | + $TemplateData['template'] = str_replace('#COMPANY_EMAIL#', $company_email, $TemplateData['template']); |
|
467 | + $TemplateData['template'] = str_replace('#COMPANY_NAME#', $company_name, $TemplateData['template']); |
|
468 | + } |
|
469 | + $email_array = array('accountid' => $account_id, |
|
470 | + 'subject' => $TemplateData['subject'], |
|
471 | + 'body' => $TemplateData['template'], |
|
472 | + 'from' => $invoiceconf['emailaddress'], |
|
473 | + 'to' => $user_data['email'], |
|
474 | + 'status' => "1", |
|
475 | + //'attachment'=> $Filenm, |
|
476 | + 'template' => ''); |
|
477 | + //echo "<pre>"; print_r($TemplateData); exit; |
|
478 | + $this->db->insert("mail_details", $email_array); |
|
479 | + return true; |
|
480 | + } |
|
481 | + |
|
482 | + function successpassword() { |
|
483 | + $this->load->view('view_successpassword'); |
|
484 | + } |
|
485 | 485 | |
486 | 486 | } |
487 | 487 | ?> |
@@ -42,7 +42,7 @@ |
||
42 | 42 | <?php if (isset($astpp_notification)){ ?> |
43 | 43 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
44 | 44 | <?php }else{ |
45 | - echo " "; |
|
45 | + echo " "; |
|
46 | 46 | } ?> |
47 | 47 | </span> |
48 | 48 | </div> |
@@ -40,12 +40,12 @@ |
||
40 | 40 | <?php if (isset($astpp_notification)){ ?> |
41 | 41 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
42 | 42 | <?php }else{ |
43 | - echo " "; |
|
44 | - } |
|
43 | + echo " "; |
|
44 | + } |
|
45 | 45 | $astpp_err_msg = $this->session->flashdata('astpp_signupmsg'); |
46 | - if ($astpp_err_msg) { |
|
46 | + if ($astpp_err_msg) { |
|
47 | 47 | echo $astpp_err_msg; |
48 | - } |
|
48 | + } |
|
49 | 49 | ?> |
50 | 50 | </span></div> <br/> |
51 | 51 | <br/><br/><br/><br/> |
@@ -98,7 +98,7 @@ |
||
98 | 98 | <?php if (isset($astpp_notification)){ ?> |
99 | 99 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
100 | 100 | <?php }else{ |
101 | - echo " "; |
|
101 | + echo " "; |
|
102 | 102 | } ?> |
103 | 103 | </span> |
104 | 104 | </div> |
@@ -38,12 +38,12 @@ |
||
38 | 38 | <?php if (isset($astpp_notification)){ ?> |
39 | 39 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
40 | 40 | <?php }else{ |
41 | - echo " "; |
|
42 | - } |
|
41 | + echo " "; |
|
42 | + } |
|
43 | 43 | $astpp_err_msg = $this->session->flashdata('astpp_signupmsg'); |
44 | - if ($astpp_err_msg) { |
|
44 | + if ($astpp_err_msg) { |
|
45 | 45 | echo $astpp_err_msg; |
46 | - } |
|
46 | + } |
|
47 | 47 | ?> |
48 | 48 | </span></div> <br/> |
49 | 49 | <br/> |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | <?php if (isset($astpp_notification)){ ?> |
39 | 39 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
40 | 40 | <?php }else{ |
41 | - echo " "; |
|
42 | - } |
|
41 | + echo " "; |
|
42 | + } |
|
43 | 43 | $astpp_err_msg = $this->session->flashdata('astpp_signupmsg'); |
44 | - if ($astpp_err_msg) { |
|
44 | + if ($astpp_err_msg) { |
|
45 | 45 | echo $astpp_err_msg; |
46 | - } |
|
46 | + } |
|
47 | 47 | ?> |
48 | 48 | </span></div> <br/> |
49 | 49 | <br/> |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | { |
84 | 84 | echo "<div class=\"col-md-12 margin-t-10 margin-b-20 padding-r-32 padding-l-32\" style=\"color: #232222;\">Link is Expire Please Try Again</div><br>"; |
85 | 85 | echo ""; |
86 | - } |
|
86 | + } |
|
87 | 87 | ?> |
88 | 88 | |
89 | 89 |