示例#1
0
function sendGCM($message, $db)
{
    // Replace with real BROWSER API key from Google APIs
    $apiKey = "Your API Key";
    // Replace with real client registration IDs
    $registrationIDs = getUsers($db);
    // Message to be sent
    //$message = "x";
    // Set POST variables
    $url = 'https://android.googleapis.com/gcm/send';
    $fields = array('registration_ids' => $registrationIDs, 'data' => array("message" => $message));
    $headers = array('Authorization: key=' . $apiKey, 'Content-Type: application/json');
    // Open connection
    $ch = curl_init();
    // Set the url, number of POST vars, POST data
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
    // Execute post
    $result = curl_exec($ch);
    // Close connection
    curl_close($ch);
    return $result;
}
function getUserRanking($idSelected)
{
    $users = getUsers();
    $ranking = initialRanking();
    $result = runQuery('SELECT userId, matchId, coteResult, coteScore, round,
      bet.scoreDomicile AS betScoreDomicile, 
      bet.scoreExterieur AS betScoreExterieur, 
      result.scoreDomicile AS resultScoreDomicile,
      result.scoreExterieur AS resultScoreExterieur
      FROM bet 
      INNER JOIN result WHERE id IN (' . implode(',', $idSelected) . ') AND bet.matchId = result.id');
    foreach ($result as $row) {
        //Variable sql
        $userId = intval($row['userId']);
        $coteResult = floatval($row['coteResult']);
        $coteScore = floatval($row['coteScore']);
        $round = intval($row['round']);
        $betScoreDomicile = intval($row['betScoreDomicile']);
        $betScoreExterieur = intval($row['betScoreExterieur']);
        $resultScoreDomicile = intval($row['resultScoreDomicile']);
        $resultScoreExterieur = intval($row['resultScoreExterieur']);
        if ($resultScoreDomicile >= 0) {
            //Variable de calcul
            $scorePoint = 0;
            if ($betScoreDomicile == $resultScoreDomicile && $betScoreExterieur == $resultScoreExterieur) {
                $scorePoint = $coteScore;
            }
            $betPoint = 0;
            if ($betScoreDomicile > $betScoreExterieur && $resultScoreDomicile > $resultScoreExterieur || $betScoreDomicile == $betScoreExterieur && $resultScoreDomicile == $resultScoreExterieur || $betScoreDomicile < $betScoreExterieur && $resultScoreDomicile < $resultScoreExterieur) {
                $betPoint = $coteResult;
            }
            $ranking[$userId]['betCount']++;
            $ranking[$userId]['betWon'] += $betPoint > 0 ? 1 : 0;
            $ranking[$userId]['betPoint'] += $betPoint;
            $ranking[$userId]['scoreWon'] += $scorePoint > 0 ? 1 : 0;
            $ranking[$userId]['scorePoint'] += $scorePoint;
            $ranking[$userId]['globalPoint'] += $betPoint + $scorePoint;
        }
    }
    $sortedranking = array_values($ranking);
    usort($sortedranking, 'compareUserPoint');
    $currentRanking = 0;
    $currentScore = 0;
    $index = 0;
    foreach ($sortedranking as $row) {
        $index++;
        if ($currentRanking == 0) {
            $currentRanking = 1;
            $currentScore = $row['globalPoint'];
        }
        if ($currentScore != $row['globalPoint']) {
            $currentRanking = $index;
            $currentScore = $row['globalPoint'];
        }
        $ranking[$row['userId']]['rank'] = $currentRanking;
    }
    $ranking = array_values($ranking);
    usort($ranking, 'compareUserRanking');
    return $userRanking = array('ranking' => $ranking);
}
示例#3
0
function deleteUser($id)
{
    $fileFunctions = new FileFunctions();
    $users = getUsers();
    unset($users[$id]);
    $fileFunctions->serializeUsers($users);
    //var_dump($fileFunctions);
}
/**
 * login mechanism
 */
function loginUser()
{
    // find user in the db
    $user = getUsers()[$_POST['email']];
    // compare hashes; set cookie; and refresh the page
    if (md5($_POST['pass']) === $user['pass']) {
        setcookie('proxy', base64_encode($user['email']) . '.' . base64_encode($user['pass']), false, '/');
        header('Location: ' . $_SERVER['REQUEST_URI']);
    } else {
        die(file_get_contents('login/login_error.html'));
    }
}
示例#5
0
function deleteUser($id)
{
    $sql = "DELETE FROM users WHERE id=:id";
    try {
        $db = getConnection();
        $stmt = $db->prepare($sql);
        $stmt->bindParam("id", $id);
        $stmt->execute();
        getUsers();
    } catch (PDOException $e) {
        echo '{"error":{"text":' . $e->getMessage() . '}}';
    }
}
示例#6
0
<?php

/**
 * Created by ChenguangBai
 * Date: 2016/3/3
 */
include_once "../dao/DBHelper.php";
include_once "../dao/getUsers.php";
$page = $_GET['page'];
$maxSize = $_GET['maxSize'];
$result = getUsers($page - 1, $maxSize);
$users = array();
while ($row = mysql_fetch_array($result)) {
    $temp = array();
    $temp['uid'] = $row['uid'];
    $temp['userName'] = $row['username'];
    $temp['firstName'] = $row['firstName'];
    $temp['lastName'] = $row['lastName'];
    array_push($users, $temp);
}
echo json_encode($users);
            KalturaLog::log('Saving partner [' . $partner->getId() . '] with account owner kuser ID [' . $partner->getAccountOwnerKuserId() . ']');
            $partner->save();
        } else {
            KalturaLog::log('DRY RUN - records are not being saved: ');
            KalturaLog::log('New user_login_data with the following parameters: ');
            KalturaLog::log(print_r($new_login_data, true));
            KalturaLog::log('Newkuser with the following parameters (login_data_id unknown): ');
            KalturaLog::log(print_r($new_kuser, true));
            KalturaLog::log('DRY RUN - saving partner [' . $partner->getId() . '] with account owner kuser ID [' . $partner->getAccountOwnerKuserId() . ']');
        }
        file_put_contents($lastUserFile, $lastUser);
    }
    kuserPeer::clearInstancePool();
    PartnerPeer::clearInstancePool();
    UserLogindataPeer::clearInstancePool();
    $users = getUsers($lastUser, $userLimitEachLoop);
}
$msg = 'Done - ' . ($dryRun ? 'DRY RUN!' : 'REAL RUN!');
KalturaLog::log($msg);
echo $msg;
function getUsers($lastUser, $userLimitEachLoop)
{
    adminKuserPeer::clearInstancePool();
    $c = new Criteria();
    $c->add(adminKuserPeer::ID, $lastUser, Criteria::GREATER_THAN);
    $c->addAscendingOrderByColumn(adminKuserPeer::ID);
    $c->setLimit($userLimitEachLoop);
    adminKuserPeer::setUseCriteriaFilter(false);
    $users = adminKuserPeer::doSelect($c);
    adminKuserPeer::setUseCriteriaFilter(true);
    return $users;
示例#8
0
文件: ajax.php 项目: progervlad/utils
            $query_upd = $db->query("UPDATE `users` SET `photo`= null,`modiff`=NOW(),`modiff_uid`='{$admin_id}' WHERE `uid`={$uid}");
            if ($query_upd) {
                $result['success'] = true;
                unset($result['msg']);
            }
            break;
        case 'getUserInfo':
            require_once "../vendor/autoload.php";
            // Twig инициализация
            Twig_Autoloader::register();
            $loader = new Twig_Loader_Filesystem("../templates/users");
            // Twig папка с шаблонами
            $twig = new Twig_Environment($loader, array("cache" => ""));
            // Twig no cache
            $uid = $_POST['user_id'];
            $query_info = "SELECT\r\n                                    u.`uid`,\r\n                                    DATE_FORMAT(u.`modiff`,'%d.%m.%Y %H:%i:%s') as `modiff`,\r\n                                    (SELECT CONCAT(`lastname`,' ',`firstname`) FROM users WHERE `uid`=u.`modiff_uid`) AS `modiff_user`,\r\n                                    u.`status_id`,\r\n                                    (SELECT `name` FROM users_statuses WHERE users_statuses.`id`=u.`status_id`) AS `status`,\r\n                                    u.`lastname`,\r\n                                    u.`firstname`,\r\n                                    u.`middlename`,\r\n                                    u.`login`,\r\n                                    u.`login_ae`,\r\n                                    u.`pass`,\r\n                                    u.`photo`,\r\n                                    u.`phone` as `tel`,\r\n                                    u.`skud`,\r\n                                    u.`email`,\r\n                                    u.`comment`,\r\n                                    u.`area_id`,\r\n                                    (SELECT `name` FROM areas WHERE areas.`id`=u.`area_id`) AS `area`,\r\n                                    (SELECT `name` FROM depts WHERE depts.`id`=u.`dept_id`) AS `dept`,\r\n                                    (SELECT `name` FROM posts WHERE posts.`id`=u.`post_id`) AS `post`,\r\n                                    (SELECT `name` FROM organizations WHERE organizations.`id`=u.`organization_id`) AS `organization`,\r\n                                    (SELECT `workstation` FROM `sessions_users` WHERE `id`='{$uid}') as `workstation_id`,\r\n                                    (SELECT `ip` FROM `workstations` WHERE `id`=`workstation_id`) as `logon_ip`,\r\n                                    (SELECT `name` FROM `workstations` WHERE `id`=`workstation_id`) as `workstation`,\r\n                                    (SELECT `domain` FROM `sessions_users` WHERE `id`='{$uid}') as `domain`,\r\n                                    (SELECT `time` FROM `sessions_users` WHERE `id`='{$uid}') as `logon_time`\r\n                                        FROM users AS u WHERE u.`uid`='{$uid}'";
            if ($query_info_res = $db->query($query_info)) {
                $user_data = $db->fetch_assoc($query_info_res);
            }
            $user_data['users'] = getUsers();
            $user_data['permissions'] = getPermissions($admin_login["uid"], $user_data['users']);
            $result['user_info'] = $twig->render('user_info.twig', $user_data);
            break;
    }
    /*  Возвращаем результат также в виде JSON-объекта.
     *  В случае безошибочного получения результата,
     *  Делаем $result['success'] = true;
     *  Остальные параметры - опциональные
     *  */
    print_r(json_encode($result));
}
示例#9
0
<?php

include_once 'include/view-helper.php';
// Recupère les utilisateurs dans la bdd
$users = getUsers();
head();
?>
<h1>Utilisateurs</h1>
<table>
    <tr>
        <th>#</th>
        <th>Nom</th>
        <th>Prénom</th>
        <th>Pseudo</th>
        <th>Action</th>
    </tr>
    <?php 
foreach ($users as $user) {
    echo '<tr>';
    $td = '<td>%s</td>';
    // On va l'utiliser plusieurs fois, donc on le stocke
    $uid = $user['user_id'];
    // Les données
    echo sprintf($td, $uid);
    echo sprintf($td, $user['user_name']);
    echo sprintf($td, $user['user_firstname']);
    echo sprintf($td, $user['user_username']);
    $link = '<a href="%s?id=' . $uid . '">%s</a> ';
    // Les liens
    $links = sprintf($link, 'show-user.php', 'Détail');
    // S'il s'agit de l'utilisateur courant ou d'un admin
示例#10
0
<?php

include '../include/webzone.php';
if (is_admin() && $GLOBALS['demo_mode'] != 1) {
    unset($_SESSION['ygp_fb_box']);
    $user_id = $_GET['id'];
    $type = 1;
    $users = getUsers(array('user_id' => $user_id, 'type' => $type));
    if (count($users) > 0) {
        $u1 = new MySqlTable();
        $sql = 'DELETE FROM ' . $GLOBALS['db_table']['users'] . ' WHERE user_id="' . $u1->escape($user_id) . '" AND type="' . $type . '"';
        $u1->executeQuery($sql);
    }
}
header('Location: ../');
示例#11
0
{
    $tr = array("А" => "A", "Б" => "B", "В" => "V", "Г" => "G", "Д" => "D", "Е" => "E", "Ё" => "E", "Ж" => "ZH", "З" => "Z", "И" => "I", "Й" => "Y", "К" => "K", "Л" => "L", "М" => "M", "Н" => "N", "О" => "O", "П" => "P", "Р" => "R", "С" => "S", "Т" => "T", "У" => "U", "Ф" => "F", "Х" => "H", "Ц" => "TS", "Ч" => "CH", "Ш" => "SH", "Щ" => "SCH", "Ъ" => "", "Ы" => "YI", "Ь" => "", "Э" => "E", "Ю" => "YU", "Я" => "YA", "а" => "a", "б" => "b", "в" => "v", "г" => "g", "д" => "d", "е" => "e", "ё" => "e", "ж" => "zh", "з" => "z", "и" => "i", "й" => "y", "к" => "k", "л" => "l", "м" => "m", "н" => "n", "о" => "o", "п" => "p", "р" => "r", "с" => "s", "т" => "t", "у" => "u", "ф" => "f", "х" => "h", "ц" => "ts", "ч" => "ch", "ш" => "sh", "щ" => "sch", "ъ" => "y", "ы" => "yi", "ь" => "", "э" => "e", "ю" => "yu", "я" => "ya");
    return strtr($str, $tr);
}
function generate_password($length)
{
    $pass = "";
    $arr = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'v', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'U', 'V', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9');
    for ($i = 0; $i < $length; $i++) {
        $index = rand(0, count($arr) - 1);
        // Случайный индекс массива
        $pass .= $arr[$index];
    }
    return $pass;
}
$users = getUsers(true);
foreach ($users as $id => $user) {
    $users[$id]["permissions"] = 33;
    $users[$id]["login"] = mb_strtolower(translit(mb_substr($user["firstname"], 0, 1, "UTF-8") . $user["lastname"]));
    $users[$id]["login_ae"] = mb_strtoupper(mb_substr($user["firstname"], 0, 1, "UTF-8") . mb_substr($user["middlename"], 0, 1, "UTF-8") . $user["lastname"], "UTF-8");
    $users[$id]["email"] = $users[$id]["login"] . "@megacorp.com";
    $users[$id]["password"] = generate_password(8);
    $query = "UPDATE users SET\r\n        `login`='" . $users[$id]["login"] . "',\r\n        `login_ae`='" . $users[$id]["login_ae"] . "',\r\n        `pass`='" . $users[$id]["password"] . "',\r\n        `email`='" . $users[$id]["email"] . "'\r\n            WHERE `uid`={$id}";
    //    echo "\n\n";
    $query_upd = $db->query($query);
    if ($query_upd) {
        echo 1;
    }
}
//print_r($users);
print_r($db->error());
示例#12
0
                 // add user to db
                 $result = addUser($post);
                 if (!$result) {
                     $data = 'Tekrar deniyiniz!';
                     header('HTTP/1.1 405 Reset Content');
                     Output::error($data);
                 } else {
                     $data = getUser($result);
                     header('HTTP/1.1 201 Created');
                     Output::success($data);
                 }
             }
             // get users
         } else {
             if ($_SERVER['REQUEST_METHOD'] == 'GET') {
                 $data = getUsers();
                 header('HTTP/1.1 200 OK');
                 Output::success($data);
             } else {
                 header('HTTP/1.1 405 Method Not Allowed');
                 header('Allow: GET, POST');
                 Output::error('Method not exist');
             }
         }
     }
     break;
 case 'login':
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $post = json_decode(file_get_contents("php://input"), true);
         // die(var_dump($post));
         // TODO:: Validate post
示例#13
0
<?php

include '_php/functions.php';
?>
<!DOCTYPE html>
<html>
<head>
	<title>The Guru Coder - Tutorial 2 How to code a PHP Connection Class</title>
	<link rel="stylesheet" href="_style/main.css" />
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
	<script src="_scripts/functions.js"></script>
</head>	
<body>

	<div id="container">
	
		<?php 
notification();
?>
	
		<h1>The Guru Coder</h1>
		<h2>Tutorial 2 - Code a PHP Connection Class</h2>
		
		<?php 
getUsers();
?>
		
	</div>
	
</body>
</html>
示例#14
0
    while ($stmt->fetch()) {
        $results[$i]['id'] = $id;
        $results[$i]['username'] = $username;
        $results[$i]['email'] = $email;
        $results[$i]['firstname'] = $firstname;
        $results[$i]['lastname'] = $lastname;
        $results[$i]['role'] = $role;
        $results[$i]['date_created'] = $date_created;
        $results[$i]['is_valid'] = $is_valid;
        $i++;
    }
    $stmt->close();
    $mysqli->close();
    return $results;
}
$users = getUsers($DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE);
?>
<html>
<head>
    <title>List Users</title>
    <?php 
include 'includes/head.php';
?>
</head>
<body>
<section>
    <div class="row">
        <div class="large-12 columns">
            <a href="dashboard.php">Home</a>
            <h1>Users</h1>
            <a href="user-add.php">Add User</a>
示例#15
0
文件: index.php 项目: ramant15/ektimo
function undeleteUser()
{
    global $error;
    global $obj_smarty;
    $arr_submit = array(array('uid', 'int', true, ''));
    $frm_submitted = validate_var($arr_submit);
    if (User::isAdminUser($frm_submitted['uid'])) {
        $bln_success = User::undeleteUser($frm_submitted['uid']);
        if ($bln_success) {
            $obj_smarty->assign('msg', 'User is back again');
        }
        $arr_users = getUsers();
        $obj_smarty->assign('users', $arr_users);
        $obj_smarty->assign('active', 'users');
    } else {
        $obj_smarty->assign('error', 'NO rights to undelete this user');
    }
    $obj_smarty->display(FULLCAL_DIR . '/view/user_panel.tpl');
    exit;
}
示例#16
0
文件: dbInit.php 项目: orloc/miniFace
<?php

$app = (require_once __DIR__ . '/app.php');
$db = $app['db'];
$faker = \Faker\Factory::create();
// Add some users
$db->query(getUserQuery($db, $faker));
// pseudo-randomly get friends for each user
$users = generateFriends(getUsers($db));
generatePosts($db, $users, $faker);
$q = getUpdateFriendsQuery($users);
$db->query($q);
function generatePosts($db, array $users, $faker)
{
    $sql = "INSERT INTO posts (status, user_id, created_at) VALUES ";
    $values = [];
    foreach ($users as $u) {
        for ($i = 0; $i < 4; $i++) {
            $p = $db->quote($faker->realText(45));
            $now = $db->quote(Date('Y-m-d H:i:s'));
            $values[] = "({$p}, {$u['id']}, {$now})";
        }
    }
    $sql .= implode(', ', $values);
    $db->query($sql);
}
function getUpdateFriendsQuery(array $users)
{
    $sql = "INSERT INTO user_friends (friending_user_id, friended_user_id) VALUES ";
    $valStr = [];
    foreach ($users as $u) {
示例#17
0
if (isset($_POST['submit'])) {
    addUser(['email' => $_POST['email']], $conn);
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title></title>
</head>
<body>
  welcome
  <ul>     
<?php 
foreach (getUsers($conn) as $user) {
    ?>
      <li> <?php 
    echo $user->email;
    ?>
</li>
    <?php 
}
?>
  </ul>    
<form method="post">
      <input type="email" name="email"> 
     <input type="submit" name="submit" value="Add User">
    </form>
</body>
</html>
示例#18
0
     break;
 case 12:
     //创建批量用户
     var_dump(createUsers(array(array("username" => "zhangsan", "password" => "123456"), array("username" => "lisi", "password" => "123456"))));
     break;
 case 13:
     //重置用户密码
     var_dump(resetPassword("zhangsan", "123456"));
     break;
 case 14:
     //获取单个用户
     var_dump(getUser("zhangsan"));
     break;
 case 15:
     //获取批量用户---不分页(默认返回10个)
     var_dump(getUsers());
     break;
 case 16:
     //获取批量用户----分页
     $cursor = readCursor("userfile.txt");
     var_dump(getUsersForPage(10, $cursor));
     break;
 case 17:
     //删除单个用户
     var_dump(deleteUser("zhangsan"));
     break;
 case 18:
     //删除批量用户
     var_dump(deleteUsers(2));
     break;
 case 19:
示例#19
0
<?php
	define('ROOT', '../../..');
	include ROOT . '/lib/includeForAdmin.php';

	requireMembership();
	$userInformation = getUsers();

	$config = new Settings;

	$feedURL = isset($_GET['feedURL'])?$_GET['feedURL']:'';
	$feedId = isset($_GET['feedId'])?$_GET['feedId']:'';

	$verifyMode = isset($_GET['verifyMode']) && $_GET['verifyMode'] == 'true' && !empty($feedURL) ? true : false;

	if(isset($_POST['feedURL']) && !empty($_POST['feedURL'])) { 
		
		if($userInformation['is_accepted'] == 'y') {
			$add_user_error = false;

			$group = isset($_POST['group']) ? $_POST['group'] : '0';
			$visibility = isset($_POST['isVisible']) ? 'y' : 'n';
			$filterType = isset($_POST['useFilter']) ? $_POST['useFilter'] : 'tag';
			$filter = $filterType&&isset($_POST['feedFilter'])?$_POST['feedFilter']:'';
			$addUser = isset($_POST['addUser']) ? $_POST['addUser'] : '******';
			$username = isset($_POST['username']) ? $_POST['username'] : '';
			if($addUser=='-1' && empty($username)) $addUser = '******'; 

			if($addUser == '-1') {
				// 회원 추가
				$password = substr(md5(mktime()), 0, 10);
				$name = _f('임시 비밀번호 : %1', $password);
示例#20
0
if (isTemporary($certid) !== false) {
    die("You are using a temporary device and cannot manage your profile.");
}
$devs = getUserDevices($curusr);
$currentF = getMinFactors($curusr);
$numdevs = count($devs);
$numactivedevs = 0;
$devsbyid = array();
//Figure out how many active devs I have and make them indexable by certid
foreach ($devs as $dev) {
    $devsbyid[$dev["certid"]] = $dev;
    if ($dev["active"] === 1 and $dev['expires'] === '9999-01-01 00:00:00') {
        $numactivedevs += 1;
    }
}
$userdetails = getUsers($curusr, 1, true)[0];
//Get user details
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (!passesCSRFcheck()) {
        die("Failed CSRF check. Cookies must be enabled for this site to work.");
    }
    header('Location: profile');
    // Avoid refresh warnings
    //Deleting a certificate. This doesn't require multi-factor auth. I suppose you could change that, but it's not as critical.
    if ($_POST['action'] == 'revoke') {
        if ($curusr === NULL) {
            die("invalid certificate");
        }
        if ($_POST["certid"] == $certid) {
            die("You can't delete your current certificate. You can only delete other devices.");
        }
示例#21
0
            foreach ($board->sharedUser as $user) {
                if ($user->defaultBoard == $data->boardId) {
                    $user->defaultBoard = null;
                    R::store($user);
                }
            }
            R::trashAll($board->xownLane);
            R::trashAll($board->xownCategory);
            R::trash($board);
            R::exec('DELETE from board_user WHERE board_id = ?', [$data->boardId]);
            $jsonResponse->addAlert('success', 'Removed board ' . $board->name . '.');
            $actor = getUser();
            logAction($actor->username . ' removed board ' . $board->name, $before, null);
        }
        $jsonResponse->addBeans(getBoards());
        $jsonResponse->users = R::exportAll(getUsers());
    }
    $app->response->setBody($jsonResponse->asJson());
});
$app->post('/autoactions', function () use($app, $jsonResponse) {
    $data = json_decode($app->environment['slim.input']);
    if (validateToken(true)) {
        $board = R::load('board', $data->boardId);
        if ($board->id) {
            $autoAction = R::dispense('autoaction');
            $autoAction->triggerId = $data->triggerId;
            $autoAction->secondaryId = $data->secondaryId;
            $autoAction->actionId = $data->actionId;
            $autoAction->color = $data->color;
            $autoAction->categoryId = $data->categoryId;
            $autoAction->assigneeId = $data->assigneeId;
示例#22
0
                echo "<div class=\"progress-bar progress-bar-success\" role=\"progressbar\" style=\"min-width: 2em; width: {$whats_left}%\">&#36;{$current_balance}</div>\n";
            } else {
                echo "<div class=\"progress-bar progress-bar-danger\" role=\"progressbar\" style=\"min-width: 2em; width: {$winnings_p}%\">&#36;{$current_balance}</div>\n";
            }
            echo "</div>\n";
        }
        //echo "</div>";
    } else {
        echo "<p>Season Standings will be available after the end of this week.</p>";
    }
    echo "</div>\n";
    //calculateWinnings($users,$weeks,$wins,$anty)
}
//--End Function
// get all users from mysql db
$users = getUsers($db, $this_group_id);
$last_week = $current_week - 1;
$weekly_results_title = "Current Week Results <small>({$current_season_year} {$current_season_type} Week {$current_week})</small>";
$season_results_title = "{$this_season_year} Season Standings <small>(Through {$current_season_year} {$current_season_type} Week {$last_week})</small>";
// Accordion style
//echo '
//<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
echo '
        <div class="panel panel-default">
            <div class="panel-heading" id="headingOne">
                <h4 class="panel-title">
                    <a role="button" data-toggle="collapse" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                    ' . $weekly_results_title . '
                    </a>
                </h4>
            </div>
示例#23
0
<?php

include_once './functions/database_logic.php';
include_once './functions/user_logic.php';
session_start();
$ip = get_client_ip();
$nick = $_SESSION['nick'];
$email = $_SESSION['email'];
$role = getRole($nick);
if (isset($_GET['accepted'])) {
    $accepted = $_GET['accepted'];
    if (strcmp($accepted, "no") == 0) {
        if (isset($nick)) {
            if ($role == "admin") {
                $noAceptados = getUsers($accepted);
                if (!is_null($noAceptados)) {
                    echo "<table align=center>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td><p>Usuario</p></td>\n\t\t\t\t\t\t\t\t\t\t<td><p>Aceptado</p></td>\n\t\t\t\t\t\t\t\t\t\t<td><p>Petición de Baja</p></td>\n\t\t\t\t\t\t\t\t\t\t<td><p>Validar</p></td>\n\t\t\t\t\t\t\t\t\t</tr>";
                    foreach ($noAceptados as $user) {
                        $myUser = $user['nick'];
                        $accepted = $user['accepted'];
                        $dropReq = $user['dropRequest'];
                        echo "<tr>\n\t\t\t\t\t\t\t\t\t\t<td>{$myUser}</td>\n\t\t\t\t\t\t\t\t\t\t<td><p>{$accepted}</p></td>\n\t\t\t\t\t\t\t\t\t\t<td><p>{$dropReq}</p></td>\n\t\t\t\t\t\t\t\t\t\t<td><button class='Basic Fancy' name='aceptar' onClick='accept(\"{$myUser}\");'>&#10003</button></a></td>\n\t\t\t\t\t\t\t\t\t  </tr>";
                    }
                    echo "</table>";
                } else {
                    echo "No hay usuarios pendientes de aceptación.";
                }
            }
        }
    }
}
示例#24
0
function manageUsers($action, $array)
{
    // Try to read the old XML file
    $users_array = getUsers();
    // What must we do?
    switch ($action) {
        // Add some users
        case 'add':
            foreach ($array as $array_user => $array_password) {
                $users_array[$array_user] = genStrongHash($array_password);
            }
            break;
            // Remove some users
        // Remove some users
        case 'remove':
            foreach ($array as $array_user) {
                // Not the last user?
                if (count($users_array) > 1) {
                    unset($users_array[$array_user]);
                }
            }
            break;
    }
    // Regenerate the XML
    $users_xml = '';
    foreach ($users_array as $users_name => $users_password) {
        $users_xml .= "\n" . '    <user name="' . stripslashes(htmlspecialchars($users_name)) . '" password="******" />';
    }
    // Write the main configuration
    writeXML('conf', 'users', $users_xml);
}
示例#25
0
                if (is_array($result)) {
                    $message = json_encode($result);
                }
                $message_id = '';
            }
            //History update
            $u1 = new MySqlTable();
            $sql = 'INSERT INTO ' . $GLOBALS['db_table']['history'] . ' (type, user_id, name, result, message_id, created) VALUES 
			("1", "' . $u1->escape($fb_user_id) . '", "' . $u1->escape($name) . '", "' . $u1->escape($message) . '",
			"' . $u1->escape($message_id) . '", "' . $created . '")';
            $u1->executeQuery($sql);
        }
        echo $nb_fb_updates . " Facebook updates\n";
    }
    if ($twt_ids != '') {
        $users = getUsers(array('type_id' => 2));
        $tokensTab = array();
        for ($i = 0; $i < count($users); $i++) {
            $tokensTab[$users[$i]['user_id']]['token'] = $users[$i]['token'];
            $tokensTab[$users[$i]['user_id']]['token_secret'] = $users[$i]['token_secret'];
            $tokensTab[$users[$i]['user_id']]['username'] = $users[$i]['username'];
        }
        $t1 = new Twt_box();
        $twt_idsTab = explode(',', $twt_ids);
        $nb_twt_updates = 0;
        for ($i = 0; $i < count($twt_idsTab); $i++) {
            $twt_user_id = $twt_idsTab[$i];
            $token = $tokensTab[$twt_user_id]['token'];
            $token_secret = $tokensTab[$twt_user_id]['token_secret'];
            $username = $tokensTab[$twt_user_id]['username'];
            //update
示例#26
0
#!/usr/bin/env php
<?php 
function getUsers($group)
{
    $json = json_decode(file_get_contents("epitechGroups/" . $group . ".json"));
    if (isset($json->users)) {
        return json_encode($json->users);
    }
    return json_encode(array());
}
$users = getUsers("epitech_2016");
echo $users;
示例#27
0
		<?php 
} catch (Exception $e) {
    echo $e->getMessage();
}
//Get current customer
if (isset($_POST['next_customer'])) {
    try {
        $result = deQueueUser($conn, $_SESSION['id']);
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}
if (isset($_GET['id'])) {
    $_SESSION['id'] = $_GET['id'];
    //Get list of all people in the queue
    $queue_users = getUsers($conn, $_SESSION['id']);
    // foreach($queue_users as $queue_user){
    ?>
				 <div class="demo-content mdl-color--white mdl-shadow--4dp content mdl-color-text--grey-800 mdl-cell mdl-cell--8-col" style="margin-top:20px;">
				<table class="mdl-data-table mdl-js-data-table mdl-data-table--selectable mdl-shadow--2dp" width="100%" style="left: 30%;">
				  <thead>
				    <tr>
				      <th class="mdl-data-table__cell--non-numeric">ID</th>
				      <th>Queue ID</th> <?php 
    ?>
				      <th>Position</th> <?php 
    ?>
<?php?>
				    </tr>
				  </thead>
				  <tbody>
示例#28
0
文件: index.php 项目: rw00/tutorme
        <div id="main-content">
            <h4>Users Info</h4>
            <a href="#users-info" class="show-more-content">Show Content</a>
            <div class="more-content">
                <table class="table table-bordered table-condensed">
                    <tr>
                        <th>User ID</th>
                        <th>First Name</th>
                        <th>Last Name</th>
                        <th>Email</th>
                        <th>Gender</th>
                        <th>Account Type</th>
                        <th>Edit User</th>
                    </tr>
                <?php 
$users_info = getUsers();
foreach ($users_info as $user) {
    ?>
                    <tr>
                        <td><?php 
    echo $user["user_id"];
    ?>
</td>
                        <td><?php 
    echo $user["first_name"];
    ?>
</td>
                        <td><?php 
    echo $user["last_name"];
    ?>
</td>
function browseUsers()
{
    // Get the users
    $array = getUsers();
    // Odd/even marker
    $marker = 'odd';
    // Echo the browsing HTML code
    foreach ($array as $user => $password) {
        // Filter the username
        $user = htmlspecialchars($user);
        // Output the code
        echo '<div class="one-browse ' . $marker . ' user manager-images"><span>' . $user . '</span><input type="checkbox" name="admin_' . md5($user) . '" value="' . $user . '" /><div class="clear"></div></div>';
        // Change the marker
        if ($marker == 'odd') {
            $marker = 'even';
        } else {
            $marker = 'odd';
        }
    }
}
示例#30
0
									<option value="YE">Yemen</option>
									<option value="ZM">Zambia</option>
									<option value="ZW">Zimbabwe</option>
								 </select>
                              </a>
							  <a href="#" data-toggle="tooltip" title="Select the Api Key" class="pull-right" style="margin:0 5px;<?php 
if (!isAdmin($user)) {
    echo "display:none;";
}
?>
">
								 <select class="form-control input-sm" id="apikey" style="margin:0 5px; max-width: 150px;">
									<option value="">All API Keys</option>
									<?php 
echo '<option value="' . $user['apikey'] . '">' . $user['firstname'] . ' ' . $user['lastname'] . ' - ' . $user['apikey'] . '</option>';
$users = getUsers($user['id']);
foreach ($users as $u) {
    echo '<option value="' . $u['apikey'] . '">' . $u['firstname'] . ' ' . $u['lastname'] . ' - ' . $u['apikey'] . '</option>';
}
?>
								 </select>
                              </a>
							  <a href="#" data-toggle="tooltip" title="Select the Browser Name" class="pull-right" style="margin:0 5px;">
								 <select class="form-control input-sm" id="browser" style="margin:0 5px; max-width: 150px;">
									<option value="">All Browsers</option>
									<?php 
$stats = new Statistics();
$browsers = $stats->getBrowsers();
foreach ($browsers as $browser) {
    echo '<option value="' . $browser['browser_name'] . '">' . $browser['browser_name'] . '</option>';
}