コード例 #1
0
function sendAlert($temp, $threshold, $dbname, $label, $name, $contactfile)
{
    print "Sending mail: {$temp}, {$threshold}, {$label}, {$name} \t";
    $mail = getMailer();
    $master = getContacts($dbname, $contactfile);
    foreach ($master as $namepair) {
        $email = $namepair[0];
        $name = $namepair[1];
        print "Emailing: {$email}, {$name}\n";
        $mail->addAddress($email, $name);
    }
    if ($temp != 999) {
        $subject = "Freezer WARNING. {$name}, {$temp}";
        $body = "Freezer Label: {$label}\n";
        $body .= "30min Average: {$temp}\nAlarm Threshold: {$threshold}\n";
    } else {
        // temp == 999, signal that receiver did not work
        $body = "Unable to connect to freezer sensor: {$label} \n";
        $subject = "Freezer Connection Error: {$label}";
    }
    $mail->Subject = $subject;
    $mail->Body = $body;
    if (!$mail->send()) {
        echo 'Message could not be sent.';
        echo 'Mailer Error: ' . $mail->ErrorInfo;
        exit;
    }
    echo 'Message has been sent';
    return;
}
コード例 #2
0
ファイル: snet.php プロジェクト: stef/maelstrom
function makeTree($db, $name, $level = 2)
{
    $node = makeNode($name);
    if ($level > 0) {
        $cl = getContacts($db, $name);
        foreach ($cl as $c) {
            $node["children"][] = makeTree($db, $c["name"], $level - 1);
        }
    }
    return $node;
}
コード例 #3
0
ファイル: Contacts_lib.php プロジェクト: behzad900/rspsms
 function addContact()
 {
     $this->CI->load->plugin('gmail_contacts');
     if (strstr($_SERVER['REQUEST_URI'], '?')) {
         $tokens = array();
         $responce = $_SERVER['REQUEST_URI'];
         $responcearr = explode('?', $responce);
         if (!empty($responcearr)) {
             $gets = explode('&', $responcearr[1]);
             if (!empty($gets)) {
                 foreach ($gets as $value) {
                     $array = explode('=', $value);
                     if (!empty($array)) {
                         $tokens[$array[0]] = $array[1];
                     }
                 }
             }
         }
         $contacts = getContacts($tokens, $this->CI->config->item('SMS_google_ckey'), $this->CI->config->item('SMS_google_csecretkey'), $this->CI->config->item('SMS_google_callbackurl'));
         $data['contacts'] = $contacts;
         return $this->CI->load->view($this->CI->config->item('SMS_gcontacts_list_view'), $data, TRUE);
         die;
     }
     $fields['mobileno'] = $this->CI->lang->line('SMS_mobileno_label');
     $fields['full_name'] = $this->CI->lang->line('SMS_fullname_label');
     $rules['mobileno'] = $this->CI->config->item('SMS_mobileno_field_validation_smssend');
     $rules['full_name'] = $this->CI->config->item('SMS_fullname_field_validation_smssend');
     $this->CI->fal_validation->set_fields($fields);
     $this->CI->fal_validation->set_rules($rules);
     $data['ss'] = '';
     if ($this->CI->fal_validation->run()) {
         $user_id = $this->user_id;
         $mobileno = $this->CI->input->post('mobileno');
         $fullname = $this->CI->input->post('full_name');
         $values = array('user_id' => $user_id, 'name' => $fullname, 'mobileno' => $mobileno, 'createdon' => date("Y-m-d H:i:s"));
         $this->CI->contactsmodel->insert($values);
         flashMsg('Contact added Successfully');
         redirect('contacts/show');
     } else {
         $data['gconnect'] = getGoogleConnectLink($this->CI->config->item('SMS_google_ckey'), $this->CI->config->item('SMS_google_csecretkey'), $this->CI->config->item('SMS_google_callbackurl'));
         return $this->CI->load->view($this->CI->config->item('SMS_contacts_form_view'), $data, TRUE);
     }
 }
コード例 #4
0
ファイル: contact.php プロジェクト: lindaqq/MeTube
                }
            } else {
                if (!empty($_POST["foe"])) {
                    if ($_POST["foe"] === $_SESSION["username"]) {
                        $errortext_foe = "can't add yourself";
                    } else {
                        if (existUser($_POST["foe"]) === 0) {
                            $errortext_foe = "user " . $_POST["foe"] . " doesn't exist";
                        } else {
                            addFoe($_SESSION["username"], $_POST["foe"]);
                            $errortext_foe = "add foe successfully";
                        }
                    }
                }
            }
        }
        $contacts = getContacts($_SESSION["username"]);
        $friends = getFriends($_SESSION["username"]);
        $foes = getFoes($_SESSION["username"]);
        render("contact_template.php", ["contacts" => $contacts, "friends" => $friends, "foes" => $foes, "errortext_contact" => $errortext_contact, "errortext_friend" => $errortext_friend, "errortext_foe" => $errortext_foe, "titile" => "Contact"]);
    } else {
        $contacts = getContacts($_SESSION["username"]);
        $friends = getFriends($_SESSION["username"]);
        $foes = getFoes($_SESSION["username"]);
        render("contact_template.php", ["contacts" => $contacts, "friends" => $friends, "foes" => $foes, "errortext_contact" => "", "errortext_friend" => "", "errortext_foe" => "", "titile" => "Contact"]);
    }
}
$db->sql_close();
?>

コード例 #5
0
        // Reload the contacts
        $output['contacts'] = getContacts();
        echo json_encode($output);
    } else {
        if ($action == "editName") {
            // Collect the ID we wish to edit
            $id = $_POST['pk'];
            // Get the post variables for the edited name
            $name = $_POST['value'];
            // Update name in database
            editName($name, $id);
            $output['msg'] = "Contact name updated.";
            echo json_encode($output);
        } else {
            if ($action == "editPhone") {
                // Collect the ID we wish to edit
                $id = $_POST['pk'];
                // Get the post variables for the edited phone number
                $phone = $_POST['value'];
                // Update phone number in database
                editPhone($phone, $id);
                $output['msg'] = "Contact phone number updated.";
                echo json_encode($output);
            } else {
                $output['contacts'] = getContacts();
                $output['msg'] = "List of all contacts";
                echo json_encode($output);
            }
        }
    }
}
コード例 #6
0
ファイル: butler.php プロジェクト: radiochickenwax/gregsList
function parseInputs($user)
{
    if (isset($_POST['func'])) {
        $func = $_POST['func'];
        // getters ===============================
        if ($func === "getGoals") {
            echo json_encode(getGoals($user));
        }
        if ($func === "getIndustries") {
            echo json_encode(getIndustries($user));
        }
        if ($func === "getLocations") {
            echo json_encode(getLocations($user));
        }
        if ($func === "getPostings") {
            getPostings($user);
        }
        if ($func === "getContacts") {
            echo json_encode(getContacts($user));
        }
        if ($func === "getSchedules") {
            echo json_encode(getSchedules($user));
        }
        if ($func === "getCompanies") {
            echo getCompanies($user);
        }
        if ($func === "getBlogId") {
            echo json_encode(getBlogId($user, $_POST['title'], $_POST['text']));
        }
        if ($func === "getBlog") {
            echo json_encode(getBlog($user));
        }
        if ($func === "getNotesOnPosting") {
            $postingId = $_POST['postingId'];
            echo json_encode(getNotesOnPosting($user, $postingId));
        }
        // inserters ===============================
        if ($func === "insertGoal") {
            if (isset($_POST["goal"]) && $_POST["goal"] !== '') {
                echo json_encode(insertGoal($user, $_POST["goal"]));
            }
        }
        if ($func === "insertIndustry") {
            if (isset($_POST["industry"]) && $_POST["industry"] !== '') {
                echo json_encode(insertIndustry($user, $_POST["industry"]));
            }
        }
        if ($func === "insertCompany") {
            $url = urldecode($_POST["url"]);
            $companyName = $_POST["company"];
            insertCompany($user, $companyName);
        }
        if ($func === "insertLocation") {
            if (isset($_POST["location"]) && $_POST["location"] !== '') {
                echo json_encode(insertLocation($user, $_POST["location"]));
            }
        }
        if ($func === "insertPosting") {
            echo json_encode(insertPosting($user));
        }
        if ($func === "insertContact") {
            // more complex.  will be responsible for getting $_POST
            echo json_encode(insertContact($user));
        }
        if ($func === "insertSchedule") {
            // more complex.  will be responsible for getting $_POST
            // echo json_encode(insertSchedule($user));
            echo insertSchedule($user);
        }
        if ($func === "addSchedule") {
            // more complex.  will be responsible for getting $_POST
            // echo json_encode(insertSchedule($user));
            // echo "adding ZSchecdule";
            $name = $_POST["name"];
            $description = $_POST["description"];
            $contact = $_POST["contact"];
            $start = $_POST["start"];
            $end = $_POST["end"];
            // addSchedule($name,$description,$contact,$start,$end)
            if (addSchedule($name, $description, $contact, $start, $end)) {
                $scheduleId = getScheduleId($name, $description, $contact, $start, $end);
                if ($scheduleId > 0) {
                    // echo $scheduleId;
                    // insert schedule id and user id to user_schedule
                    $query = "insert into user_schedule ";
                    $query .= "(user,schedule) ";
                    $query .= "values ( {$user}, ";
                    $query .= "{$scheduleId} ) ";
                    //return $query;
                    echo booleanEcho($query);
                } else {
                    echo "error getting schedule id.";
                }
            } else {
                echo "error inserting schedule.";
            }
        }
        if ($func === "insertBlog") {
            echo json_encode(insertBlog($user));
        }
        if ($func === "insertNotesPostingUser") {
            // insertBlog, then insertNotesPostingUser
            $noteId = insertBlog($user);
            // $noteId = $_POST["noteId"];
            $postingId = $_POST["postingId"];
            echo json_encode(insertNotesPostingUser($noteId, $postingId, $user));
        }
        // removers ===============================
        if ($func === "removeGoal") {
            // url is the id for user_goals
            if (isset($_POST["url"]) && $_POST["url"] !== '') {
                echo json_encode(removeGoal($user, $_POST["url"]));
            }
        }
        if ($func === "removeIndustry") {
            // url is the id for user_industries
            if (isset($_POST["url"]) && $_POST["url"] !== '') {
                echo json_encode(removeIndustry($user, $_POST["url"]));
            }
        }
        if ($func === "removeLocation") {
            // url is the id for locations
            if (isset($_POST["url"]) && $_POST["url"] !== '') {
                echo json_encode(removeLocation($user, $_POST["url"]));
            }
        }
        if ($func === "removeContact") {
            // url is the id for user_contacts
            if (isset($_POST["url"]) && $_POST["url"] !== '') {
                echo json_encode(removeUserContact($user, $_POST["url"]));
            }
        }
        if ($func === "removePosting") {
            if (isset($_POST["url"]) && $_POST["url"] !== '') {
                removePosting($user, $_POST["url"]);
            }
        }
        if ($func === "removeCompany") {
            $companyId = $_POST["url"];
            // companyID is stored here
            removeCompany($user, $companyId);
        }
        if ($func === "removeSchedule") {
            $scheduleId = $_POST["url"];
            // scheduleID is stored here
            echo json_encode(removeSchedule($user, $scheduleId));
        }
        if ($func === "removeBlog") {
            $userNoteId = $_POST["url"];
            // need to get noteId from userNoteId
            $noteId = getNoteIdFromUserNoteId($userNoteId);
            if (removeNoteUser($user, $userNoteId) === true) {
                if (removeNote($noteId) === true) {
                    echo json_encode(true);
                } else {
                    echo json_encode("Error removing from notes.");
                }
            } else {
                echo json_encode("Error removing from NoteUser.");
            }
        }
        // updaters ===============================
        if ($func === "updateGoal") {
            echo json_encode(updateGoal($user));
        }
        if ($func === "updateIndustry") {
            echo json_encode(updateIndustry($user));
        }
        if ($func === "updatePosting") {
            updatePosting($user);
            // returns on its own
        }
        if ($func === "updateContact") {
            echo json_encode(updateContact($user));
        }
    }
}
コード例 #7
0
ファイル: message.php プロジェクト: lindaqq/MeTube
<?php

// configuration
require_once "../includes/config.php";
require "../includes/interactionService.php";
$db = new mysql_db(SERVER, USERNAME, PASSWORD, DATABASE);
$username = $_SESSION["username"];
if (isset($_POST["receiver"])) {
    $receiver = $_POST["receiver"];
    $message = $_POST["content"];
    $sender = $username;
    sendMessage($sender, $receiver, $message);
}
$userid1 = $username;
$friends = getFriends($userid1);
$contacts = getContacts($userid1);
$messages = getMessages($username);
$contacts = array_merge($friends, $contacts);
render("message_template.php", ["messages" => $messages, "contacts" => $contacts]);
$db->sql_close();
コード例 #8
0
ファイル: addressbook.php プロジェクト: nrooney/rcs_oma
     postSubscription($_POST['username'], $authuser, $authpw);
     break;
 case 'updateSubscription':
     updateSubscription($_POST['username'], $authuser, $authpw, $subID);
     break;
 case 'deleteSub':
     deleteSub($_POST['username'], $authuser, $authpw, $subID);
     break;
 case 'getIndivSubInfo':
     getIndivSubInfo($_POST['username'], $authuser, $authpw, $subID);
     break;
 case 'getAllSubInfo':
     getAllSubInfo($_POST['username'], $authuser, $authpw);
     break;
 case 'getContacts':
     getContacts($_POST['username'], $authuser, $authpw);
     break;
 case 'getContact':
     getContact($_POST['username'], $authuser, $authpw, $contactID);
     break;
 case 'addEditContact':
     addEditContact($_POST['username'], $authuser, $authpw, $contactName, $contactID);
     break;
 case 'removeContact':
     removeContact($_POST['username'], $authuser, $authpw, $contactID);
     break;
 case 'getContactAttributes':
     getContactAttributes($_POST['username'], $authuser, $authpw, $contactID);
     break;
 case 'getContactAttribute':
     getContactAttribute($_POST['username'], $authuser, $authpw, $attributeName);
コード例 #9
0
ファイル: phpkml.kml.php プロジェクト: rmc47/CamLogKML
						minLongFromMaidenhead($bigSquare) . "," . minLatFromMaidenhead($bigSquare) . ",10," .
						minLongFromMaidenhead($bigSquare) . "," . maxLatFromMaidenhead($bigSquare) . ",10," .
						maxLongFromMaidenhead($bigSquare) . "," . maxLatFromMaidenhead($bigSquare) . ",10," .
						maxLongFromMaidenhead($bigSquare) . "," . minLatFromMaidenhead($bigSquare) . ",10," .
						minLongFromMaidenhead($bigSquare) . "," . minLatFromMaidenhead($bigSquare) . ",10");
				?></coordinates>
			  </LinearRing>
			</outerBoundaryIs>
		  </Polygon>
	</Placemark>
<?php
}
echo "
  </Folder>
  <Folder>
    <name>Contacts</name>
";
$cCnt = 0; // Colour count
foreach (getContacts() as $callsign => $locator) {
	?><Placemark>
		<name><?php echo ($callsign); ?></name>
                <styleUrl>#m_<?php if($cCnt < 5) { echo "grn"; } else { echo "ylw"; } $cCnt ++?>-pushpin</styleUrl>
		<Point><coordinates><?php echo (minLongFromMaidenhead(strtolower($locator)) . "," . minLatFromMaidenhead(strtolower($locator))); ?></coordinates></Point>
	</Placemark><?php
}
echo "
  </Folder>";
?>
</Document> 
</kml>
コード例 #10
0
ファイル: contacts.php プロジェクト: jdevince/codervscancer
<p>Add a new loved one</p>
<form role="form" id="addContactForm" class="form-horizontal">
	<div class="center-block text-center">
		<div class="form-group">
			<div class="col-sm-4 col-sm-offset-4 col-xs-8 col-xs-offset-2">
				<input type="email" class="form-control" name="email" id="email" placeholder="Enter your loved ones email address" required>
			</div>
		</div>
		<button type="submit" id="addContactSubmit" class="btn btn-default">Add</button>
	</div>		
</form>



<?php 
include "Includes/footer.php";
?>

<script> 
	$(document).ready(function () { 
		var contacts = <?php 
echo getContacts($_SESSION["UserEmail"]);
?>
;
		for (var index = 0; index < contacts.length; index++) 
		{
			$("#contactsList").append("<p>" + contacts[index] + "</p>");
		}
	});
</script>
コード例 #11
0
ファイル: index.php プロジェクト: sprov03/chris.dev
    include "homepage.php";
});
/**
 *      Recives Request
 *      Convert to proper format
 *      Call Functions to Comunicate with the database
 *      Reformates the data returned from the database
 *      echos the response.
 */
/**
 *  Get:: contacts info from the database.
 */
$app->get('/contacts', function () use($app) {
    $body = $app->request->getBody();
    $body = json_decode($body, true);
    $response = getContacts($body);
    header('Content-Type: application/json');
    $app->response->setStatus(200);
    echo json_encode($response);
});
/**
 * Get: a contact from the database.
 */
$app->get('/contacts/:id', function ($id) use($app) {
    $body = $app->request->getBody();
    $body = json_decode($body, true);
    $response = getContact($body, $id);
    header('Content-Type: application/json');
    $app->response->setStatus(200);
    echo json_encode($response);
});
コード例 #12
0
ファイル: index.php プロジェクト: ekutor/hermes
$app->get('/getContacts', function () {
    //Importa el archivo que contiene el método
    require_once 'Servicios/getContacts.php';
    $app = new \Slim\Slim();
    require_once 'Servicios/Auth.php';
    $deviceId = $app->request->headers->get('deviceID');
    $hash = $app->request->headers->get('hash');
    $respuesta = auth($deviceId, $hash);
    if ($respuesta != "Auth_OK") {
        echo $respuesta;
        return;
    }
    //Obtiene los parametros del header http
    //$idContact = $app->request->headers->get('idContact');
    //LLama el método que lee de la base de datos y obtiene la respuesta
    $respuesta = getContacts();
    //Muestra la respuesta al cliente
    echo $respuesta;
});
//--------------------------------------------------------------------------------------------------
$app->get('/getContactsxAccount', function () {
    //Importa el archivo que contiene el método
    require_once 'Servicios/getContacts.php';
    $app = new \Slim\Slim();
    require_once 'Servicios/Auth.php';
    $deviceId = $app->request->headers->get('deviceID');
    $hash = $app->request->headers->get('hash');
    $log = new IOManager();
    $log->logAll($app->request->headers);
    $respuesta = auth($deviceId, $hash);
    if ($respuesta != "Auth_OK") {
コード例 #13
0
         $gifts = getGifts($db, (int) $_SESSION['user_id']);
         // Template
         $menuPath = '/view/site/dashboard/user/menu.php';
         $sitePath = '/view/site/dashboard/user/gifts.php';
     } else {
         header('Location: /dashboard');
     }
     break;
 case 'contacts':
     require_once APP_PATH . 'model/getJs.php';
     require_once APP_PATH . 'model/getContacts.php';
     require_once APP_PATH . 'model/saveContact.php';
     require_once APP_PATH . 'model/updateContact.php';
     require_once APP_PATH . 'model/deleteContactLogo.php';
     $scripts = getJs($allScripts, ['maps' => 1, 'mapControl' => 1, 'tabControl' => 1], true);
     $contacts = getContacts($db);
     // controller
     require_once APP_PATH . 'control/contactsController.php';
     // Template
     $menuPath = '/view/site/dashboard/user/menu.php';
     $sitePath = '/view/site/dashboard/user/contacts.php';
     break;
 default:
     // DASHBOARD
     // Model
     require_once APP_PATH . 'model/getActivePackages.php';
     require_once APP_PATH . 'model/getAllPackages.php';
     require_once APP_PATH . 'model/bookPackage.php';
     require_once APP_PATH . 'model/sendBill.php';
     require_once APP_PATH . 'model/getJs.php';
     // PDF MAKER
コード例 #14
0
ファイル: index.php プロジェクト: SonofLight/ContactPHP
        <form action="index.php" enctype="multipart/form-data" method="post">
            <label for="first_name">First Name<span>*</span> : </label><input id="first_name" type="text" name="first_name" value="" required /><br/>
            <label for="last_name">Last Name<span>*</span> : </label><input  id="last_name" type="text" name="last_name" value="" required /><br />
            <label for="phone">Phone<span>*</span> : </label><input id="phone" type="tel" name="phone" value="" maxlength="20" required /><br />
            <label for="prim_email">Primary Email<span>*</span> : </label><input id="prim_email" type="email" name="prim_email" value="" required /><br />
            <label for="other_email">Other Email: </label><input id="other_email" type="email" name="other_email" value="" /><br />
            <label for="website">Web Site: </label><input id="website" type="url" name="website" value="" /><br />
            <label for="notes">Notes:</label><br /><textarea name="comments" id="notes"   maxlength="150"></textarea><br />
            <label for="img_upload">Upload Image: </label><input id="img_upload" type="file" name="img_upload" value="upload" /><br />
            <input type="submit" name="submit" value="submit" />
            <input type="reset" name="reset" value="reset" />
        </form>
    </div>
</aside>
<div class="instructions">
    <h1>Add Contacts. <br>Update Contacts.<br> Delete Contacts.<br></h1>
    <h2>Enter your contacts.</h2>
    <h3>Click the add contact button to get started.</h3>
</div>

<section id="contacts">

    <?php 
getContacts();
?>
</section>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script language="JavaScript" type="text/javascript" src="js/scripts.js"></script>
</body>
</html>