Пример #1
0
function parse($file)
{
    $objExcel = PHPExcel_IOFactory::load($file);
    $sheets = $objExcel->getAllSheets();
    $sheetNum = 1;
    foreach ($sheets as $sheet) {
        echo 'Processing Sheet ', $sheetNum++, '<br>';
        $row = 1;
        while (true) {
            echo 'Processing Row ', $row, '<br>';
            if ($sheet->cellExistsByColumnAndRow(0, $row)) {
                $firstName = $sheet->getCellByColumnAndRow(0, $row)->__toString();
                if ($firstName == 'First Name') {
                    $row++;
                    continue;
                }
                $lastName = $sheet->getCellByColumnAndRow(1, $row)->__toString();
                $email = $sheet->getCellByColumnAndRow(2, $row)->__toString();
                $company = $sheet->getCellByColumnAndRow(3, $row)->__toString();
                $job = $sheet->getCellByColumnAndRow(4, $row)->__toString();
                $tags = $sheet->getCellByColumnAndRow(5, $row)->__toString();
                echo $firstName, ' ', $lastName, ' ', $email, ' ', $company, ' ', $job, ' ', $tags, '<br>';
                addContact($firstName, $lastName, $email, $company, $job, $tags);
            } else {
                $row = -1;
                break;
            }
            $row++;
        }
        echo '<br><br>';
    }
}
Пример #2
0
function generateContacts($url, $username, $password)
{
    $client = new SPOClient($url);
    $client->signIn($username, $password);
    $contactsCount = 120;
    for ($i = 0; $i < $contactsCount; $i++) {
        $contactEntry = createContactEntry();
        $item = addContact($client, $contactEntry);
        print "Contact '{$item->Title}' has been created succesfully.\r\n";
    }
}
Пример #3
0
function SynCcontact($employeeNumber)
{
    $ct = new contacts(null, $employeeNumber);
    $obmex = new obm_export(1);
    if ($ct->uidNumber == null) {
        write_syslog("Checking {$employeeNumber} uidNumber is null aborting, failed to import to OBM database", __FILE__);
        die;
    }
    if (preg_match("#ou=(.+?),ou=People,#", $ct->dn, $re)) {
        $uidMaster = $re[1];
        $contact = new user($uidMaster);
        if (preg_match("#(.+?)@(.+)#", $contact->mail, $re)) {
            $DomainId = GetobmDomainId($re[2]);
            write_syslog("From {$uidMaster} ({$contact->mail}) DomainId={$DomainId}", __FILE__);
        }
    }
    if (!IsUserExists($ct->uidNumber)) {
        write_syslog("Checking {$employeeNumber} ({$ct->uidNumber}) does not exists", __FILE__);
        addContact($ct, $DomainId);
    }
    editContact($ct, $DomainId);
    die;
}
Пример #4
0
     }
 } else {
     if ($_GET['action'] == addContactType && $_SESSION['access'] >= 50) {
         //if the user is adding the contact, then add it
         if (isset($_POST['addContactType'])) {
             $contactType = new PersonType();
             addContactType($contactType);
         } else {
             addContactTypeForm();
         }
     } else {
         if ($_GET['action'] == addContact && $_SESSION['access'] >= 50 || $_GET['action'] == addPerson && $_SESSION['access'] >= 50) {
             $contact = new Person();
             //if the user is adding the contact, then add it
             if (isset($_POST['addContact'])) {
                 addContact($contact);
             } else {
                 if (isset($_POST['addContactExist'])) {
                     addContactExist();
                 } else {
                     if ($_GET['action'] == addContact) {
                         addContactForm();
                     } else {
                         addPersonForm();
                     }
                 }
             }
         } else {
             if ($_GET['action'] == removeGroupType && $_SESSION['access'] >= 50) {
                 //get the contact ID and remove that
                 $groupType = new ContactType($_GET['groupTypeID']);
Пример #5
0
        }
    }
    $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 {
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        if (!empty($_POST["contact"])) {
            if ($_POST["contact"] === $_SESSION["username"]) {
                $errortext_contact = "can't add yourself";
            } else {
                if (existUser($_POST["contact"]) === 0) {
                    $errortext_contact = "user " . $_POST["contact"] . " doesn't exist";
                } else {
                    $result = addContact($_SESSION["username"], $_POST["contact"]);
                    if ($result === 0) {
                        $errortext_contact = "you are a foe of " . $_POST["contact"] . ", you can't add " . $_POST["contact"] . " as a contact";
                    } else {
                        $errortext_contact = "add contact successfully";
                    }
                }
            }
        } else {
            if (!empty($_POST["friend"])) {
                if ($_POST["friend"] === $_SESSION["username"]) {
                    $errortext_friend = "can't add yourself";
                } else {
                    if (existUser($_POST["friend"]) === 0) {
                        $errortext_friend = "user " . $_POST["friend"] . " doesn't exist";
                    } else {
Пример #6
0
require '../src/Telegram.php';
$token = '';
// HERE YOUR TOKEN
// You will need a file called quotes (without extension)
// from there it will take the quotes and send them to your subscribers :)
$tg = new telegramBot($token);
$offset = 0;
$response = $tg->pollUpdates($offset, 60);
$response = json_decode($response, true);
if ($response['ok']) {
    foreach ($response['result'] as $data) {
        $chatID = $data['message']['chat']['id'];
        switch ($data['message']['text']) {
            case '/start':
                addContact($chatID);
                break;
            case '/remove':
                deleteContact($chatID);
                break;
        }
    }
    $offset = $response['result'][count($response['result']) - 1]['update_id'] + 1;
}
$chats = allChats();
$quotes = readQuotes();
$i = 0;
for ($i; $i < count($chats); $i++) {
    $tg->sendMessage($chats[$i]['chat_id'], $quotes[$chats[$i]['init']]);
    updateInit($chats[$i]['chat_id']);
    if ($chats[$i]['init'] == count($quotes) - 1) {
    $userName = $_GET['userName'];
} else {
    $userName = null;
}
if (isset($_GET['siteID'])) {
    $siteID = $_GET['siteID'];
} else {
    $siteID = null;
}
if (isset($_GET['status'])) {
    $status = $_GET['status'];
} else {
    $status = null;
}
if ($action == "create") {
    $id = addContact($id, $sessionID, $userName, $siteID, $status);
    echo "{ \"id\": " . $id . "}";
    return;
} else {
    if ($action == "remove") {
        $num = removeContact($id);
        echo "{ \"num\": " . $num . "}";
        return;
    } else {
        if ($action == "change") {
            changeContact($id, $sessionID, $userName, $siteID, $status);
            echo "{ \"message\": \"done\" }";
            return;
        } else {
            if ($action == "load") {
                $d = loadContacts();
Пример #8
0
     $invoiceemails = 1;
 }
 if ($productemails) {
     $productemails = 1;
 }
 if ($supportemails) {
     $supportemails = 1;
 }
 if ($affiliateemails) {
     $affiliateemails = 1;
 }
 if ($contactid == "addnew") {
     if ($password && $password != $aInt->lang("fields", "password")) {
         $array['password'] = generateClientPW($password);
     }
     $contactid = addContact($userid, $firstname, $lastname, $companyname, $email, $address1, $address2, $city, $state, $postcode, $country, $phonenumber, $password, $permissions, $generalemails, $productemails, $domainemails, $invoiceemails, $supportemails);
     logActivity("Added Contact - User ID: " . $userid . " - Contact ID: " . $contactid);
 } else {
     logActivity("Contact Modified - User ID: " . $userid . " - Contact ID: " . $contactid);
     $oldcontactdata = get_query_vals("tblcontacts", "", array("userid" => $_SESSION['uid'], "id" => $id));
     if ($permissions) {
         $permissions = implode(",", $permissions);
     }
     $table = "tblcontacts";
     $array = array("firstname" => $firstname, "lastname" => $lastname, "companyname" => $companyname, "email" => $email, "address1" => $address1, "address2" => $address2, "city" => $city, "state" => $state, "postcode" => $postcode, "country" => $country, "phonenumber" => $phonenumber, "subaccount" => $subaccount, "permissions" => $permissions, "domainemails" => $domainemails, "generalemails" => $generalemails, "invoiceemails" => $invoiceemails, "productemails" => $productemails, "supportemails" => $supportemails, "affiliateemails" => $affiliateemails);
     if ($password && $password != $aInt->lang("fields", "entertochange")) {
         $array['password'] = generateClientPW($password);
     }
     $where = array("id" => $contactid);
     update_query($table, $array, $where);
     run_hook("ContactEdit", array_merge(array("userid" => $userid, "contactid" => $contactid, "olddata" => $oldcontactdata), $array));
Пример #9
0
<?php

/**
 * Main object.
 * @author Kikapp
 * @version 1.0
 */
$win = new SDPanel();
$win->setCaption("Address Book");
$actionBar = new ActionBar();
$actionBar->setClass("applicationBars");
$mainTable = new Table();
$btn_contact_add = new Button();
$btn_contact_add->setCaption("Add Contact");
$btn_contact_add->onTap(addContact());
$btn_contact_viewAll = new Button();
$btn_contact_viewAll->setCaption("View All Contact");
$btn_contact_viewAll->onTap(viewAllContact());
$input_name = new InputText();
$input_name->setLabelCaption("Name");
$input_lastname = new InputText();
$input_lastname->setLabelCaption("Last Name");
$input_email = new InputEmail();
$input_email->setLabelCaption("E-mail");
$input_phone = new InputPhone();
$input_phone->setLabelCaption("Phone");
$input_work = new InputText();
$input_work->setLabelCaption("Work");
$input_message = new InputText();
$input_message->setLabelCaption("Message");
$mainTable->addControl($input_name, 1, 1);
Пример #10
0
function onGetMessage($mynumber, $from, $id, $type, $time, $name, $body)
{
    $number = ExtractNumber($from);
    if ($number != $GLOBALS['current_contact']) {
        $nickname = findNicknameByPhone($number);
        if ($nickname != '' || $nickname != null) {
            echo " < New message from {$nickname} >";
        } else {
            echo " < New message from {$name} ({$number}) >";
            do {
                echo "\nDo you want to add {$name} ({$number})? add/block/nothing\n";
                echo '> ';
                $option = trim(fgets(STDIN));
            } while ($option != 'add' || $option != 'block' || $option != 'nothing');
            switch ($option) {
                case 'add':
                    echo "\nEnter the nickname/name > ";
                    $nickname = trim(fgets(STDIN));
                    addContact($number, $nickname);
                    $GLOBALS['wa']->sendSync([$number], null, 3);
                    $GLOBALS['wa']->sendPresenceSubscription($number);
                    break;
                case 'block':
                    $blockedContacts = privacySettings($number, 'block');
                    $GLOBALS['wa']->sendSetPrivacyBlockedList($blockedContacts);
                    echo "{$name} ({$number}) is now blocked\n";
                    break;
            }
        }
    }
}
Пример #11
0
<?php

session_start();
include '../common-code/db.php';
addContact();
function addContact()
{
    $conn = dbConnect();
    $name = '';
    $email = '';
    $mobile = '';
    $position = '';
    if (isset($_POST['name'])) {
        $name = $conn->real_escape_string($_POST['name']);
    }
    if (isset($_POST['email'])) {
        $email = $conn->real_escape_string($_POST['email']);
    }
    if (isset($_POST['mobile'])) {
        $mobile = $conn->real_escape_string($_POST['mobile']);
    }
    if (isset($_POST['position'])) {
        $position = $conn->real_escape_string($_POST['position']);
    }
    $sql = "INSERT into contactus(name,position,email,mobile) VALUES('{$name}','{$position}','{$email}','{$mobile}')";
    $result = $conn->query($sql);
    dbDisconnect($conn);
    if ($result) {
        header("location:../contact.php");
    } else {
        echo "Some error occured..:(";
Пример #12
0
function updateContact($user)
{
    $userContactId = $_POST["sid"];
    $fname = $_POST["fname"];
    $lname = $_POST["lname"];
    $email = $_POST["email"];
    $phone = $_POST["phone"];
    $facebook = $_POST["facebook"];
    $linkedin = $_POST["linkedin"];
    $github = $_POST["github"];
    // check if other users are tracking this contact, safe to update if not
    $contactId = getContactIdFromUserContactId($userContactId);
    $trackers = countUsersTrackingContactId($contactId);
    // if other users are tracking this contact, need to make a new contact
    if ($trackers < 2) {
        // safe to update contact
        $query = "update contacts ";
        $query .= "set fname = \"{$fname}\", ";
        $query .= " lname = \"{$lname}\", ";
        $query .= " email = \"{$email}\", ";
        $query .= " phone = \"{$phone}\", ";
        $query .= " facebook = \"{$facebook}\", ";
        $query .= " linkedin = \"{$linkedin}\", ";
        $query .= " github = \"{$github}\" ";
        $query .= "where id = {$contactId}";
        if (preparedStatement($query) !== true) {
            return "error updating contact {$contactId} from uc {$userContactId} {$trackers}";
        } else {
            return true;
        }
    } else {
        // remove old connection
        if (removeUserContact($user, $userContactId) !== true) {
            return "error removing user contact ";
        }
        // add new contact
        if (addContact($fname, $lname, $email, $phone, $facebook, $linkedin, $github) !== true) {
            return "error adding new contact ";
        }
        $contactId = getContactIdFromValues($fname, $lname, $email, $phone, $facebook, $linkedin, $github);
        // connect new contact
        if (addUserContact($user, $contactId) !== true) {
            return "error adding new user contact";
        } else {
            return true;
        }
    }
}
Пример #13
0
 static function handleMessageReceived($mynumber, $from, $id, $type, $time, $name, $body)
 {
     $number = ExtractNumber($from);
     $contact = getUserInfo($number);
     if (!$contact) {
         addContact($number, $name);
         $contact = getUserInfo($number);
         $main_menu = GenieConstants::searchElement(GenieConstants::$MAIN_MENU_CONTEXT, GenieConstants::$REGISTRATION_MENU_CONTEXT, 'subMenu');
         setMessageContext($main_menu, NULL, $contact['phone']);
     }
     //Handle ShortCut in request
     $requestArray = $data = preg_split('/\\s+/', $body);
     if ($requestArray[0][0] == '#') {
         self::handleShortCuts($contact, $requestArray);
         return;
     }
     $context = getMessageContext($number);
     $callBackFunction = 'initializeService';
     if ($context['main_menu'] == -1) {
         self::handleGeneralConversation($body, $context, $contact);
         return;
     }
     if ($context['main_menu'] == 0) {
         if (GenieConstants::searchElement(GenieConstants::$MAIN_MENU_CONTEXT, $body, 'id') != NULL) {
             updateMessageContext($body, NULL, $contact['phone']);
             PubSub::publish(GenieConstants::$MAIN_MENU_CONTEXT[$body]->menuItem, $callBackFunction, $contact);
         } else {
             MessaggingController::sendMessage($contact, GenieConstants::$INVALID_SERVICE);
             MessaggingController::sendMessage($contact, GenieConstants::$MAIN_MENU_STRING);
         }
         return;
     }
     if ($context['main_menu'] != 0 && $context['main_menu'] != 8 && $context['sub_menu'] == NULL) {
         $subMenuKey = GenieConstants::searchElement(GenieConstants::$MAIN_MENU_CONTEXT[$context['main_menu']]->subMenu, $body, 'id');
         $SubMenuDict = GenieConstants::$MAIN_MENU_CONTEXT[$context['main_menu']]->subMenu;
         if ($subMenuKey != NULL) {
             updateMessageContext($context['main_menu'], $body, $contact['phone']);
             $callBackFunction = $SubMenuDict[$subMenuKey]->callBackMethod;
             PubSub::publish(GenieConstants::$MAIN_MENU_CONTEXT[$context['main_menu']]->menuItem, $callBackFunction, $contact);
         } else {
             MessaggingController::sendMessage($contact, GenieConstants::$INVALID_SERVICE);
             PubSub::publish(GenieConstants::$MAIN_MENU_CONTEXT[$context['main_menu']]->menuItem, $callBackFunction, $contact);
         }
         return;
     } else {
         if ($context['main_menu'] != 0 && $context['main_menu'] != 8 && $context['sub_menu'] != NULL) {
             $SubMenuDict = GenieConstants::$MAIN_MENU_CONTEXT[$context['main_menu']]->subMenu;
             $callBackFunction = $SubMenuDict[$context['sub_menu']]->requestServer;
             PubSub::publish(GenieConstants::$MAIN_MENU_CONTEXT[$context['main_menu']]->menuItem, $callBackFunction, $contact, $body);
             return;
         } else {
             if ($context['sub_menu'] != NULL) {
                 $callBackFunction = GenieConstants::$MAIN_MENU_CONTEXT[$context['main_menu']]->subMenu[$context['sub_menu']]->callBackMethod;
             } else {
                 if (GenieConstants::$MAIN_MENU_CONTEXT[$context['main_menu']]->callBackMethod != NULL) {
                     $callBackFunction = GenieConstants::$MAIN_MENU_CONTEXT[$context['main_menu']]->callBackMethod;
                 }
             }
         }
     }
     PubSub::publish(GenieConstants::$MAIN_MENU_CONTEXT[$context['main_menu']]->menuItem, $callBackFunction, $contact, $body);
 }
Пример #14
0
 if ($validate->hasErrors()) {
     $errormessage .= $validate->getHTMLErrorOutput();
 }
 $currency = getCurrency($_SESSION['uid'], $_SESSION['currency']);
 if ($_POST['updateonly']) {
     $errormessage = "";
 }
 if ($ajax && $errormessage) {
     exit($errormessage);
 }
 if (!$errormessage && !$_POST['updateonly']) {
     if (!$_SESSION['uid']) {
         $userid = addClient($firstname, $lastname, $companyname, $email, $address1, $address2, $city, $state, $postcode, $country, $phonenumber, $password, $securityqid, $securityqans);
     }
     if ($contact == "addingnew") {
         $contact = addContact($_SESSION['uid'], $domaincontactfirstname, $domaincontactlastname, $domaincontactcompanyname, $domaincontactemail, $domaincontactaddress1, $domaincontactaddress2, $domaincontactcity, $domaincontactstate, $domaincontactpostcode, $domaincontactcountry, $domaincontactphonenumber);
     }
     $_SESSION['cart']['contact'] = $contact;
     $carttotals = calcCartTotals(true);
     if ($ccinfo == "new" && !$nostore) {
         updateCCDetails($_SESSION['uid'], $cctype, $ccnumber, $cccvv, $ccexpirymonth . $ccexpiryyear, $ccstartmonth . $ccstartyear, $ccissuenum);
     }
     $orderid = $_SESSION['orderdetails']['OrderID'];
     $fraudmodule = getActiveFraudModule();
     if ($CONFIG['SkipFraudForExisting']) {
         $result = select_query("tblorders", "COUNT(*)", array("status" => "Active", "userid" => $_SESSION['uid']));
         $data = mysql_fetch_array($result);
         if ($data[0]) {
             $fraudmodule = "";
         }
     }
/**
 * Simple Contact Management App
 *
 * add.php - Add a new contact
 *
 */
require_once 'functions.php';
session_start();
$error = null;
if (!empty($_POST)) {
    // Handle form submission and redirect to home page
    if (isset($_POST['name']) && isset($_POST['email']) && isset($_POST['phone'])) {
        // Verify nonceToken
        if (isset($_SESSION['nonceToken']) && isset($_POST['nonceToken']) && $_SESSION['nonceToken'] === $_POST['nonceToken']) {
            if (addContact($_POST['name'], $_POST['email'], $_POST['phone'])) {
                header("Location: index.php");
                exit(0);
            } else {
                $error = "Unable to save data in DB";
            }
        } else {
            $error = "Your request has expired - please try again";
        }
    }
} else {
    $nonceToken = md5(microtime() . rand());
    $_SESSION['nonceToken'] = $nonceToken;
}
printHtmlHeader("Add Contact");
if ($error) {
Пример #16
0
<html>
<head>
    <meta charset="UTF-8">
    <title>TIM JUNG - hw5</title>
</head>
<body>
    <?php 
$firstName = $_GET['firstName'];
$lastName = $_GET['lastName'];
$phone = $_GET['phone'];
$age = $_GET['age'];
require 'hw5.inc';
addContact($firstName, $lastName, $phone, $age);
?>
        <p><?php 
echo "{$firstName} {$lastName}";
?>
                was added as your contact.</p>
    <p><a href="main.html">back</a></p>
</body>
</html>