-
Notifications
You must be signed in to change notification settings - Fork 1
/
pspace_money.php
39 lines (32 loc) · 1.11 KB
/
pspace_money.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
// Zend library include path
set_include_path(get_include_path() . PATH_SEPARATOR . "$_SERVER[DOCUMENT_ROOT]/ZendGdata-1.8.1/library");
include_once("Google_Spreadsheet.php");
$u = "[email protected]";
$p = "pspace22A";
$ss = new Google_Spreadsheet($u,$p);
$ss->useSpreadsheet("P-Space money");
// if not setting worksheet, "Sheet1" is assumed
//$ss->useWorksheet("Συνδρομές");
$email_address = '[email protected]';
//$email_row = "'";
$email_row = 'email="';
$email_row .= $email_address;
$email_row .= '"';
//$email_row .= "'";
// double quotes must be used for values with spaces
$rows = $ss->getRows($email_row);
if ($rows) {
$message = "Το μέλος ".$rows['0']['name'];
if ($rows['0']['months'] == 0) {
$message .= " δεν οφείλει κανένα μήνα !\n";
$message .= "Ευχαριστούμε !\n";
}
else if ($rows['0']['months'] == 1) {
$message .= " οφείλει ένα μήνα !\n";
}
else $message .= " οφείλει ".$rows['0']['months']." μήνες !\n";
mail("[email protected]","P-space money",$message);
}
else echo "Error, unable to get spreadsheet data";
?>