Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
retypos-server
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eterfund
retypos-server
Commits
bcdfd187
Commit
bcdfd187
authored
Mar 13, 2017
by
Георгий Попов
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add user model
parent
8df86e84
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
User.php
new_cp/application/models/User.php
+43
-0
No files found.
new_cp/application/models/User.php
0 → 100644
View file @
bcdfd187
<?php
/**
* User model
*
* @author george popoff <ambulance@etersoft.ru>
*/
class
User
extends
CI_Model
{
/**
* Retrieve user by given username
*
* @param type $username
* @return User array
*/
public
function
getUser
(
$username
)
{
$query
=
$this
->
db
->
query
(
"SELECT * FROM users WHERE login = '"
.
$username
.
"' LIMIT 1"
);
return
$query
->
row
();
}
/**
* Apply hash function to the password
*
* @param password
* @return type
*/
public
function
hashPassword
(
$password
)
{
$password
=
strval
(
$password
);
if
(
$this
->
config
->
item
(
'pass'
))
{
$pass_key
=
$this
->
config
->
item
(
'pass'
);
if
(
isset
(
$pass_key
[
'key_1'
])
&&
isset
(
$pass_key
[
'key_2'
])
&&
isset
(
$pass_key
[
'key_3'
]))
{
return
md5
(
$pass_key
[
'key_2'
]
.
$password
.
$pass_key
[
'key_3'
]
.
$pass_key
[
'key_1'
]);
}
else
{
return
md5
(
$password
.
'56uyfgh'
);
}
}
else
{
return
md5
(
$password
.
'56uyfgh'
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment