Пример #1
0
function sendChatMessage($link, $chatMessage, $userId, $toUserId = 0)
{
    $chatMessage = esc($chatMessage);
    if (mb_strlen($chatMessage) < 1) {
        return 'message_empty';
    } elseif (mb_strlen($chatMessage) < 3) {
        return 'not_min_message';
    } else {
        if (!getUserLogin($link, $toUserId)) {
            $toUserId = 0;
        }
        mysqli_query($link, "INSERT INTO `chat`(`chat_from_id`, `chat_to_id`,`chat_message`) VALUES ('{$userId}','{$toUserId}','{$chatMessage}')");
        return 'message_send';
    }
}
 $arr_user_login = array();
 $sql = "select nUserId,nCompId,vLogin from sptbl_users where\n\t\tvEmail='" . addslashes($var_fromaddress) . "' AND\n\t\tnCompId IN('" . implode("','", $arr_compid_final) . "')";
 $result = executeSelect($sql, $conn);
 $arr_comp_toregister = array();
 if (mysql_num_rows($result) > 0) {
     while ($row = mysql_fetch_array($result)) {
         $arr_comp_toregister[$row["nUserId"]] = $row["nCompId"];
         $arr_user_login[$row["nUserId"]] = $row["vLogin"];
     }
 }
 $arr_new_user = array();
 $arr_comp_diff = array_diff($arr_compid_final, $arr_comp_toregister);
 foreach ($arr_comp_diff as $key => $val) {
     $var_username = "";
     $var_userlogin = "";
     getUserLogin($var_frommailbox, $val, $var_username, $var_userlogin);
     $var_userpassword = $var_userpassword != "" ? $var_userpassword : getUserPassword($var_fromaddress);
     $sql = "Insert into sptbl_users(nUserId,nCompId,vUserName,vEmail,vLogin,vPassword,dDate,nCSSId)\n\t\t\t\tValues('',\n\t\t\t\t'" . addslashes($val) . "',\n\t\t\t\t'" . addslashes($var_username) . "',\n\t\t\t\t'" . addslashes($var_fromaddress) . "',\n\t\t\t\t'" . addslashes($var_userlogin) . "',\n\t\t\t\t'" . md5($var_userpassword) . "',\n\t\t\t\tnow(),'1')";
     executeQuery($sql, $conn);
     $var_id = mysql_insert_id();
     $arr_comp_toregister[$var_id] = $val;
     $arr_user_login[$var_id] = $var_username;
     $arr_new_user[$var_id] = $var_userpassword;
 }
 foreach ($arr_new as $key => $val) {
     $var_tmp_compid = getCompanyId($val, $total_count);
     $var_tmp_userid = array_search($var_tmp_compid, $arr_comp_toregister);
     $var_userlogin = $arr_user_login[$var_tmp_userid];
     $sql = "insert into sptbl_tickets(nTicketId,nDeptId,vRefNo,nUserId,vUserName,vTitle,tQuestion,\n\t\t\tvPriority,dPostDate,vMachineIP,dLastAttempted)\n\t\t\t\tvalues('','" . $val . "','1','" . $var_tmp_userid . "',\n\t\t\t\t'" . addslashes($var_userlogin) . "',\n\t\t\t\t'" . addslashes($mimedecoder->_mailheader->_headersubject) . "',\n\t\t\t\t'" . addslashes($var_message_main) . "','0',now(),\n\t\t\t\t'" . addslashes($var_machineip) . "',now())";
     executeQuery($sql, $conn);
     $var_insert_id = mysql_insert_id($conn);
Пример #3
0
// Load wp-config so that we can use the fact that the user is logged in.
require_once '../wp-config.php';
include_once '../hp-includes/people_lib.php';
include_once '../hp-includes/user_utils.php';
// current_user is a variable set by Wordpress.
$uid = is_user_logged_in() ? $current_user->ID : 0;
if ($uid == 0) {
    die("You're not logged in");
}
if (getUserLevel($uid) == 0) {
    die("Not enough privileges");
}
// Sanitize the inputs a little bit.
$name = mysql_real_escape_string($_GET['name_all']);
$displayName = mysql_real_escape_string($_GET['display_name']);
$photoUrl = mysql_real_escape_string($_GET['photo_url']);
$person = new Person();
$person->setName($name);
$person->addExtraNames($displayName);
$person->setDisplayName($displayName);
$person->addToDatabaseIfNobody();
// Now also set the image URL.
if ($photoUrl != '') {
    downloadPersonPhoto($person->id, $photoUrl);
}
// Also record this in the moderation queue so we can see who added what.
$ip = $_SERVER['REMOTE_ADDR'];
$userLogin = getUserLogin($uid);
mysql_query("INSERT INTO moderation_queue(type, idperson, value, ip, time)\n   VALUES('add_person', {$person->id}, 'by {$userLogin}', '{$ip}', " . time() . ")");
echo "Persoana X a fost adăugată. " . "Vizitează-le pagina <a href=/?cid=9&id={$person->id} " . "taget=_blank>aici</a>.";
require_once '../_bottom.php';
Пример #4
0
/**
 * Last updated $Date: 2007-04-11 15:47:41 +0100 (Wed, 11 Apr 2007) $
 * by $Author: andybrock $
 *
 * This file is $Revision: 356 $
 * $HeadURL: https://svn.sf.net/svnroot/camranbss/camra/nbss/version2/login/index.php $
 **/
$title = 'Login';
include '../includes/base.php';
include DOCROOT . '/skin/header.php';
$form = new Form('nbssv2login');
$form->class = 'neoAdminForm';
$form->validationerrormsg = 'The following fields must be completed:';
if ($form->submitted && $form->submiterrors == 0) {
    $user = getUserLogin(md5(strtoupper(trim(ltrim($request->get('post', 'membershipno'), '0')))), md5(strtoupper(str_replace(' ', '', $request->get('post', 'postcode')))));
    if ($user !== false) {
        Session::set('user', $user);
        Session::set('welcomed', false);
        getQueryResults('UPDATE ' . $config->get('database', 'tablePrefix') . 'user SET lastlogin='******'YmdHis', time()) . ' WHERE id=' . $user['id']);
        header('Location: ' . $config->get('web', 'root') . '/');
        exit;
    } else {
        $form->submiterrormsg .= 'Invalid membership number, postcode or inactive account.';
    }
}
$form->addFieldsetOpen('Login');
$form->addField('membershipno', 'text', $request->get('post', 'membershipno'));
$form->addLabel('Membership Number');
$form->addFieldValidation('required');
$form->addHelp('Please use the membership number from your CAMRA membership card.');
Пример #5
0
$t = new Smarty();
$t->assign('tag', getTagNameForId($tagid));
$t->assign('description', getTagDescriptionForId($tagid));
$votes = getVotesForTag($room, $year, $tagid, $uid);
$possible = sizeof($votes);
$t->assign('votes', $votes);
$people = getPeopleList($room, $year);
$non_zero_people = array();
$zero_people = array();
for ($i = 0; $i < sizeof($people); $i++) {
    $context = getBeliefContext($room, $year, $uid, $people[$i]['id'], $tagid, $possible, 200);
    foreach ($context as $key => $value) {
        $people[$i][$key] = $value;
    }
    // Since I'm here, fix a few things. A little hacky.
    $people[$i]['link'] = "?cid=9&id=" . $people[$i]['id'];
    $people[$i]['tiny_photo'] = getTinyImgUrl($people[$i]['id']);
    if ($context['yes_cnt'] + $context['no_cnt'] > 0) {
        array_push($non_zero_people, $people[$i]);
    } else {
        array_push($zero_people, $people[$i]);
    }
}
usort($non_zero_people, "beliefCmp");
$t->assign('people', $non_zero_people);
$t->assign('absentees', $zero_people);
$t->assign('room', $room);
$t->assign('year', $year);
$t->assign('tagid', $tagid);
$t->assign('user_login', getUserLogin($uid));
$t->display('compass_show_tag.tpl');
Пример #6
0
function getAllDialogBodyDefinitions()
{
    echo getUserRegistration();
    echo getVendorRegistration();
    echo getUserLogin();
    echo getAdminLogin();
}
Пример #7
0
            $_SESSION['message'] = $message['message_send'];
            if (isset($_GET['pr'])) {
                $urlPartQuest = '?pr=' . $_GET['pr'];
            } else {
                $urlPartQuest = '';
            }
            header("Location: /chat" . $urlPartQuest);
            exit;
        }
    }
    if (isset($_SESSION['message'])) {
        $data['message'] = $_SESSION['message'];
        unset($_SESSION['message']);
    }
    if (isset($_GET['pr'])) {
        $data['chat_messages'] = getChatMessagePr($link, $data['user_id']);
    } else {
        $data['chat_messages'] = getChatMessage($link, $data['user_id']);
    }
    if (isset($_GET['to'])) {
        $data['to_user_id'] = $_GET['to'];
        $data['to_user_name'] = getUserLogin($link, $_GET['to']);
        if ($data['to_user_name']) {
            echo t('_chat_to', $data);
        }
    } else {
        echo t('_chat', $data);
    }
} else {
    header('Location: /login');
}