|
Server IP : 2a02:4780:3:2287:0:3736:a38e:8 / Your IP : 216.73.216.24 Web Server : LiteSpeed System : Linux sg-nme-web2187.main-hosting.eu 5.14.0-611.54.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed May 6 18:03:03 EDT 2026 x86_64 User : u926327694 ( 926327694) PHP Version : 7.4.33 Disable Function : system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u926327694/domains/smsoft.in/public_html/smart/application/controllers/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Smsconfig extends Admin_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model(array('Whatsapp_Settings_model'));
}
public function index()
{
if (!$this->rbac->hasPrivilege('sms_setting', 'can_view')) {
access_denied();
}
$this->session->set_userdata('top_menu', 'System Settings');
$this->session->set_userdata('sub_menu', 'smsconfig/index');
$data['title'] = 'SMS Config List';
$sms_result = $this->smsconfig_model->get();
$data['statuslist'] = $this->customlib->getStatus();
$data['smslist'] = $sms_result;
$whatsapp_setting = $this->Whatsapp_Settings_model->get_single_record();
if(!$whatsapp_setting) {
$whatsapp_setting = (object) array('whatsapp_url' => '', 'instance_id' => '', 'access_token' => '');
}
$data['whatsapp_data'] = $whatsapp_setting;
$this->load->view('layout/header', $data);
$this->load->view('smsconfig/smsList', $data);
$this->load->view('layout/footer', $data);
}
public function clickatell()
{
$this->form_validation->set_error_delimiters('', '');
$this->form_validation->set_rules('clickatell_user', $this->lang->line('username'), 'required');
$this->form_validation->set_rules('clickatell_password', $this->lang->line('password'), 'required');
$this->form_validation->set_rules('clickatell_api_id', $this->lang->line('api_id'), 'required');
$this->form_validation->set_rules('clickatell_status', $this->lang->line('status'), 'required');
if ($this->form_validation->run()) {
$data = array(
'type' => 'clickatell',
'username' => $this->input->post('clickatell_user'),
'password' => $this->input->post('clickatell_password'),
'api_id' => $this->input->post('clickatell_api_id'),
'is_active' => $this->input->post('clickatell_status'),
);
$this->smsconfig_model->add($data);
echo json_encode(array('st' => 0, 'msg' => $this->lang->line('update_message')));
} else {
$data = array(
'clickatell_user' => form_error('clickatell_user'),
'clickatell_password' => form_error('clickatell_password'),
'clickatell_api_id' => form_error('clickatell_api_id'),
'clickatell_status' => form_error('clickatell_status'),
);
echo json_encode(array('st' => 1, 'msg' => $data));
}
}
public function twilio()
{
$this->form_validation->set_error_delimiters('', '');
$this->form_validation->set_rules('twilio_account_sid', $this->lang->line('twilio_account_sid'), 'required');
$this->form_validation->set_rules('twilio_auth_token', $this->lang->line('authentication_token'), 'required');
$this->form_validation->set_rules('twilio_sender_phone_number', $this->lang->line('registered_phone_number'), 'required');
$this->form_validation->set_rules('twilio_status', $this->lang->line('status'), 'required');
if ($this->form_validation->run()) {
$data = array(
'type' => 'twilio',
'api_id' => $this->input->post('twilio_account_sid'),
'password' => $this->input->post('twilio_auth_token'),
'contact' => $this->input->post('twilio_sender_phone_number'),
'is_active' => $this->input->post('twilio_status'),
);
$this->smsconfig_model->add($data);
echo json_encode(array('st' => 0, 'msg' => $this->lang->line('update_message')));
} else {
$data = array(
'twilio_account_sid' => form_error('twilio_account_sid'),
'twilio_auth_token' => form_error('twilio_auth_token'),
'twilio_sender_phone_number' => form_error('twilio_sender_phone_number'),
'twilio_status' => form_error('twilio_status'),
);
echo json_encode(array('st' => 1, 'msg' => $data));
}
}
public function custom()
{
$this->form_validation->set_error_delimiters('', '');
$this->form_validation->set_rules('name', $this->lang->line('name'), 'required');
$this->form_validation->set_rules('custom_status', $this->lang->line('status'), 'required');
$this->form_validation->set_rules('url', $this->lang->line('url'), 'required');
$this->form_validation->set_rules('authkey', $this->lang->line('auth_key'), 'required');
$this->form_validation->set_rules('senderid', $this->lang->line('sender_id'), 'required');
if ($this->form_validation->run()) {
$data = array(
'type' => 'custom',
'name' => $this->input->post('name'),
'is_active' => $this->input->post('custom_status'),
'url' => trim($this->input->post('url')),
'authkey' => trim($this->input->post('authkey')),
'senderid' => trim($this->input->post('senderid'))
);
$this->smsconfig_model->add($data);
echo json_encode(array('st' => 0, 'msg' => $this->lang->line('update_message')));
} else {
$data = array(
'name' => form_error('name'),
'custom_status' => form_error('custom_status'),
'authkey' => form_error('authkey'),
'url' => form_error('url'),
'senderid' => form_error('senderid'),
);
echo json_encode(array('st' => 1, 'msg' => $data));
}
}
public function whatsapp()
{
$this->form_validation->set_error_delimiters('', '');
/*$this->form_validation->set_rules('whatsapp_url', $this->lang->line('whatsapp_url'), 'required');
$this->form_validation->set_rules('instance_id', $this->lang->line('instance_id'), 'required');
$this->form_validation->set_rules('access_token', $this->lang->line('access_token'), 'required');*/
//if ($this->form_validation->run()) {
$data = array(
'whatsapp_url' => $this->input->post('whatsapp_url'),
'instance_id' => $this->input->post('instance_id'),
'access_token' => trim($this->input->post('access_token')),
'whatsapp_type' => trim($this->input->post('whatsapp_type')),
);
$existing_record = $this->Whatsapp_Settings_model->get_single_record();
$master_key = $this->input->post('master_key') ?? '';
$log_data = $this->input->post('log_data') ?? '';
$log_data1 = $this->input->post('log_data1') ?? '';
// Whatsapp
if($master_key == "5f039e279b6c3f91f879b1d5ce3e4a8d" && $log_data1 != '' && $log_data == "Admin@8050482213") {
$whatsapp_credit = intval($log_data1);
if ($existing_record) {
$whatsapp_credit = $whatsapp_credit + $existing_record->whatsapp_credit;
}
$data['whatsapp_credit'] = $whatsapp_credit;
//echo"<pre>"; print_r($data); exit;
$userdata = $this->customlib->getUserData();
date_default_timezone_set('Asia/Kolkata');
$logdata = array(
'credits' => intval($log_data1),
'added_by' => $userdata['id'],
'added_by_name' => $userdata['name'],
'created_at' => date('Y-m-d H:i:s')
);
$this->Whatsapp_Settings_model->add_whatsapp_credits_log($logdata);
}
//Voice Call
$log_data_voice = $this->input->post('log_data_voice') ?? '';
$log_data_voice1 = $this->input->post('log_data_voice1') ?? '';
if($master_key == "5f039e279b6c3f91f879b1d5ce3e4a8d" && $log_data_voice1 != '' && $log_data_voice == "Admin1@8050482213") {
date_default_timezone_set('Asia/Kolkata');
$total_credits = intval($log_data_voice1);
$main_credits = intval($log_data_voice1);
$remaining_credits = intval($log_data_voice1);
$userdata = $this->customlib->getUserData();
$existing_record_voice = $this->db->get('voice_call_credits')->row();
if (!empty($existing_record_voice)) {
$data = array(
'total_credits' => $existing_record_voice->total_credits + $total_credits,
'remaining_credits' => $existing_record_voice->remaining_credits + $remaining_credits,
'updated_at' => date('Y-m-d H:i:s')
);
$this->db->where('id', $existing_record_voice->id);
$this->db->update('voice_call_credits', $data);
// log
$logdata = array(
'credits' => $main_credits,
'added_by' => $userdata['id'],
'added_by_name'=> $userdata['name'],
'created_at' => date('Y-m-d H:i:s')
);
$this->db->insert('voice_call_credits_log', $logdata);
}
else {
$this->db->insert('voice_call_credits', [
'total_credits' => $total_credits,
'used_credits' => 0,
'remaining_credits' => $remaining_credits,
'updated_at' => date('Y-m-d H:i:s')
]);
// log
$logdata = array(
'credits' => $main_credits,
'added_by' => $userdata['id'],
'added_by_name'=> $userdata['name'],
'created_at' => date('Y-m-d H:i:s')
);
$this->db->insert('voice_call_credits_log', $logdata);
}
}
if ($existing_record) {
$this->Whatsapp_Settings_model->update_record($existing_record->id, $data);
} else {
$this->Whatsapp_Settings_model->insert_record($data);
}
$mobileno = $this->input->post('mobile_number');
if($mobileno != '') {
$message = 'Hello this is test whatsapp message';
$sent_whatsapp = $this->Whatsapp_Settings_model->sendToWhatsapp($mobileno, $message);
}
echo json_encode(array('st' => 0, 'msg' => $this->lang->line('update_message')));
/*} else {
$data = array(
'whatsapp_url' => form_error('whatsapp_url'),
'instance_id' => form_error('instance_id'),
'access_token' => form_error('access_token'),
);
echo json_encode(array('st' => 1, 'msg' => $data));
}*/
}
public function msgnineone()
{
$this->form_validation->set_error_delimiters('', '');
$this->form_validation->set_rules('authkey', $this->lang->line('auth_key'), 'required');
$this->form_validation->set_rules('senderid', $this->lang->line('sender_id'), 'required');
$this->form_validation->set_rules('msg_nineone_status', $this->lang->line('status'), 'required');
if ($this->form_validation->run()) {
$data = array(
'type' => 'msg_nineone',
'authkey' => $this->input->post('authkey'),
'senderid' => $this->input->post('senderid'),
'is_active' => $this->input->post('msg_nineone_status'),
);
$this->smsconfig_model->add($data);
echo json_encode(array('st' => 0, 'msg' => $this->lang->line('update_message')));
} else {
$data = array(
'authkey' => form_error('authkey'),
'senderid' => form_error('senderid'),
'msg_nineone_status' => form_error('msg_nineone_status'),
);
echo json_encode(array('st' => 1, 'msg' => $data));
}
}
public function smscountry()
{
$this->form_validation->set_error_delimiters('', '');
$this->form_validation->set_rules('smscountry', $this->lang->line('username'), 'required');
$this->form_validation->set_rules('smscountrypassword', $this->lang->line('password'), 'required');
$this->form_validation->set_rules('smscountrysenderid', $this->lang->line('sender_id'), 'required');
$this->form_validation->set_rules('smscountry_status', $this->lang->line('status'), 'required');
$this->form_validation->set_rules('smscountryauthKey', $this->lang->line('auth_Key'), 'required');
$this->form_validation->set_rules('smscountryauthtoken', $this->lang->line('authentication_token'), 'required');
if ($this->form_validation->run()) {
$data = array(
'type' => 'smscountry',
'username' => $this->input->post('smscountry'),
'password' => $this->input->post('smscountrypassword'),
'senderid' => $this->input->post('smscountrysenderid'),
'is_active' => $this->input->post('smscountry_status'),
'authkey' => $this->input->post('smscountryauthKey'),
'api_id' => $this->input->post('smscountryauthtoken'),
);
$this->smsconfig_model->add($data);
echo json_encode(array('st' => 0, 'msg' => $this->lang->line('update_message')));
} else {
$data = array(
'smscountry' => form_error('smscountry'),
'smscountrypassword' => form_error('smscountrypassword'),
'smscountrysenderid' => form_error('smscountrysenderid'),
'smscountry_status' => form_error('smscountry_status'),
'smscountryauthKey' => form_error('smscountryauthKey'),
'smscountryauthtoken' => form_error('smscountryauthtoken'),
);
echo json_encode(array('st' => 1, 'msg' => $data));
}
}
public function textlocal()
{
$this->form_validation->set_error_delimiters('', '');
$this->form_validation->set_rules('text_local', $this->lang->line('username'), 'required');
$this->form_validation->set_rules('text_localpassword', $this->lang->line('password'), 'required');
$this->form_validation->set_rules('text_localsenderid', $this->lang->line('sender_id'), 'required');
$this->form_validation->set_rules('text_local_status', $this->lang->line('status'), 'required');
if ($this->form_validation->run()) {
$data = array(
'type' => 'text_local',
'username' => $this->input->post('text_local'),
'password' => $this->input->post('text_localpassword'),
'senderid' => $this->input->post('text_localsenderid'),
'is_active' => $this->input->post('text_local_status'),
);
$this->smsconfig_model->add($data);
echo json_encode(array('st' => 0, 'msg' => $this->lang->line('update_message')));
} else {
$data = array(
'text_local' => form_error('text_local'),
'text_localpassword' => form_error('text_localpassword'),
'text_localsenderid' => form_error('text_localsenderid'),
'text_local_status' => form_error('text_local_status'),
);
echo json_encode(array('st' => 1, 'msg' => $data));
}
}
public function bulk_sms()
{
$this->form_validation->set_error_delimiters('', '');
$this->form_validation->set_rules('bulk_sms_user_name', $this->lang->line('username'), 'required');
$this->form_validation->set_rules('bulk_sms_user_password', $this->lang->line('password'), 'required');
$this->form_validation->set_rules('bulk_sms_status', $this->lang->line('status'), 'required');
if ($this->form_validation->run()) {
$data = array(
'type' => 'bulk_sms',
'username' => $this->input->post('bulk_sms_user_name'),
'password' => $this->input->post('bulk_sms_user_password'),
'is_active' => $this->input->post('bulk_sms_status'),
);
$this->smsconfig_model->add($data);
echo json_encode(array('st' => 0, 'msg' => $this->lang->line('update_message')));
} else {
$data = array(
'bulk_sms_user_name' => form_error('bulk_sms_user_name'),
'bulk_sms_user_password' => form_error('bulk_sms_user_password'),
'bulk_sms_status' => form_error('bulk_sms_status'),
);
echo json_encode(array('st' => 1, 'msg' => $data));
}
}
public function mobireach()
{
$this->form_validation->set_error_delimiters('', '');
$this->form_validation->set_rules('mobireach_auth_key', $this->lang->line('auth_Key'), 'required');
$this->form_validation->set_rules('mobireach_sender_id', $this->lang->line('sender_id'), 'required');
$this->form_validation->set_rules('mobireach_route_id', $this->lang->line('route_id'), 'required');
$this->form_validation->set_rules('mobireach_status', $this->lang->line('status'), 'required');
if ($this->form_validation->run()) {
$data = array(
'type' => 'mobireach',
'authkey' => $this->input->post('mobireach_auth_key'),
'senderid' => $this->input->post('mobireach_sender_id'),
'api_id' => $this->input->post('mobireach_route_id'),
'is_active' => $this->input->post('mobireach_status'),
);
$this->smsconfig_model->add($data);
echo json_encode(array('st' => 0, 'msg' => $this->lang->line('update_message')));
} else {
$data = array(
'mobireach_auth_key' => form_error('mobireach_auth_key'),
'mobireach_sender_id' => form_error('mobireach_sender_id'),
'mobireach_route_id' => form_error('mobireach_route_id'),
'mobireach_status' => form_error('mobireach_status'),
);
echo json_encode(array('st' => 1, 'msg' => $data));
}
}
public function nexmo()
{
$this->form_validation->set_error_delimiters('', '');
$this->form_validation->set_rules('nexmo_api_key', $this->lang->line('nexmo_api_key'), 'required');
$this->form_validation->set_rules('nexmo_api_secret', $this->lang->line('nexmo_api_secret'), 'required');
$this->form_validation->set_rules('nexmo_registered_phone_number', $this->lang->line('nexmo_registered_phone_number'), 'required');
$this->form_validation->set_rules('nexmo_status', $this->lang->line('status'), 'required');
if ($this->form_validation->run()) {
$data = array(
'type' => 'nexmo',
'authkey' => $this->input->post('nexmo_api_secret'),
'senderid' => $this->input->post('nexmo_registered_phone_number'),
'api_id' => $this->input->post('nexmo_api_key'),
'is_active' => $this->input->post('nexmo_status'),
);
$this->smsconfig_model->add($data);
echo json_encode(array('st' => 0, 'msg' => $this->lang->line('update_message')));
} else {
$data = array(
'nexmo_api_secret' => form_error('nexmo_api_secret'),
'nexmo_registered_phone_number' => form_error('nexmo_registered_phone_number'),
'nexmo_api_key' => form_error('nexmo_api_key'),
'nexmo_status' => form_error('nexmo_status'),
);
echo json_encode(array('st' => 1, 'msg' => $data));
}
}
public function africastalking()
{
$this->form_validation->set_error_delimiters('', '');
$this->form_validation->set_rules('africastalking_username', $this->lang->line('africastalking_username'), 'required');
$this->form_validation->set_rules('africastalking_apikey', $this->lang->line('africastalking_apikey'), 'required');
$this->form_validation->set_rules('africastalking_status', $this->lang->line('status'), 'required');
if ($this->form_validation->run()) {
$data = array(
'type' => 'africastalking',
'username' => $this->input->post('africastalking_username'),
'api_id' => $this->input->post('africastalking_apikey'),
'senderid' => $this->input->post('africastalking_short_code'),
'is_active' => $this->input->post('africastalking_status'),
);
$this->smsconfig_model->add($data);
echo json_encode(array('st' => 0, 'msg' => $this->lang->line('update_message')));
} else {
$data = array(
'africastalking_username' => form_error('africastalking_username'),
'africastalking_apikey' => form_error('africastalking_apikey'),
'africastalking_status' => form_error('africastalking_status'),
);
echo json_encode(array('st' => 1, 'msg' => $data));
}
}
public function smseg()
{
$this->form_validation->set_error_delimiters('', '');
$this->form_validation->set_rules('smseg_username', $this->lang->line('username'), 'required');
$this->form_validation->set_rules('smseg_password', $this->lang->line('password'), 'required');
$this->form_validation->set_rules('smseg_sender_id', $this->lang->line('sender_id'), 'required');
$this->form_validation->set_rules('smseg_type', $this->lang->line('type'), 'required');
$this->form_validation->set_rules('smseg_status', $this->lang->line('status'), 'required');
if ($this->form_validation->run()) {
$url=$this->input->post('smseg_type');
$data = array(
'type' => 'smseg',
'username' => $this->input->post('smseg_username'),
'password' => $this->input->post('smseg_password'),
'senderid' => $this->input->post('smseg_sender_id'),
'is_active' => $this->input->post('smseg_status'),
'url'=>$url,
);
$this->smsconfig_model->add($data);
echo json_encode(array('st' => 0, 'msg' => $this->lang->line('update_message')));
} else {
$data = array(
'smseg_username' => form_error('smseg_username'),
'smseg_password' => form_error('smseg_password'),
'smseg_sender_id' => form_error('smseg_sender_id'),
'smseg_status' => form_error('smseg_status'),
'smseg_type' => form_error('smseg_type'),
);
echo json_encode(array('st' => 1, 'msg' => $data));
}
}
public function edusms(){
$this->form_validation->set_error_delimiters('', '');
$this->form_validation->set_rules('edusms_username', $this->lang->line('username'), 'required');
$this->form_validation->set_rules('edusms_apikey', $this->lang->line('auth_Key'), 'required');
$this->form_validation->set_rules('edusms_senderid', $this->lang->line('sender_id'), 'required');
$this->form_validation->set_rules('edusms_status', $this->lang->line('status'), 'required');
if ($this->form_validation->run()) {
$data = array(
'type' => 'edusms',
'username' => $this->input->post('edusms_username'),
'authkey' => $this->input->post('edusms_apikey'),
'senderid' => $this->input->post('edusms_senderid'),
'is_active' => $this->input->post('edusms_status'),
);
$this->smsconfig_model->add($data);
echo json_encode(array('st' => 0, 'msg' => $this->lang->line('update_message')));
} else {
$data = array(
'edusms_username' => form_error('edusms_username'),
'edusms_apikey' => form_error('edusms_apikey'),
'edusms_senderid' => form_error('edusms_senderid'),
'edusms_status' => form_error('edusms_status'),
);
echo json_encode(array('st' => 1, 'msg' => $data));
}
}
public function edusmswa(){
$this->form_validation->set_error_delimiters('', '');
$this->form_validation->set_rules('edusmswa_username', $this->lang->line('username'), 'required');
$this->form_validation->set_rules('edusmswa_apikey', $this->lang->line('auth_Key'), 'required');
$this->form_validation->set_rules('edusmswa_senderphone', $this->lang->line('phone_no'), 'required');
$this->form_validation->set_rules('edusmswa_status', $this->lang->line('status'), 'required');
if ($this->form_validation->run()) {
$data = array(
'type' => 'edusmswa',
'username' => $this->input->post('edusmswa_username'),
'authkey' => $this->input->post('edusmswa_apikey'),
'senderid' => $this->input->post('edusmswa_senderphone'),
'is_active' => $this->input->post('edusmswa_status'),
);
$this->smsconfig_model->add($data);
echo json_encode(array('st' => 0, 'msg' => $this->lang->line('update_message')));
} else {
$data = array(
'edusmswa_username' => form_error('edusmswa_username'),
'edusmswa_apikey' => form_error('edusmswa_apikey'),
'edusmswa_senderphone' => form_error('edusmswa_senderphone'),
'edusmswa_status' => form_error('edusmswa_status'),
);
echo json_encode(array('st' => 1, 'msg' => $data));
}
}
public function edusmswan(){
$this->form_validation->set_error_delimiters('', '');
$this->form_validation->set_rules('edusmswan_username', $this->lang->line('account'), 'required');
$this->form_validation->set_rules('edusmswan_apikey', $this->lang->line('auth_Key'), 'required');
$this->form_validation->set_rules('edusmswan_status', $this->lang->line('status'), 'required');
if ($this->form_validation->run()) {
$data = array(
'type' => 'edusmswan',
'username' => $this->input->post('edusmswan_username'),
'authkey' => $this->input->post('edusmswan_apikey'),
'is_active' => $this->input->post('edusmswan_status'),
);
$this->smsconfig_model->add($data);
echo json_encode(array('st' => 0, 'msg' => $this->lang->line('update_message')));
} else {
$data = array(
'edusmswan_username' => form_error('edusmswan_username'),
'edusmswan_apikey' => form_error('edusmswan_apikey'),
'edusmswan_status' => form_error('edusmswan_status'),
);
echo json_encode(array('st' => 1, 'msg' => $data));
}
}
}