function addItem($itemInfo)
{
    if (!isset($itemInfo['name'])) {
        $resp = array("status" => "fail", "reason" => "please send the name of the product");
        return $resp;
    }
    rollAdd('itemsForSale', $itemInfo, FALSE, FALSE, FALSE, FALSE, TRUE);
    $resp = array("status" => "success", "reason" => "item added");
    return $resp;
}
function addItemCol($itemInfo, $userId)
{
    if (!isset($itemInfo['photoName'])) {
        $resp = array("status" => "fail", "reason" => "please send the photoName to add to the collection");
        return $resp;
    }
    if (!isset($itemInfo['userId'])) {
        $resp = array("status" => "fail", "reason" => "please userId to add to the collection");
        return $resp;
    }
    rollAdd('myCollection', $itemInfo, FALSE, FALSE, FALSE, FALSE, TRUE);
    $resp = array("status" => "success", "reason" => "item added");
    return $resp;
}
Esempio n. 3
0
function updateAccount($userInfo)
{
    extract($_REQUEST);
    $exists = dbMassData("SELECT * FROM settings WHERE email = '{$email}'");
    if ($exists == NULL) {
        $resp = array("status" => "fail", 'reason' => "user has wrong credentials");
        return $resp;
    } else {
        session_start();
        $email = $userInfo['email'];
        $userInfo = array("email" => $email) + $userInfo;
        rollAdd('settings', $userInfo, FALSE, FALSE, FALSE, TRUE, TRUE);
        $resp = array("status" => "success", 'reason' => "user info updated");
        return $resp;
    }
}
function createAccount($userInfo)
{
    //echo('creating...');
    if (!isset($userInfo['email'])) {
        $resp = array("status" => "fail", "reason" => "please send the email to create account");
        return $resp;
    }
    if (!isset($userInfo['passwd'])) {
        $resp = array("status" => "fail", "reason" => "please send password to create account");
        return $resp;
    }
    $userInfo['userId'] = generateRandomString();
    $unencrypted = $userInfo['passwd'];
    $userInfo['passwd'] = md5($userInfo['passwd']);
    $email = $userInfo['email'];
    $exists = dbMassData("SELECT * FROM settings WHERE email = '{$email}'");
    if ($exists != NULL) {
        $account = loginUser($email, $unencrypted);
        return $account;
    }
    rollAdd('settings', $userInfo, FALSE, FALSE, FALSE, FALSE, TRUE);
    $resp = array("status" => "success", "reason" => "account created");
    return $resp;
}
Esempio n. 5
0
        $link = explode('"', $linkArr[1]);
        $link = $link[0];
        echo '<br>';
        echo $link;
        echo '<br><br>';
        $id = $link;
        $link = 'http://' . $city . '.craigslist.org/reply/' . $link;
        $contactLink = $link;
        $contactPage = file_get_contents($link);
        $linkArr = explode('readonly="readonly" value="', $contactPage);
        $email = explode('"', $linkArr[1]);
        $email = $email[0];
        echo $email;
        echo '<br><br>';
        $fieldsArr = array('id' => $id, 'email' => $email, 'contactLink' => $contactLink, 'title' => $title, 'info' => $body);
        $source = "craigslist";
        $tableName = 'postings';
        $fieldsArr = $fieldsArr;
        $checkExists = true;
        $print = true;
        $checkAdded = false;
        $updateBool = false;
        $addNewFields = true;
        $exists = dbMassData("SELECT * FROM postings WHERE id ='{$id}'");
        if ($exists == null) {
            if (isset($email)) {
                rollAdd($tableName, $fieldsArr, $checkExists, $print, $checkAdded, $updateBool, $addNewFields);
            }
        }
    }
}
Esempio n. 6
0
<?php

include_once 'db2.php';
include_once 'dbShortcuts.php';
include_once 'emailer.php';
extract($_REQUEST);
if (!isset($siteUrl)) {
    echo $_GET['callback'] . "(" . json_encode(array("result" => "fail", "reason" => "Please send a site URL, idiot!")) . ")";
    return;
}
//get all fields
$elems = $_REQUEST;
echo $_GET['callback'] . '(' . "{'result' : 'success'}" . ')';
//unset variables in array for clean inclusion of just form data
unset($elems['callback']);
//save the email of form recipient before unsetting
$base4Email = $elems['base4Email'];
unset($elems['base4Email']);
//add to db
rollAdd($siteUrl, $elems, false, false, false, false, true);
//send email
$subject = "New form submission from your site";
$htmlContent = "";
foreach ($elems as $key => $value) {
    $htmlContent .= $key . ": " . $value . "<br>";
}
$textContent = str_replace("<br>", "\r\n", $htmlContent);
sendTheMail($base4Email, $subject, $htmlContent, $textContent);