Ejemplo n.º 1
0
    $log->error('Could not Open CSV file');
    failed();
    exit;
}
$DropboxFileUploadResult = $dbxClient->uploadFile("/Apps/Attendance2/student_list.csv", dbx\WriteMode::force(), $CVSFileHandle);
if (!$DropboxFileUploadResult) {
    $log->error('Could not Upload CSV file to Dropbox');
    failed();
    exit;
}
$log->info('CSV File Uploaded to dropbox');
fclose($CVSFileHandle);
$log->info('Starting Drobox Picture upload');
$f = fopen($uploadedImage, "rb");
if ($f) {
    $result = $dbxClient->uploadFile("/Apps/Attendance2/{$dropboxImageName}", dbx\WriteMode::force(), $f);
    fclose($f);
}
/*******************************************************************************************************************************
********************************************************************************************************************************
														Funtions
********************************************************************************************************************************
*******************************************************************************************************************************/
function failed()
{
    $to = $errorEmail;
    $subject = 'Creating CVS Failed on CampuslifeOHS';
    $message = $r;
    $headers = 'From: Cvsmaker@Campuslifeohs.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
    mail($to, $subject, $message, $headers);
}
Ejemplo n.º 2
0
         echo "<p>Error Number: " . mysqli_errno($conn) . "</p>";
         echo "<p>Basically, could not retrieve data to update the excel file of the students</p>";
         $error = 1;
     } else {
         if (!write_result_to_csv($output_file, $result)) {
             echo "<p>Could not create the excel file of students<p>";
             $error = 1;
         }
         mysqli_free_result($result);
     }
     //Update the dropbox
     if (!$error) {
         $dropbox_student_list = "/Apps/Attendance2/student_list.csv";
         $f = fopen($output_file, "rb");
         if ($f) {
             $result = $dbxClient->uploadFile("/Apps/Attendance2/student_list.csv", dbx\WriteMode::force(), $f);
             fclose($f);
         } else {
             echo "<p>There was an error updating the dropbox, but the student was updated</p>";
             $error = 1;
         }
     }
     if ($error) {
         echo "<p>Please try again, if the problem persists, please email the webmaster</p>";
     } else {
         echo "Success! Returning... Please Wait";
         echo '<meta http-equiv="refresh" content="0; URL=http://campuslifeohs.com/?p=49">';
     }
 } else {
     echo "<p style=\"color: red;margin: 20px\">There was an error retrieving the data. Please try again.</p>";
     echo "<p>Error code: " . mysqli_errno($conn) . "</p>";