Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
TimeOutAdmin
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TimeOut
TimeOutAdmin
Commits
b61980c6
Commit
b61980c6
authored
Nov 05, 2019
by
Tobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
guest user login
parent
6892ae7f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
4 deletions
+32
-4
Webservice.php
application/controllers/Webservice.php
+13
-3
Validation_app_model.php
application/models/Validation_app_model.php
+2
-1
Webservice_model.php
application/models/Webservice_model.php
+17
-0
No files found.
application/controllers/Webservice.php
View file @
b61980c6
...
...
@@ -30,9 +30,9 @@ class Webservice extends CI_Controller {
$data
=
$_POST
;
}
if
(
isset
(
apache_request_headers
()[
'Auth'
])
||
isset
(
apache_request_headers
()[
'auth'
]))
{
$this
->
auth_token
=
(
isset
(
apache_request_headers
()[
'Auth'
]))
?
apache_request_headers
()[
'Auth'
]
:
apache_request_headers
()[
'auth'
];
$data
[
'auth_token'
]
=
$this
->
auth_token
;
}
$this
->
auth_token
=
(
isset
(
apache_request_headers
()[
'Auth'
]))
?
apache_request_headers
()[
'Auth'
]
:
apache_request_headers
()[
'auth'
];
$data
[
'auth_token'
]
=
$this
->
auth_token
;
}
$res
=
$this
->
Validation_app_model
->
validation_check
(
$method
,
$data
);
if
(
$res
[
'state'
]
==
1
)
{
$this
->
errorResponse
(
$res
[
'response'
][
'code'
],
$res
[
'response'
][
'message'
]);
...
...
@@ -570,5 +570,15 @@ class Webservice extends CI_Controller {
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
create_guest_user
()
{
$res
=
$this
->
Webservice_model
->
createGuestUser
();
if
(
$res
[
'status'
]
==
'success'
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
}
?>
application/models/Validation_app_model.php
View file @
b61980c6
...
...
@@ -168,7 +168,8 @@ class Validation_app_model extends CI_Model {
'message'
=>
'Total Cost is null or empty'
)
)
)
),
'create_guest_user'
=>
array
()
);
public
function
validation_check
(
$method_name
,
$parms
)
{
...
...
application/models/Webservice_model.php
View file @
b61980c6
...
...
@@ -2039,5 +2039,22 @@ class Webservice_model extends CI_Model {
$this
->
image_lib
->
initialize
(
$config
);
$this
->
image_lib
->
resize
();
}
public
function
createGuestUser
(){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Something went wrong'
,
'code'
=>
'ER10'
);
$status
=
$this
->
db
->
insert
(
'users'
,
array
(
'display_name'
=>
'Guest'
,
'user_type'
=>
'6'
));
if
(
!
$status
||
empty
(
$guest_id
=
$this
->
db
->
insert_id
())){
return
$res
;
}
$guestInfo
=
array
(
'customer_id'
=>
$guest_id
,
'name'
=>
'Guest'
,
'phone_verified'
=>
'1'
);
$status
=
$this
->
db
->
insert
(
'customer'
,
$guestInfo
);
if
(
!
$status
){
return
$res
;
}
$auth_token
=
md5
(
microtime
()
.
rand
());
$this
->
generateAuth
(
$guest_id
,
$auth_token
);
return
array
(
'status'
=>
'success'
,
'data'
=>
array
(
'auth_token'
=>
$auth_token
));
}
}
?>
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