コード例 #1
0
ファイル: functions_bkp.php プロジェクト: AbrahamOdoi/zoom
function sendsomesms($destination, $sender, $msgs, $counter, $user_sess, $sms_count)
{
    $con = mysqli_connect("localhost", "root", "", "dlr");
    //connection
    // $con=mysqli_connect("localhost","root","","dlr"); //connection
    $count = 0;
    while ($count < $counter) {
        $number = $destination[$count];
        $msisdn = preg_replace('/\\D/', '', $number);
        $msisdn = msisdn_prep($msisdn);
        //put msisdn in proper format
        $network = which_network($msisdn);
        $id = uniqid('NS', true);
        return $sql = "INSERT INTO logs(id, username, msisdn, sender, sms_count, network, message, status) VALUES ('{$id}', '{$user_sess}', '{$msisdn}', '{$sender}','{$sms_count}','{$network}','{$msgs}','ack')";
        mysqli_query($con, $sql);
        // $msgs = urlencode($msgs);
        // $url = "http://168.144.175.52:13013/cgi-bin/sendsms?username=tester&password=foobar&to=" . $msisdn . "&from=" . $sender . "&text=" . $msgs . "&smsc=buzismsc1&dlr-mask=31";
        // $url = "http://5.231.54.137:13013/cgi-bin/sendsms?username=tester&password=foobar&to=" . $msisdn . "&from=" . $sender . "&text=" . $msgs . "&smsc=buzismsc1&dlr-mask=31";
        // $urloutput = file_get_contents($url);
        $count++;
    }
    $rem_start_point = $count;
    $rem_array = array_slice($destination, $rem_start_point);
    $no_rem = count($rem_array);
    $msisdn_string = implode($rem_array, ',');
    $sql2 = "INSERT INTO q_msgs (username, msisdn, sender, msg, sms_count, status ) \n\t\t\t\tVALUES ('{$user_sess}', '{$msisdn_string}', '{$sender}', '{$msgs}', '{$sms_count}','pending' )";
    if (mysqli_query($con, $sql2)) {
        // return $no_rem;
    }
}
コード例 #2
0
ファイル: index_x.php プロジェクト: AbrahamOdoi/vendor
     $new_bal = $curr_bal - $tot_cost + $rejected_cost;
     //new balance
     $q2 = "UPDATE credit SET new_bal = '{$new_bal}' WHERE username = '******'";
     //updates the new balance
     mysqli_query($con, $q2);
     $new_credit_used = $credit_used + $tot_cost;
     mysqli_query($con, "UPDATE credit SET credit_used = '{$new_credit_used}' WHERE username = '******'");
     //updates credit used
     $logged = $nummsisdn - $no_rej_msisdn;
 } else {
     $count = 0;
     $job_id = $user_sess . date('YmdHis');
     while ($count < $counter) {
         $number = $destination[$count];
         $msisdn = preg_replace('/\\D/', '', $number);
         $msisdn = msisdn_prep($msisdn);
         //put msisdn in proper format
         if (is_numeric($msisdn)) {
             if (substr($msisdn, 0, 1) == '1') {
                 $code = substr($msisdn, 0, 1);
                 $ccLength = strlen($code);
             } elseif (substr($msisdn, 0, 2) == '44') {
                 $code = substr($msisdn, 0, 2);
                 $ccLength = strlen($code);
             } else {
                 $code = substr($msisdn, 0, 3);
                 $ccLength = strlen($code);
             }
             $network = which_network($msisdn);
             $id = uniqid('NS', true);
             checkCode($code);