This class is best used with a cronjob like this:
0,30 * * * * cd /home/yurukov1/public_html/vote; /usr/local/php5/bin/php proxy.php
If an email is configured for the cronjob, then all addresses in error will be printed out only once.

*********************************************************/
mb_internal_encoding("UTF-8");
$datafile = "data/.data.json.gz";
//the path yo your ZEND libs
set_include_path("/home/yurukov1/libs/");
include_once "Google_Spreadsheet.php";
include "secret.php";
include_once "config.php";
//access settings should be defined in config.php
$ss = new Google_Spreadsheet($u, $p);
$ss->useSpreadsheet($spreadsh);
$ss->useWorksheet($sheet);
// get the data from the spreadsheet
$rows = $ss->getRows();
if (!$rows) {
    exit;
}
$data = array();
for ($i = 0; $i < count($rows); $i++) {
    $type = $rows[$i]["искателидапомогнете"];
    if ($type == "Ще разпостранявам информация сред познати") {
        $type = 1;
    } else {
        if ($type == "Бих се заел с организиране на секция извън консулствата") {
            $type = 2;
        } else {
<?php

include_once "csp_helper.php";
$u = "*****@*****.**";
$p = "pi314159265";
$ss = new Google_Spreadsheet($u, $p);
$ss->useSpreadsheet("Collaboration Tracking");
$ss->useWorksheet("Sheet1");
$ss2 = new Google_Spreadsheet($u, $p);
$ss2->useSpreadsheet("NRNB Subproject Stages");
$ss2->useWorksheet("Sheet1");
$rowset = 'projectstage!=""';
# only rows with stage info
$rows = $ss->getRows($rowset);
if ($rows) {
    foreach ($rows as $row) {
        $stage = $row['projectstage'];
        $stage2 = array();
        ## skip if no digits
        $stage = str_replace(",", "", $stage);
        $len = strlen($stage);
        if ($len < 1) {
            continue;
        } elseif ($len == 1) {
            array_push($stage2, $stage . "1");
        } elseif ($len > 1) {
            array_push($stage2, substr($stage, 0, 1) . "2");
            for ($i = 1; $i < $len - 1; $i++) {
                array_push($stage2, substr($stage, $i, 1) . "1");
                array_push($stage2, substr($stage, $i, 1) . "2");
            }
tr:nth-child(odd) {
  background-color: white;
}
    </style>
</head>

<body>
<table border="0px">

<?php 
include_once "csp_helper.php";
$u = "*****@*****.**";
$p = "****";
//NOTE: don't bother, the helper code based on Zend no longer works
$ss = new Google_Spreadsheet($u, $p);
$ss->useSpreadsheet("Collaboration Tracking");
$ss->useWorksheet("Sheet1");
//headers
echo "<tr>";
$head = $ss->getColumnNames();
foreach ($head as $colname) {
    echo "<th>{$colname}</th>";
}
echo "</tr>";
//GET admin set
$view = $_GET["view"];
$rowset = "";
//means "show all;
if ($view == "Ongoing" || $view == "Completed" || $view == "Canceled" || $view == "Unknown") {
    $rowset = "projectstatus={$view}";
}
<?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";
include_once "../../../config/post_spreadsheet_config.php";
$ss = new Google_Spreadsheet($u, $p);
$ss->useSpreadsheet("Mailing List 2015");
$name = Trim(stripslashes($_GET['name']));
$email = Trim(stripslashes($_GET['email']));
$year = Trim(stripslashes($_GET['year']));
$campus = Trim(stripslashes($_GET['campus']));
$interest = Trim(stripslashes($_GET['interest']));
$involvement = Trim(stripslashes($_GET['involvement']));
// if not setting worksheet, "Sheet1" is assumed
// $ss->useWorksheet("worksheetName");
$row = array("Name" => $name, "Email" => $email, "Year of Study" => $year, "College/Campus" => $campus, "Area of interest" => $interest, "Involvement in TEDxUofT" => $involvement);
if ($ss->addRow($row)) {
    echo "Form data successfully stored using Google Spreadsheet";
} else {
    echo "Error, unable to store spreadsheet data";
}
<?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";
include_once "../../../config/post_spreadsheet_config.php";
$ss = new Google_Spreadsheet($u, $p);
$ss->useSpreadsheet("2015 Delegate Application");
$Name = Trim(stripslashes($_GET['Name']));
$Email = Trim(stripslashes($_GET['Email']));
$Year = Trim(stripslashes($_GET['Year']));
$Phone = Trim(stripslashes($_GET['Phone']));
$Status = Trim(stripslashes($_GET['Status']));
$Occupation = Trim(stripslashes($_GET['Occupation']));
$Program = Trim(stripslashes($_GET['Program']));
$Campus = Trim(stripslashes($_GET['Campus']));
$Dietary = Trim(stripslashes($_GET['Dietary']));
$FinalQ = Trim(stripslashes($_GET['FinalQ']));
// if not setting worksheet, "Sheet1" is assumed
// $ss->useWorksheet("worksheetName");
$row = array("Name" => $Name, "E-mail" => $Email, "Year" => $Year, "Phone" => $Phone, "I am a(an)" => $Status, "Occupation" => $Occupation, "Program" => $Program, "Campus" => $Campus, "Dietary" => $Dietary, "Final Question" => $FinalQ);
if ($ss->addRow($row)) {
    echo "Form data successfully stored using Google Spreadsheet";
} else {
    echo "Error, unable to store spreadsheet data";
}
<?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";
include_once "../../../config/post_spreadsheet_config.php";
$ss = new Google_Spreadsheet($u, $p);
$ss->useSpreadsheet("Hiring Application Submissions 2014");
$Name = Trim(stripslashes($_GET['Name']));
$Campus = Trim(stripslashes($_GET['Campus']));
$Position = Trim(stripslashes($_GET['Position']));
$Email = Trim(stripslashes($_GET['Email']));
$Phone = Trim(stripslashes($_GET['Phone']));
$Occupation = Trim(stripslashes($_GET['Occupation']));
$Title = Trim(stripslashes($_GET['Title']));
$Year = Trim(stripslashes($_GET['Year']));
// if not setting worksheet, "Sheet1" is assumed
// $ss->useWorksheet("worksheetName");
$row = array("Name" => $Name, "Campus" => $Campus, "Application Position" => $Position, "E-mail" => $Email, "Phone" => $Phone, "Program" => $Occupation, "Year of Study" => $Year);
if ($ss->addRow($row)) {
    echo "Form data successfully stored using Google Spreadsheet";
} else {
    echo "Error, unable to store spreadsheet data";
}
示例#7
0
    $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
    // optional, comment out and test
    $mail->MsgHTML($body);
    $mails = explode(',', $_SETTINGS['email']['address']);
    foreach ($mails as $v) {
        $mail->AddAddress(trim($v));
    }
    if (!$mail->Send()) {
        $ret['error'] = 1;
    }
}
/**************** GOOGLE.DOCS method ************************/
if ($_SETTINGS['store_to_gdocs']) {
    include_once "GoogleSpreadsheet/Google_Spreadsheet.php";
    $ss = new Google_Spreadsheet($_SETTINGS['gdocs']['user'], $_SETTINGS['gdocs']['password']);
    $ss->useSpreadsheet($_SETTINGS['gdocs']['spreadsheet_name']);
    $ss->useWorksheet($_SETTINGS['gdocs']['worksheet_name']);
    $row = array("Date" => date("m/d/Y H:i"));
    foreach ($_POST['fields'] as $k => $v) {
        $row[$k] = $v;
    }
    if (!$ss->addRow($row)) {
        $ret['error'] = 1;
    }
}
/**************** MailChimp method ************************/
if ($_SETTINGS['store_to_mailchimp']) {
    if (@$_POST['fields'][$_SETTINGS['email_field_name']] && $_SETTINGS['mailchimp']['apikey'] && $_SETTINGS['mailchimp']['listId']) {
        include_once 'mailChimp/MCAPI.class.php';
        $MCAPI = new MCAPI($_SETTINGS['mailchimp']['apikey']);
        $arr = array('EMAIL' => $_POST['fields'][$_SETTINGS['email_field_name']]);
<?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";
include_once "../../../config/post_spreadsheet_config.php";
$ss = new Google_Spreadsheet($u, $p);
$ss->useSpreadsheet("Nomination Submissions 2014");
$Nominator_Name = Trim(stripslashes($_GET['Nominator_Name']));
$Nominator_Email = Trim(stripslashes($_GET['Nominator_Email']));
$Nominator_Phone = Trim(stripslashes($_GET['Nominator_Phone']));
$Nominee_Name = Trim(stripslashes($_GET['Nominee_Name']));
$Nominee_Email = Trim(stripslashes($_GET['Nominee_Email']));
$Nominee_Phone = Trim(stripslashes($_GET['Nominee_Phone']));
$Overview = Trim(stripslashes($_GET['Overview']));
$Websites_Articles = Trim(stripslashes($_GET['Websites_Articles']));
$Audios_Videos = Trim(stripslashes($_GET['Audios_Videos']));
$Speaking_Style = Trim(stripslashes($_GET['Speaking_Style']));
$Why_fits_the_theme = Trim(stripslashes($_GET['Why_fits_the_theme']));
// if not setting worksheet, "Sheet1" is assumed
// $ss->useWorksheet("worksheetName");
$row = array("Nominator Name" => $Nominator_Name, "Nominator E-mail" => $Nominator_Email, "Nominator Phone" => $Nominator_Phone, "Nominee Name" => $Nominee_Name, "Nominee E-mail" => $Nominee_Email, "Nominee Phone" => $Nominee_Phone, "Overview" => $Overview, "Websites or Articles" => $Websites_Articles, "Audios or Videos" => $Audios_Videos, "Speaking Style" => $Speaking_Style, "Why fits the theme" => $Why_fits_the_theme);
if ($ss->addRow($row)) {
    echo "Form data successfully stored using Google Spreadsheet";
} else {
    echo "Error, unable to store spreadsheet data";
}