|
<?php session_start(); ?> |
|
<?php |
|
$txtEmployeeName = isset($_POST["txtEmployeeName"])? trim($_POST["txtEmployeeName"]):""; |
|
$txtEmployeeEmail = isset($_POST["txtEmployeeEmail"])? trim($_POST["txtEmployeeEmail"]):""; |
|
$txtEmployeeID = isset($_POST["txtEmployeeID"])? trim($_POST["txtEmployeeID"]):""; |
|
$txtGeneralNotes = isset($_POST["txtGeneralNotes"])? trim($_POST["txtGeneralNotes"]):""; |
|
if (strlen ($txtEmployeeName) > 0 && |
|
strlen ($txtEmployeeEmail) > 0 && |
|
strlen ($txtEmployeeID) > 0) |
|
{ |
|
$userfiles = array (); |
|
|
|
if (isset($_FILES["filTimesheet"])) |
|
{ |
|
foreach ($_FILES['filTimesheet']['name'] as $i => $name) |
|
{ |
|
if ($_FILES['filTimesheet']['error'][$i] == 4) { |
|
continue; |
|
} |
|
|
|
$newfilename = $txtEmployeeID ."_" . $txtEmployeeName ."_".$name; |
|
|
|
move_uploaded_file ($_FILES['filTimesheet']['tmp_name'][$i],"./faxtmp/".$newfilename); |
|
|
|
array_push ($userfiles, realpath ("./faxtmp/".$newfilename)); |
|
} |
|
} |
|
|
|
|
|
$username = 'YOUR_INTERFAX_USER_NAME'; |
|
$password = 'YOUR_INTERFAX_PASSWORD'; |
|
$faxnumbers = ' YOUR_FAX_NUMBER'; |
|
$contacts = 'A_NAME_FOR_FAX_NUMBER'; |
|
$files = $userfiles; |
|
|
|
$postponetime = '2001-12-31T00:00:00-00:00'; |
|
$retries = '3'; |
|
$csid = 'AA CSID'; |
|
$pageheader = 'To: {To} From: {From} Pages: {TotalPages}'; |
|
$subject = 'Fax'; |
|
$replyemail = ''; |
|
$page_size = 'A4'; |
|
$page_orientation = 'Portrait'; |
|
$high_resolution = FALSE; |
|
$fine_rendering = TRUE; |
|
|
|
$filetypes = ''; |
|
$data = ''; |
|
$filesizes = ''; |
|
|
|
// Open files and determine file types from extension |
|
foreach ($files as $filename){ |
|
$filetype_exploded_array = explode('.', $filename); |
|
$filetype = $filetype_exploded_array[count($filetype_exploded_array) - 1]; |
|
$filetypes .= $filetype . ';'; |
|
|
|
if(!($fp = fopen($filename, "r"))){ |
|
// Error opening file |
|
// Handle error however appropriate for your script |
|
echo "Error opening file"; |
|
exit; |
|
} |
|
|
|
// Read data from the file into $data |
|
$filedata = ""; |
|
while (!feof($fp)) $filedata .= fread($fp,1024); |
|
$filesizes .= strlen($filedata) . ';'; |
|
$data .= $filedata; |
|
fclose($fp); |
|
} |
|
$filetypes = trim($filetypes, ';'); |
|
$filesizes = trim($filesizes, ';'); |
|
|
|
// Call WS method |
|
$client = new SoapClient("http://ws.interfax.net/dfs.asmx?wsdl"); |
|
|
|
error_reporting(E_ERROR | E_PARSE); |
|
|
|
|
|
$params->Username = $username; |
|
$params->Password = $password; |
|
$params->FaxNumbers = $faxnumbers; |
|
$params->Contacts = $contacts; |
|
$params->FilesData = $data; |
|
$params->FileTypes = $filetypes; |
|
$params->FileSizes = $filesizes; |
|
$params->Postpone = $postponetime; |
|
$params->RetriesToPerform = $retries; |
|
$params->CSID = $csid; |
|
$params->PageHeader = $pageheader; |
|
$params->JobID = ''; |
|
$params->Subject = $subject; |
|
$params->ReplyAddress = $replyemail; |
|
$params->PageSize = $page_size; |
|
$params->PageOrientation = $page_orientation; |
|
$params->IsHighResolution = $high_resolution; |
|
$params->IsFineRendering = $fine_rendering; |
|
|
|
$result = $client->SendfaxEx_2($params); |
|
|
|
$faxfail = false; |
|
|
|
if ($result < 0) |
|
$faxfail = true; |
|
|
|
|
|
|
|
} |
|
?> |
|
<!doctype html> |
|
<html lang="en" class="no-js"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
|
|
|
<title>Send Timesheet</title> |
|
<meta name="description" content=""> |
|
<meta name="author" content=""> |
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
|
|
<link rel="stylesheet" href="./style.css"> |
|
<script language="JavaScript" type="text/javascript" src="jquery-1.9.1.js"></script> |
|
<script language="JavaScript" type="text/javascript" src="jquery.MultiFile.js"></script> |
|
</head> |
|
<body> |
|
<div id="container"> |
|
<div id="contact-form" class="clearfix"> |
|
<h1>Send your timesheet!</h1> |
|
<form method="post" action="sendtsheet.php" enctype="multipart/form-data"> |
|
<label for="name">Name: <span class="required">*</span></label> |
|
<input type="text" id="txtEmployeeName" name="txtEmployeeName" value="<?php echo ($txtEmployeeName)?>" /> |
|
|
|
<label for="email">Email Address: <span class="required">*</span></label> |
|
<input type="email" id="txtEmployeeEmail" name="txtEmployeeEmail" value="<?php echo ($txtEmployeeEmail)?>" /> |
|
|
|
<label for="email">Employee ID: <span class="required">*</span></label> |
|
<input type="email" id="txtEmployeeID" name="txtEmployeeID" value="<?php echo ($txtEmployeeID)?>" /> |
|
|
|
<label for="message">Any other General Notes: |
|
<textarea id="txtGeneralNotes" name="txtGeneralNotes"><?php echo ($txtGeneralNotes)?></textarea> |
|
|
|
<label for="lblTimesheetFiles">Timesheet Files: |
|
<input type="file" id="filTimesheet" name="filTimesheet[]" /> |
|
|
|
<span id="loading"></span> |
|
<input type="submit" value="Holla!" id="submit-button" /> |
|
<p id="req-field-desc"><span class="required">*</span> indicates a required field</p> |
|
</form> |
|
<?php unset($_SESSION['cf_returndata']); ?> |
|
</div> |
|
</div> |
|
|
|
<Script Language="JavaScript" type="text/javascript"> |
|
$(function(){ |
|
$('#filTimesheet').MultiFile({ |
|
accept:'pdf|doc|docx', max:3, STRING: { |
|
remove:'Remove', |
|
selected:'Chosen File: $file', |
|
denied:'Incorrect File Extension $ext!', |
|
duplicate:'Duplicate File:\n$file!' |
|
} |
|
}); |
|
}); |
|
</Script> |
|
</body> |
|
</html> |