HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: //var/www/html/qcr24/app/application/helpers/otp_helper.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	
	/*function sendsms($otp,$phoneno){
        $error = '';
        $data = array();
        $ch = curl_init(); 
        $baseurl = 'http://dndopen.jhaveritechno.com/api/v4/?api_key=Acbb9b01166125066737f7170c4f573d3';
        $message = "OTP for Login Transaction on SYSCENTRIC is ".$otp.". Do not share this OTP to anyone for security reasons.";
        $url = $baseurl.'&method=sms&message='.$message.'&to='.$phoneno.'&sender=SYSCNT&entity_id=1301163999688234159&template_id=1507165971342532874';
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        $result = curl_exec($ch);
        if (curl_errno($ch)) {
            $error = 'Error:' . curl_error($ch);
        }
        curl_close($ch);
        $data['error'] = $error;
        $data['response'] = json_decode($result);
        //echo "<pre>"; print_r($data);
        return $data;
    }

	function generateotp($phone){
        $data = array();
        $otp = random_int(100000, 999999);
        $data= sendsms($otp,$phone);
        $data['otp'] = $otp;
        return $data;
    }*/
	
	function generateotp($phone, $type)
	{
        $data = array();
        $otp = random_int(100000, 999999);
        $data= sendsms($otp, $phone, $type);
        $data['otp'] = $otp;
        return $data;
    }

	function sendsms($otp, $phoneno, $type)
	{
        $error = '';
        $data = array();
        $ch = curl_init(); 
        $baseurl = 'https://2factor.in/API/R1/';
		
		$message = '';
		
		switch ($type) {
			case 'login':
				$message = "Your OTP for login to www.prdtourism.in is " . $otp . " .This OTP is valid for 60 seconds. Please do not share this OTP with others. -PRD Department";
				break;
				
			case 'register':
				$message = "Your OTP for signup with www.prdtourism.in is " . $otp . " . This OTP is valid for 60 seconds. Please do not share this OTP with others. -PRD Department";
				break;
		}
        
        $postfields = 'module=TRANS_SMS&apikey=7724f759-3a60-11ed-9c12-0200cd936042&to=' . $phoneno . '&from=WBPNRD&msg=' . $message;
        curl_setopt($ch, CURLOPT_URL, $baseurl);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
        $result = curl_exec($ch);
        if (curl_errno($ch)) {
            $error = 'Error:' . curl_error($ch);
        }
        curl_close($ch);
        $data['error'] = $error;
        $data['response'] = json_decode($result);
        //echo "<pre>"; print_r($data);
        return $data;
    }
?>