This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Reoder item fields on position | |
$imanager = imanager(); | |
$category = $imanager->getCategory('slug=Users'); | |
$users = $imanager->getItems($category->id); | |
$fieldMapper = new FieldMapper(); | |
foreach($users as $user) | |
{ | |
$fields = $fieldMapper->filterFields('position', 'ASC', (array) $user->fields); | |
foreach($fields as $field) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$userid = 1; | |
$imanager = imanager(); | |
$user = $imanager->getItem('slug=Users', $userid); | |
$fieldMapper = new FieldMapper(); | |
$fields = $fieldMapper->filterFields('position', 'ASC', (array) $user->fields); | |
echo '<h2>User data</h2>'; | |
echo '<table>'; | |
foreach ($fields as $data) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$userid = 1; | |
$imanager = imanager(); | |
$user = $imanager->getItem('slug=Users', $userid); | |
echo '<h2>User data</h2>'; | |
echo '<table>'; | |
foreach ($user->fields as $data) | |
{ | |
echo ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
include('config.php'); | |
include('connect.php'); | |
include('checkuser.php'); | |
$ret = 0; | |
if(isset($_POST['name']) && !empty($_POST['name'])) | |
$ret = checkUser($db); | |
if(isset($_GET['logout'])) | |
logout(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function checkUser($db) | |
{ | |
if(isset($_SESSION['attempt']) && $_SESSION['attempt'] >= MAXIMUM_ATTEMPTS) | |
return false; | |
if(!isset($_POST['name']) || empty($_POST['name'])) | |
return false; | |
if(strlen($_POST['name']) < MINIMUM_NAME || strlen($_POST['name']) > MAXIMUM_NAME) | |
return false; | |
if(!isset($_COOKIE[session_name()])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
include('config.php'); | |
include('connect.php'); | |
$name = isset($_GET['name']) ? $_GET['name'] : ''; | |
function generateSalt() | |
{ | |
$salt = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try | |
{ | |
$db = new PDO('mysql:host='.MYSQL_HOST.';dbname='.MYSQL_DATABASE.';charset=utf8', MYSQL_USER, MYSQL_PASS); | |
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); | |
} catch (Exception $e) | |
{ | |
echo $e->getMessage(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('MYSQL_HOST', 'localhost'); | |
define('MYSQL_USER', '*********'); | |
define('MYSQL_PASS', '**********'); | |
define('MYSQL_DATABASE', 'your_db_name'); | |
define('USERS_TABLE', 'users'); | |
define('AUTH_TABLE', 'auth'); | |
define('MAXIMUM_ATTEMPTS', 10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Tabellenstruktur für Tabelle `auth` | |
-- | |
CREATE TABLE `auth` ( | |
`id` int(10) UNSIGNED NOT NULL, | |
`salt` char(40) CHARACTER SET ascii NOT NULL, | |
`user_name` varchar(25) DEFAULT NULL, | |
`t_point` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myhash = sha1(sha1(Klartextpass) + Random Salt) |