示例#1
0
<?php

require 'setup.php';
require 'lib/common/isValidEmail.php';
require 'lib/common/GeneralResponse.php';
require 'lib/common/GeneralResponseQ.php';
require 'lib/common/XMLResponseQPrinter.php';
//ob_start();
//  echo "Test";
//  header("Location: http://www.php.net");
//  ob_flush();
$output = new GeneralResponseQ();
if (isset($_REQUEST['h']) && !preg_match('/[^0-9a-zA-Z]+/', $_REQUEST['h']) && isset($_REQUEST['email']) && isValidEmail($_REQUEST['email'])) {
    $sql = null;
    if (isset($_REQUEST['iv']) && $_REQUEST['iv']) {
        $sql = 'UPDATE anonymous_users SET validated = 0 WHERE email = \'%s\' AND hash = \'%s\'';
    } else {
        $sql = 'UPDATE anonymous_users SET validated = 1 WHERE email = \'%s\' AND hash = \'%s\'';
    }
    $sql = sprintf($sql, $_REQUEST['email'], $_REQUEST['h']);
    $result = mysql_query($sql);
    if ($result === false) {
        $output->pushMsg(new GeneralResponse('We\'re sorry there was an error when trying to verify your email address. An administrator has been contacted. Please try again later.'), iResponseQ::MSG_TYPE_ERROR);
        $body = 'failed to execute sql \'' . $sql . '\'';
        $body .= ' Db error \'' . mysql_error() . '\'';
        $body .= ' _REQUEST[] = ' . var_export($_REQUEST, true);
        $mail = new phpmailer();
        $mail->From = "*****@*****.**";
        $mail->FromName = "No-reply";
        $mail->Host = "127.0.0.1";
        // specify main and backup server
示例#2
0
<?php

require 'setup.php';
require 'lib/common/GeneralResponse.php';
require 'lib/common/GeneralResponseQ.php';
require 'lib/common/XMLResponseQPrinter.php';
$output = new GeneralResponseQ();
//$output->pushMsg( new GeneralResponse('Something went wrong'), iResponseQ::MSG_TYPE_ERROR );
//$output->pushMsg(new GeneralResponse('Survey Submitted'), iResponseQ::MSG_TYPE_NORMAL);
$sql = null;
$answers = array();
$idList = null;
foreach ($_REQUEST as $key => $value) {
    if (strpos($key, 'ffQ_') !== false) {
        $id = explode('_', $key);
        $id = $id[1];
        if (is_numeric($id)) {
            $answers[$id] = $value;
            if ($idList) {
                $idList .= ',' . $id;
            } else {
                $idList = $id;
            }
        }
    }
}
//$idList = implode(',',array_keys($answers));
$sql = 'SELECT question_id, answerType
        FROM questions q
          JOIN answer_types at ON q.answerType_id = at.answerType_id
        WHERE question_id in (' . $idList . ')';
<?php

require 'setup.php';
require 'lib/common/GeneralResponse.php';
require 'lib/common/GeneralResponseQ.php';
require 'lib/common/XMLResponseQPrinter.php';
//ob_start();
//  echo "Test";
//  header("Location: http://www.php.net");
//  ob_flush();
$output = new GeneralResponseQ();
if (isset($_REQUEST['h']) && !preg_match('/[^0-9a-zA-Z]+/', $_REQUEST['h']) && isset($_REQUEST['cat']) && isset($_REQUEST['u'])) {
    $hash = $_REQUEST['h'];
    $catid = $_REQUEST['cat'];
    $userid = $_REQUEST['u'];
    $sql = null;
    $sql = 'DELETE FROM anonymoususers_newsletterscategories 
            WHERE anonuser_id IN (SELECT anonuser_id FROM Anonymous_Users WHERE hash = \'%s\' AND anonuser_id = %s)
            AND newslettercat_id IN (SELECT newslettercat_id FROM newsletters_categories WHERE newslettercat_id = %s)';
    $sql = sprintf($sql, $hash, $userid, $catid);
    $result = mysql_query($sql);
    if ($result === false) {
        $output->pushMsg(new GeneralResponse('We\'re sorry there was an error when trying to remove your subscription. An administrator has been contacted. Please try again later.'), iResponseQ::MSG_TYPE_ERROR);
        $body = 'failed to execute sql \'' . $sql . '\'';
        $body .= ' Db error \'' . mysql_error() . '\'';
        $body .= ' _REQUEST[] = ' . var_export($_REQUEST, true);
        $mail = new phpmailer();
        $mail->From = "*****@*****.**";
        $mail->FromName = "No-reply";
        $mail->Host = "127.0.0.1";
        // specify main and backup server