init
This commit is contained in:
commit
72a26edcff
22092 changed files with 2101903 additions and 0 deletions
62
scripts/testp.php
Normal file
62
scripts/testp.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
$_SESSION['m1']=3; $_SESSION['m2']=0;
|
||||
// Melde alle PHP Fehler (siehe Changelog)
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 0);
|
||||
|
||||
|
||||
|
||||
if(isset($_POST['submit']))
|
||||
{
|
||||
print_r($_FILES);
|
||||
exit;
|
||||
if($_FILES["upload"]["type"] == "application/pdf")
|
||||
{
|
||||
move_uploaded_file($_FILES["upload"]["tmp_name"],"upload/" . $_FILES["upload"]["name"]);
|
||||
require_once 'CloudPrint.php';
|
||||
$gcp = new GoogleCloudPrint();
|
||||
if($gcp->loginToGoogle("rennbahn2000@gmail.com", "maxdata-01"))
|
||||
{
|
||||
$printers = $gcp->getPrinters();
|
||||
$printerid = "";
|
||||
if(count($printers)==0)
|
||||
{
|
||||
$content = "Could not get printers";
|
||||
}
|
||||
else
|
||||
{
|
||||
$printerid = $printers[0]['id'];
|
||||
$resarray = $gcp->sendPrintToPrinter($printerid, "Printing Doc using Google Cloud Printing", "upload/" . $_FILES["upload"]["name"], "application/pdf");
|
||||
if($resarray['status']==true)
|
||||
{
|
||||
$content = "Document has been sent to printer and should print shortly.";
|
||||
}
|
||||
else
|
||||
{
|
||||
$content = "An error occured while printing the doc. Error code:".$resarray['errorcode']." Message:".$resarray['errormessage'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$content = "Login failed please check login info.";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$content = "<b>ERROR:</b><br>Invalid file upload only PDF file.";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$content = '<form enctype="multipart/form-data" action="" method="post">
|
||||
<input type="file" name="upload" />
|
||||
<input type="submit" name="submit">
|
||||
</form>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$template->assign('content', 'tpl/i_info.tpl');
|
||||
?>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue