本文整理匯總了PHP中Model_Users::getUserByName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model_Users::getUserByName方法的具體用法?PHP Model_Users::getUserByName怎麽用?PHP Model_Users::getUserByName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Model_Users
的用法示例。
在下文中一共展示了Model_Users::getUserByName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getMysqlConnection
<?php
$root = '../../../..';
require_once $root . '/config/config.php';
require_once $root . '/core/mysql.php';
require_once $root . '/core/models/usersModel.php';
$db = getMysqlConnection();
$userdata = NULL;
if (!isset($_GET['User'])) {
$form = array('username' => '', 'password' => '', 'FK_Group' => '');
} else {
$userdata = Model_Users::getUserByName($db, $_GET['User']);
$form = array('username' => $userdata['username'], 'password' => $userdata['password'], 'FK_Group' => $userdata['FK_Group']);
}
if (isset($_POST['save'])) {
if ($_POST['group'] == 'mitarbeiter') {
$group = '1';
} else {
if ($_POST['group'] == 'administrator') {
$group = '2';
}
}
$form['username'] = $_POST['benutzer'];
$form['password'] = $_POST['passwort'];
$form['FK_Group'] = $group;
if (!isset($_GET['User'])) {
Model_Users::updateUsers($db, $form);
} else {
Model_Users::updateUsers($db, $_GET['User'], $form);
}
}
示例2: indexAction
public function indexAction()
{
ini_set('memory_limit', '4200M');
$this->noViewRenderer(true);
ignore_user_abort(true);
for ($i = 1; $i < 5; $i++) {
$html = @file_get_contents('http://pinterest.com/?page=' . $i);
if ($html) {
$dom = new JO_Html_Dom();
$dom->load($html);
$hrefs = $dom->find('.PinImage');
if ($hrefs) {
foreach ($hrefs as $href) {
$price = 0;
$url = JO_Url_Relativetoabsolute::toAbsolute('http://pinterest.com/?page=' . $i, $href->href);
$html2 = @file_get_contents($url);
if ($html2) {
$dom = new JO_Html_Dom();
$dom->load($html2);
$board = $dom->find('h3.serif a', 0)->innertext;
$image = $dom->find('#pinCloseupImage', 0)->src;
$description = $dom->find('#PinCaption', 0)->innertext;
$description = explode('<', $description);
$description = $description[0];
$from = $dom->find('#PinSource a', 0)->href;
$usernames = $dom->find('#PinnerName a', 0)->innertext;
$avatar = $dom->find('#PinnerImage img', 0)->src;
$username = trim($dom->find('#PinnerName a', 0)->href, '/');
$price_o = $dom->find('.buyable', 0);
if ($price_o) {
$price = $price_o->innertext;
}
$user_id = Model_Users::getUserByName($username, $usernames, $avatar);
if (!$user_id) {
continue;
}
WM_Users::initSession($user_id);
$board_id = Model_Boards::getBoardId(trim($board));
$price_f = 0;
if (preg_match('/([0-9.]{1,})/', $price, $m)) {
$price_f = $m[1];
}
$pin_id = Model_Pins::create(array('board_id' => $board_id, 'description' => htmlspecialchars($description, ENT_QUOTES, 'utf-8'), 'image' => (string) $image, 'price' => (double) $price, 'from' => urldecode($from), 'public' => '1'));
$commm = $dom->find('.PinComments .comment');
if ($commm) {
foreach ($commm as $com) {
$avatar = $com->find('.CommenterImage img', 0)->src;
$usernames = $com->find('.CommenterName', 0)->innertext;
$username = trim($com->find('.CommenterName', 0)->href, '/');
$text = explode('<br />', $com->find('.CommenterMeta', 0)->innertext);
$text = isset($text[1]) ? $text[1] : '';
if ($text) {
$user_id = Model_Users::getUserByName($username, $usernames, $avatar);
if (!$user_id) {
continue;
}
WM_Users::initSession($user_id);
$pin_info = Model_Pins::getPin($pin_id);
Model_Pins::addComment(array('write_comment' => $text, 'pin_id' => $pin_id), $pin_info['latest_comments']);
}
}
sleep(1);
}
sleep(1);
}
}
}
}
}
}