Beispiel #1
0
<?php

require_once "../include/includes.php";
//setContentType("text","plain");
$template = getParam("template", "signup");
$send = getParamBoolean("send");
$to = reqParam("to");
//$to = "*****@*****.**";
$message = createEmailFromTemplate($template, $to);
$email_config = getConfig("_email");
echoJsVar("email_config");
$sentDate = date("Y-m-d H:i:s");
echo "Sent: {$sentDate}<br/>";
$sentDate = md5($sentDate);
echo "MD5: {$sentDate}<br/>";
echo "To: {$to}<br/>\n";
if ($message) {
    echo $message->getSubject() . "\n";
    echo $message->getBody();
}
if ($send) {
    $result = sendEmail($message);
    echoJsVar("result");
}
Beispiel #2
0
<?php

require_once "../include/includes.php";
setContentType("text", "plain");
session_start();
//receive file and other form fields
//move file to temp location:  $BASE_IMAGE_DIR/$username/$filename
//load, resize, crop image.
//do not keep original file
//insert into upload table.
//What if user/filename already exists? can user reuse existing image, select from uploads?
//response: image metadata from EXIF and url.
//echo jsValue($fpConfig, true, true);
$username = fpCurrentUsername();
$upload_id = reqParam("upload_id");
debugVar("username", true);
debug("Request", $_REQUEST);
debug("GET request", $_GET);
debug("POST request", $_POST);
debug("POST files", $_FILES, true);
if (!$username) {
    return errorMessage("Not logged in.");
}
if (!$upload_id) {
    return errorMessage("No File deleted.");
}
$db = new SqlManager($fpConfig);
if ($db->offline) {
    return errorMessage("DB offline. No File deleted.");
}
//if profile filters( Q_ ) : demographic
Beispiel #3
0
<?php

require_once "../include/includes.php";
setContentType("text", "plain");
session_start();
$db = new SqlManager($fpConfig);
$postJson = getJsonPostData();
$action = reqParam("action");
if (!$action) {
    $action = @$postJson["action"];
}
$username = fpCurrentUsername();
$response = array();
switch ($action) {
    case "saveForm":
        //save form: insert,update,delete user_answers for this user
        $user_answers = $postJson["formData"];
        $result = saveAnswers($db, $username, $user_answers);
        $response = array("answers" => count($user_answers), "result" => $result);
        break;
    case "form_questions":
    default:
        $response["questions"] = getFormQuestions($db, $_REQUEST);
        if ($username) {
            $response["user_answers"] = $db->selectWhere(array("table" => "user_answer", "username" => $username));
        }
}
$db->disconnect();
$response["queries"] = $db->getLog();
$response["time"] = getTimer(true);
echo jsValue($response);
Beispiel #4
0
<?php

require_once "../include/includes.php";
setContentType("text", "plain");
session_start();
$db = new SqlManager($fpConfig);
$postData = $_POST;
if (!$postData) {
    $postData = getJsonPostData();
}
//$postData = array("action" => "login", "username" => "amy", "password" => "koKoBird" );
debugVar("postData");
$action = $postData ? @$postData["action"] : reqParam("action");
debugVar("action");
$response = array();
// POST: {action: login, username:, password: md5}, return user if successful or null if login fail
// POST: {action: register, username, email, password: md5, first_name, last_name}, return user if successful or null if login already exists.
// POST: {action: sendResetEmail, email}, return success or error if user not found
// POST: {action: resetPassword, email, key, password}, return success or error if user not found or invalid key or empty password
// GET/POST  {}		return current session["user"];
// GET/POST  {action: logout} unset session["user"], return empty or null user object;
// response: {success: true, user: {}, message: }
//compare MD5 password in db with MD5 password submitted
function validatePassword($dbUser, $postData)
{
    if (!$dbUser || !isset($postData["password"])) {
        return false;
    }
    return $dbUser["password"] == $postData["password"];
}
switch ($action) {