Ejemplo n.º 1
0
        $handle = fopen($filename, "r");
        //boolean used to track success of upload, returns true if all records uploaded successfully, false otherwise
        $successBool = true;
        while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
            $successBool = $successBool && uploadContactsInfo($mysqli, $data);
        }
        fclose($handle);
        if ($successBool) {
            //we notify user of successful upload of CSV file
            createNotif("success", $fname . ' successfully imported');
        } else {
            //we notify user of unsuccessful upload
            createNotif("warning", "Upload unsuccessful. Please see error messages");
        }
    } else {
        createNotif("warning", "Invalid filetype. Please only upload CSV files");
    }
}
// close connection
closeConnection($mysqli);
?>
		
		
			<form action="index.php?contacts&menu=upload_contacts" method="post" enctype="multipart/form-data">

				<input type="file" name="fileToUpload" id="fileToUpload">
				<input class="custom-btn btn btn-primary" type="submit" value="Upload" name="submit">
				
			</form>

Ejemplo n.º 2
0
            $json_result = json_decode($api_result, true);
            //we log the SMS as an outbound message in the database
            $outbound_data = array('api_ref_id' => $json_result['bulkId'], 'title' => $_POST['campaign_title'], 'from' => $_POST['send_as_name'], 'to' => implode(', ', $api_fields['to']), 'text' => $_POST['sms_text'], 'status' => $json_result['messages'][0]['status']['groupName'], 'credits_used' => $num_msg * countRecipients($_POST['send_to_numbers']));
            //open mysql database connection
            $mysqli = openConnection();
            //enter details of outbound msg into outbound table and deduct appropriate user credits
            uploadOutboundInfo($mysqli, $outbound_data);
            subtractUserCredits($mysqli, $outbound_data['credits_used']);
            // close connection
            closeConnection($mysqli);
            createNotif("success", "SMS successfully sent");
        } else {
            createNotif("warning", "Maximum number of characters exceeded");
        }
    } else {
        createNotif("warning", "Send To field is invalid. Please try again");
    }
}
?>
			
			<form action="index.php?SMS&menu=send_sms" method="post" enctype="multipart/form-data">
		
				<div class="form-group">	
					<label>Send To </label>					
					<div class="input-group">
						<div class="input-group-btn">
							<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Select Input <span class="caret"></span></button>
							<ul class="dropdown-menu send_to_options">
							  <li><a href="#">Enter Number(s) </a></li>
							  <li><a href="#">Upload CSV </a></li>
							  <li><a href="#">Choose from Contacts </a></li>
Ejemplo n.º 3
0
if (isset($_POST['remove_keyword'])) {
    //open mysql database connection
    $mysqli = openConnection();
    //boolean used to track success of deletion, returns true if all records deleted successfully, false otherwise
    $successBool = true;
    //we take contact_ids in the array and delete those records from the contacts table
    foreach ($_POST['checkbox'] as $keyword_id) {
        $successBool = $successBool && removeKeyword($mysqli, $keyword_id);
    }
    //notification after removal operation
    if ($successBool) {
        //we notify user of successful deletion
        createNotif("success", "Selected keywords successfully removed");
    } else {
        //we notify user of unsuccessful deletion
        createNotif("warning", "Removal unsuccessful. Please see error messages");
    }
    // close connection
    closeConnection($mysqli);
}
//open mysql database connection
$mysqli = openConnection();
//get the list of keywords and print them to html list
displayKeywords($mysqli, true);
// close connection
closeConnection($mysqli);
?>
					 
					</tbody>
				</table>
			</div>