Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dcarfixers
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
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
Tobin
dcarfixers
Commits
b42023fe
Commit
b42023fe
authored
Dec 31, 2018
by
Tobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
daily commit
parent
2e54f5ca
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
171 additions
and
21 deletions
+171
-21
Webservices.php
application/controllers/Webservices.php
+103
-1
generals_helper.php
application/helpers/generals_helper.php
+26
-20
Customer_model.php
application/models/Customer_model.php
+42
-0
tobin_dcarfixers.sql
sql/tobin_dcarfixers.sql
+0
-0
No files found.
application/controllers/Webservices.php
View file @
b42023fe
...
@@ -41,7 +41,7 @@ class Webservices extends CI_Controller {
...
@@ -41,7 +41,7 @@ class Webservices extends CI_Controller {
// $this->last_id = set_log($class, $method, $postdata, $auth);
// $this->last_id = set_log($class, $method, $postdata, $auth);
}
}
// login
//
customer_
login
public
function
customer_login
(){
public
function
customer_login
(){
header
(
'Content-type: application/json'
);
header
(
'Content-type: application/json'
);
$post
=
file_get_contents
(
"php://input"
);
$post
=
file_get_contents
(
"php://input"
);
...
@@ -79,5 +79,107 @@ class Webservices extends CI_Controller {
...
@@ -79,5 +79,107 @@ class Webservices extends CI_Controller {
}
}
echo
json_encode
(
$respArr
);
exit
;
echo
json_encode
(
$respArr
);
exit
;
}
}
// customer_forgot_password
public
function
customer_forgot_password
(){
header
(
'Content-type: application/json'
);
$post
=
file_get_contents
(
"php://input"
);
$postData
=
json_decode
(
$post
,
true
);
$this
->
load
->
model
(
'Customer_model'
);
$respArr
=
array
(
'status'
=>
'0'
,
'message'
=>
'Required Fields are empty.'
);
if
(
empty
(
$postData
)
||
!
isset
(
$postData
[
'email'
])
||
empty
(
$postData
[
'email'
])){
echo
json_encode
(
$respArr
);
exit
;
}
$custResp
=
$this
->
Customer_model
->
genCustForgotPassLink
(
$postData
);
if
(
empty
(
$custResp
)
||
!
isset
(
$custResp
[
'status'
])
||
empty
(
$custResp
[
'status'
])){
echo
json_encode
(
$respArr
);
exit
;
}
if
(
$custResp
[
'status'
]
==
'2'
){
$respArr
[
'status'
]
=
'2'
;
$respArr
[
'message'
]
=
'Invalid Email Address'
;
echo
json_encode
(
$respArr
);
exit
;
}
if
(
$custResp
[
'status'
]
==
'1'
){
/*
MAIL SENT CONFIGARATION
*/
$respArr
[
'status'
]
=
'1'
;
$respArr
[
'message'
]
=
'Password Reset Email has been sent'
;
}
echo
json_encode
(
$respArr
);
exit
;
}
// customer_registration
public
function
customer_registration
(){
header
(
'Content-type: application/json'
);
$post
=
file_get_contents
(
"php://input"
);
$postData
=
json_decode
(
$post
,
true
);
$this
->
load
->
model
(
'Customer_model'
);
$respArr
=
array
(
'status'
=>
'0'
,
'message'
=>
'Something went wrong.'
);
if
(
empty
(
$postData
)){
echo
json_encode
(
$respArr
);
exit
;
}
$err
=
0
;
$msg
=
''
;
if
(
!
isset
(
$postData
[
'email'
])
||
empty
(
$postData
[
'email'
])){
$err
=
1
;
$msg
=
'Provide a valid Email ID'
;
}
else
if
(
!
isset
(
$postData
[
'password'
])
||
empty
(
$postData
[
'password'
])){
$err
=
1
;
$msg
=
'Provide a Password'
;
}
else
if
(
!
isset
(
$postData
[
'first_name'
])
||
empty
(
$postData
[
'first_name'
])){
$err
=
1
;
$msg
=
'Provide valid Name'
;
}
else
if
(
!
isset
(
$postData
[
'last_name'
])
||
empty
(
$postData
[
'last_name'
])){
$err
=
1
;
$msg
=
'Provide valid Name'
;
}
if
(
$err
==
1
){
$respArr
[
'message'
]
=
$msg
;
echo
json_encode
(
$respArr
);
exit
;
}
if
(
isset
(
$postData
[
'phone'
])
&&
empty
(
$postData
[
'phone'
])){
unset
(
$postData
[
'phone'
]);
}
unset
(
$postData
[
'promocode'
]);
$custResp
=
$this
->
Customer_model
->
customer_registration
(
$postData
);
if
(
empty
(
$custResp
)
||
!
isset
(
$custResp
[
'status'
])
||
empty
(
$custResp
[
'status'
])){
echo
json_encode
(
$respArr
);
exit
;
}
if
(
$custResp
[
'status'
]
==
'2'
){
$respArr
[
'status'
]
=
'2'
;
$respArr
[
'message'
]
=
'Email Address already in use'
;
echo
json_encode
(
$respArr
);
exit
;
}
if
(
$custResp
[
'status'
]
==
'1'
){
$custResp
=
$this
->
Customer_model
->
checkCustomerLogin
(
$postData
);
if
(
empty
(
$custResp
)
||
!
isset
(
$custResp
[
'status'
])
||
empty
(
$custResp
[
'status'
])){
echo
json_encode
(
$respArr
);
exit
;
}
if
(
$custResp
[
'status'
]
==
'1'
){
$respArr
[
'data'
]
=
$custResp
[
'data'
];
$respArr
[
'status'
]
=
'1'
;
$respArr
[
'message'
]
=
'Success'
;
echo
json_encode
(
$respArr
);
exit
;
}
}
echo
json_encode
(
$respArr
);
exit
;
}
}
}
?>
?>
application/helpers/generals_helper.php
View file @
b42023fe
...
@@ -67,27 +67,32 @@
...
@@ -67,27 +67,32 @@
return
$decode
;
return
$decode
;
}
}
function
getLocationLatLng
(
$location
=
''
){
function
getLocationLatLng
(
$location
=
''
){
$settings
=
getSettings
();
$settings
=
getSettings
();
if
(
empty
(
$location
)
||
empty
(
$settings
)
||
!
isset
(
$settings
[
'google_api_key'
])
||
if
(
empty
(
$location
)
||
empty
(
$settings
)
||
!
isset
(
$settings
[
'google_api_key'
])
||
empty
(
$gKey
=
$settings
[
'google_api_key'
])){
empty
(
$gKey
=
$settings
[
'google_api_key'
])){
return
0
;
return
0
;
}
}
$thisObj
=
&
get_instance
();
$thisObj
=
&
get_instance
();
$locData
=
file_get_contents
(
"https://maps.google.com/maps/api/geocode/json?address="
.
$locData
=
file_get_contents
(
"https://maps.google.com/maps/api/geocode/json?address="
.
urlencode
(
$location
)
.
"&sensor=false&key="
.
$gKey
);
urlencode
(
$location
)
.
"&sensor=false&key="
.
$gKey
);
if
(
empty
(
$locData
))
if
(
empty
(
$locData
))
return
0
;
return
0
;
$loc_data
=
json_decode
(
$locData
);
$loc_data
=
json_decode
(
$locData
);
if
(
empty
(
$loc_data
)
||
!
isset
(
$loc_data
->
status
)
||
$loc_data
->
status
!=
'OK'
)
if
(
empty
(
$loc_data
)
||
!
isset
(
$loc_data
->
status
)
||
$loc_data
->
status
!=
'OK'
)
return
0
;
return
0
;
$locArr
[
'lat'
]
=
$loc_data
->
{
'results'
}[
0
]
->
{
'geometry'
}
->
{
'location'
}
->
{
'lat'
};
$locArr
[
'lat'
]
=
$loc_data
->
{
'results'
}[
0
]
->
{
'geometry'
}
->
{
'location'
}
->
{
'lat'
};
$locArr
[
'lng'
]
=
$loc_data
->
{
'results'
}[
0
]
->
{
'geometry'
}
->
{
'location'
}
->
{
'lng'
};
$locArr
[
'lng'
]
=
$loc_data
->
{
'results'
}[
0
]
->
{
'geometry'
}
->
{
'location'
}
->
{
'lng'
};
if
(
empty
(
$locArr
[
'lat'
])
||
empty
(
$locArr
[
'lng'
]))
if
(
empty
(
$locArr
[
'lat'
])
||
empty
(
$locArr
[
'lng'
]))
return
0
;
return
0
;
return
$locArr
;
return
$locArr
;
}
}
function
generate_unique
()
{
$unique
=
md5
(
uniqid
(
time
()
.
mt_rand
(),
true
));
return
$unique
;
}
?>
?>
\ No newline at end of file
application/models/Customer_model.php
View file @
b42023fe
...
@@ -108,5 +108,46 @@ class Customer_model extends CI_Model {
...
@@ -108,5 +108,46 @@ class Customer_model extends CI_Model {
}
}
return
$respArr
;
return
$respArr
;
}
}
function
genCustForgotPassLink
(
$userLogData
=
array
()){
$respArr
=
array
(
'status'
=>
0
);
if
(
empty
(
$userLogData
)){
return
$respArr
;
}
$result
=
$this
->
db
->
get_where
(
'customers'
,
array
(
'email'
=>
$userLogData
[
'email'
],
'status'
=>
'1'
));
if
(
empty
(
$result
)
||
$result
->
num_rows
()
<
1
||
empty
(
$custData
=
$result
->
row
())){
$respArr
[
'status'
]
=
2
;
return
$respArr
;
}
$mail_id
=
$custData
->
email
;
$cust_id
=
$custData
->
customer_id
;
$unique_id
=
generate_unique
();
$status
=
$this
->
db
->
insert
(
'forgot_password_link'
,
array
(
'user_type'
=>
'1'
,
'user_id'
=>
$cust_id
,
'token'
=>
$unique_id
));
if
(
$status
){
$respArr
[
'status'
]
=
1
;
}
return
$respArr
;
}
function
customer_registration
(
$userData
=
array
()){
$respArr
=
array
(
'status'
=>
0
);
if
(
empty
(
$userData
)){
return
$respArr
;
}
$result
=
$this
->
db
->
get_where
(
'customers'
,
array
(
'email'
=>
$userData
[
'email'
],
'status'
=>
'1'
));
if
(
!
empty
(
$result
)
&&
$result
->
num_rows
()
>=
1
){
$respArr
[
'status'
]
=
2
;
return
$respArr
;
}
$userData
[
'password'
]
=
md5
(
$userData
[
'password'
]);
$status
=
$this
->
db
->
insert
(
'customers'
,
$userData
);
if
(
$status
){
$respArr
[
'status'
]
=
1
;
}
return
$respArr
;
}
}
}
?>
?>
\ No newline at end of file
sql/tobin_dcarfixers.sql
View file @
b42023fe
This diff is collapsed.
Click to expand it.
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