function GetUsers() { $this->init(); $userList = $this->client->GetUsers(); $this->CheckForError($userList); foreach ($userList as $user) { $luser = new Lan_users(); $luser->id = $user->id; if (0 == $luser->count()) { $luser->username = $user->username; $luser->id = $user->id; $luser->password = $user->password; $luser->email = $user->email; $luser->role = $user->role; $luser->clan = $user->clan; $luser->insert(); echo "insert"; } else { $luser->username = $user->username; $luser->id = $user->id; $luser->password = $user->password; $luser->email = $user->email; $luser->role = $user->role; $luser->clan = $user->clan; $luser->update(); echo "update"; } } }
function CheckLogin($user, $pass) { $Frontend = new FrontEnd(); //Manually pull updated info $uid = $Frontend->findUserID($user); if (streq($uid, '0')) { return false; } $Frontend->pullUserInfo($uid); $dbuser = new Lan_users(); $dbuser->username = $dbuser->escape($user); $dbuser->password = $pass; $dbuser->find(); return 0 != $dbuser->count(); }
public function pullUserInfo($id) { $sql = "SELECT user_id, user_name, user_password, user_email from e107_user where user_id = " . $id; $res = $this->getQuerySingleResult($sql); if ($res) { $luser = new Lan_users(); $luser->user_id = $id; if (0 == $luser->count()) { $luser->username = $res[1]; $luser->user_id = $res[0]; $luser->password = $res[2]; $luser->email = $res[3]; $luser->clan = $this->getProfileField($id); $luser->insert(); } else { $luser->username = $res[1]; $luser->user_id = $res[0]; $luser->password = $res[2]; $luser->email = $res[3]; $luser->clan = $this->getProfileField($id); $luser->update(); } return true; } return false; }
<?php include 'core.php'; include "libs/phprpc/phprpc_client.php"; $client = new PHPRPC_Client('http://127.0.0.1/work/obsidian/rpc.php?key=' . Config::$intpass); $client->setTimeout(5); $client->setEncryptMode(3); try { print_r($client->CheckLogin('kayomani', '2dbf2c8b82421856957e4469a7834d86')); return; $userList = $client->GetUsers(); foreach ($userList as $user) { $luser = new Lan_users(); $luser->id = $user->id; if (0 == $luser->count()) { $luser->username = $user->username; $luser->id = $user->id; $luser->password = $user->password; $luser->email = $user->email; $luser->role = $user->role; $luser->clan = $user->clan; $luser->insert(); echo "insert"; } else { $luser->username = $user->username; $luser->id = $user->id; $luser->password = $user->password; $luser->email = $user->email; $luser->role = $user->role; $luser->clan = $user->clan; $luser->update();
$form->delete(); header('Location: intranet.php?p=timetable'); die; } else { if (streq($_POST["submitBtn"], "Update")) { //Update or switch type $game = new Lan_games(); if (isset($_POST["game"]) && 1 == $game->get($game->escape($_POST["game"]))) { $master->Smarty->assign("image", "images/games/" . $game->picture); $logoAssigned = true; } else { $master->Smarty->assign("image", "images/games/other.png"); } setupLanTime("when", strtotime($form->occurs), $master->Smarty); $userlist = array(); $user = new Lan_users(); $attendees = new Lan_attendees(); $lanid = getCurrentLID(); $user->query("SELECT user_id,username FROM {$user->__table} WHERE {$user->__table}.user_id IN (SELECT user_id FROM {$attendees->__table} WHERE `lan_id` = '{$lanid}') ORDER BY user_id"); while ($user->fetch()) { $userlist[] = clone $user; } $master->Smarty->assign("userlist", $userlist); } else { //Save if (0 == strlen($form->id)) { if (CheckPermission("timetable", "add event")) { $form->insert(); } else { $master->AddError("You do not have permissions to add events."); break;
<?php if (isset($_GET["uid"])) { $user = new Lan_users(); if ($user->get(GETSafe("uid"))) { $user->updateSteamData(); $user->update(); if (strlen($user->avatar) == 0) { $user->avatar = Config::$webPath . "images/other.png"; } $master->Smarty->assign("steamdata", $user->getSteamData()); $master->Smarty->assign("user", $user); //Find if attending this lan $attendance = new Lan_attendees(); $attendance->user_id = $user->user_id; $attendance->lan_id = getCurrentLID(); $master->Smarty->assign("attending", $attendance->count() != 0); //Get seat if ($attendance->count() != 0) { $seat = new lan_seats(); $seat->user_id = $user->user_id; $seat->lan_id = getCurrentLID(); $seat->find(); if ($seat->fetch()) { $master->Smarty->assign("seat", $seat); } } //Find if arrived $arrivals = new Lan_arrivals(); $arrivals->user_id = $user->user_id; $arrivals->lan_id = getCurrentLID();
<?php include 'editprofile.logic.php'; $userid = getCurrentUID(); if (isset($_GET["uid"])) { $userid = GETSafe("uid"); } if (streq("0", $userid)) { $master->AddError("You must login to edit your profile!"); } else { $user = new Lan_users(); if ($user->get($userid)) { $master->Smarty->assign("theuser", $user); } else { $master->AddError("Unknown user!"); } }
<?php if (isset($_POST["Update"])) { $frontend = new FrontEnd(); $user = new Lan_users(); $id = POSTSafe("userid"); if ($user->get($id)) { $currentpassword = $frontend->encryptPassword(POSTSafe("currentpass")); if (streq($currentpassword, $user->password)) { if (strlen(POSTSafe("newpass")) > 0) { $user->password = $frontend->encryptPassword(POSTSafe("newpass")); } $user->steamprofile = POSTSafe("steamprofile"); $user->updateSteamData(); $user->update(); //Reset session if we are changing the current user, so we make sure the session has the latest data. if (streq(getCurrentUID(), $user->user_id)) { startSession($user->user_id, $user->username); } } else { $master->AddWarning("Incorrect current password!"); } } }
<?php $userlist = array(); $user = new Lan_users(); $attendees = new Lan_attendees(); $arrived = new Lan_arrivals(); $seat = new Lan_seats(); $filter = "current"; if (isset($_GET["filter"])) { $filter = $_GET["filter"]; $master->Smarty->assign("filter", $filter); } switch ($filter) { default: case 'current': $lanid = getCurrentLID(); $user->query("SELECT *, {$arrived->__table}.aid as arrived,{$seat->__table}.seat_name, {$seat->__table}.id as seat_id, {$user->__table}.user_id as userid FROM {$user->__table} LEFT JOIN {$arrived->__table} on {$arrived->__table}.user_id " . " = {$user->__table}.user_id LEFT JOIN {$seat->__table} on {$seat->__table}.user_id = {$user->__table}.user_id WHERE {$seat->__table}.lan_id = '{$lanid}' AND {$user->__table}.user_id IN (SELECT user_id FROM {$attendees->__table} WHERE `lan_id` = '{$lanid}') ORDER BY {$user->__table}.username"); while ($user->fetch()) { if (strlen($user->arrived) == 0) { $user->arrived = "No"; } else { $user->arrived = "Yes"; } //Pull tickets $sold = new Lan_addons_sold(); $addon = new Lan_addons_groups(); $sold->whereAdd("user_id = {$user->user_id}"); //$sold->user_id ; $sold->lan_id = getCurrentLID(); $sold->joinAdd($addon); $sold->find();
function startSession($id, $username) { setCurrentUser($id); $_SESSION['username'] = $username; // Store User IP $user = new Lan_users(); if (0 != $user->get($id)) { $user->ip = $_SERVER['REMOTE_ADDR']; $_SESSION['steamprofile'] = $user->steamprofile; $_SESSION['profilepic'] = $user->smallavatar; $user->update(); } SetupGroups(); }
<?php $text = "Pulling steam data<br />"; $user = new Lan_users(); $user->find(); while ($user->fetch()) { $user->updateSteamData(); $user->update(); $text .= "Updating steam data for {$user->username} <br />"; } $master->Smarty->assign("_text", $text);