$price = (int) ($data['price'] * (100 - $data['discount']) / 100); if ($data['PAYMENT_AMOUNT'] == $price) { $statusPayment = 1; } else { $statusPayment = 3; } if (count($check) == 0) { $datetime = time(); $expiration = $check['date_expiration']; $expiration = $datetime + ((int) $data['songay'] + 1) * 24 * 60 * 60; $pass = '******'; $status = 1; $group_id = 1; $model->_updatePayment($data['PAYMENT_ID'], $statusPayment); if ($statusPayment == 1) { $model->_insertUserAccount($data['name'], $data['email'], $pass, $expiration, $datetime, $status, $group_id); } else { echo '<p class="error">Not find the payment</p>'; return false; } } else { $expiration = $check['date_expiration']; $expiration = $expiration + ((int) $data['songay'] + 1) * 24 * 60 * 60; $model->_updatePayment($data['PAYMENT_ID'], $statusPayment); if ($statusPayment == 1) { $model->_updateUserExpiration($data['email'], $expiration); } else { echo '<p class="error">Not find the payment</p>'; return false; } }