fix
This commit is contained in:
@@ -23,6 +23,50 @@
|
|||||||
#include "function_members.h"
|
#include "function_members.h"
|
||||||
#include "jubabox_session.h"
|
#include "jubabox_session.h"
|
||||||
|
|
||||||
|
long medTMemberLogin(CVars in, CVars &out) {
|
||||||
|
long ret = PHP_API_BAD_PARAM;
|
||||||
|
|
||||||
|
try {
|
||||||
|
REQ_STRING(in, "username", 2, 49, "(.*)");
|
||||||
|
REQ_STRING(in, "password", 2, 49, "(.*)");
|
||||||
|
const char * loc = getenv("REMOTE_ADDR");
|
||||||
|
ret = load_db_record(out, "SELECT UPPER( md5( now()::text) ) AS sessionid,m.*,mp.*,m.id AS member_id,mp.id AS member_profile_id FROM members m \
|
||||||
|
LEFT JOIN members_profile mp ON mp.member_id = m.id \
|
||||||
|
WHERE m.status=1 AND LOWER(m.username)=LOWER('%s') AND m.password= md5('%s')", in["username"].c_str(), in["password"].c_str());
|
||||||
|
if (ret && out["member_id"].Long() > 0) {
|
||||||
|
// remove all existing session
|
||||||
|
pgsql_exec("DELETE FROM members_session WHERE member_id=%ld ", out["member_id"].Long());
|
||||||
|
// Create New Session Now
|
||||||
|
if (out["member_id"].Long() > 0) {
|
||||||
|
if (SessionCheck(out["member_id"].Long(), out["sessionid"].c_str(), 1) > 0) {
|
||||||
|
|
||||||
|
out["stauts"] = "OK";
|
||||||
|
/*LOAD THE SESSION INTO OUT now */
|
||||||
|
load_db_record(out, "SELECT session FROM members_session WHERE member_id=%lu ORDER BY id DESC LIMIT 1", out["member_id"].Long());
|
||||||
|
member_email_calls(in["action"].Long(), in, out);
|
||||||
|
//===============================================================================================================================
|
||||||
|
pgsql_query("UPDATE members SET last_login = now() WHERE id = %lu", out["member_id"].Long());
|
||||||
|
// account_email(ACCOUNT_LOGIN_ALERT,out,out); // ALERT CUSTOMER OF LOGIN
|
||||||
|
ret = PHP_LOGIN_OK;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
out["status"] = "Session check failed";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
out["status_message"] = "Invalid Username/Password";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (bad_parameter) {
|
||||||
|
logfmt(logINFO, "ERROR CALL long medTMemberLogin(CVars in, CVars &out)");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
long serviceCost(long service_id, long discount_rate);
|
long serviceCost(long service_id, long discount_rate);
|
||||||
|
|
||||||
long medTrMemberTransportById(CVars in, CVars &out) {
|
long medTrMemberTransportById(CVars in, CVars &out) {
|
||||||
@@ -277,48 +321,7 @@ long getServiceDetail(long service_id, CVars &out) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
long medTMemberLogin(CVars in, CVars &out) {
|
|
||||||
long ret = PHP_API_BAD_PARAM;
|
|
||||||
|
|
||||||
try {
|
|
||||||
REQ_STRING(in, "username", 2, 49, "(.*)");
|
|
||||||
REQ_STRING(in, "password", 2, 49, "(.*)");
|
|
||||||
const char * loc = getenv("REMOTE_ADDR");
|
|
||||||
ret = load_db_record(out, "SELECT UPPER( md5( now()::text) ) AS sessionid,m.*,mp.*,m.id AS member_id,mp.id AS member_profile_id FROM members m \
|
|
||||||
LEFT JOIN members_profile mp ON mp.member_id = m.id \
|
|
||||||
WHERE m.status=1 AND LOWER(m.username)=LOWER('%s') AND m.password= md5('%s')", in["username"].c_str(), in["password"].c_str());
|
|
||||||
if (ret && out["member_id"].Long() > 0) {
|
|
||||||
// remove all existing session
|
|
||||||
pgsql_exec("DELETE FROM members_session WHERE member_id=%ld ", out["member_id"].Long());
|
|
||||||
// Create New Session Now
|
|
||||||
if (false) {
|
|
||||||
//if (SessionCheck(out["member_id"].Long(), out["sessionid"].c_str(), 1) > 0) {
|
|
||||||
|
|
||||||
|
|
||||||
out["stauts"] = "OK";
|
|
||||||
/*LOAD THE SESSION INTO OUT now */
|
|
||||||
load_db_record(out, "SELECT session FROM members_session WHERE member_id=%lu ORDER BY id DESC LIMIT 1", out["member_id"].Long());
|
|
||||||
member_email_calls(in["action"].Long(), in, out);
|
|
||||||
//===============================================================================================================================
|
|
||||||
pgsql_query("UPDATE members SET last_login = now() WHERE id = %lu", out["member_id"].Long());
|
|
||||||
// account_email(ACCOUNT_LOGIN_ALERT,out,out); // ALERT CUSTOMER OF LOGIN
|
|
||||||
ret = PHP_LOGIN_OK;
|
|
||||||
} else {
|
|
||||||
out["status"] = "Session check failed";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
out["status_message"] = "Invalid Username/Password";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} catch (bad_parameter) {
|
|
||||||
logfmt(logINFO, "ERROR CALL long medTMemberLogin(CVars in, CVars &out)");
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -546,7 +546,7 @@ $(window).on("load", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if ($(window).width() > 1200 && !$("body").hasClass("menu-collapsed")) {
|
if ($(window).width() > 1200 && !$("body").hasClass("menu-collapsed")) {
|
||||||
tour.start()
|
//tour.start()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tour.cancel()
|
tour.cancel()
|
||||||
|
|||||||
@@ -22,15 +22,19 @@ class Auth extends Start_Controller {
|
|||||||
|
|
||||||
$data["page_title"] = "";
|
$data["page_title"] = "";
|
||||||
$data["username"] = $username; //"auxsupport";
|
$data["username"] = $username; //"auxsupport";
|
||||||
$data["password"] = "may12002";
|
$data["password"] = $password;
|
||||||
|
$out = [];
|
||||||
$this->jubabox_webapi(USER_LOGIN, $data, $out);
|
$this->jubabox_webapi(USER_LOGIN, $data, $out);
|
||||||
//print_r( $data );
|
//print_r( $data );
|
||||||
//print_r( $out );
|
//print_r( $out );
|
||||||
if ( count($out) > 0 && isset($out[0]) ){
|
if ( count($out) > 0 && isset($out["session"]) ){
|
||||||
$this->getSessionData($out[0], $session_data); // just for testing
|
print_r( $out );
|
||||||
|
//$this->getSessionData($out[0], $session_data); // just for testing
|
||||||
|
|
||||||
$this->buildUserSession(PHP_API_OK,$session_data);
|
$this->buildUserSession(PHP_API_OK,$out);
|
||||||
$valid_login = true;
|
$valid_login = true;
|
||||||
|
$this->session->set_flashdata('in',$out);
|
||||||
|
redirect("page/index");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -45,6 +49,34 @@ class Auth extends Start_Controller {
|
|||||||
$this->load->view('home/view_login');
|
$this->load->view('home/view_login');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
.916 SQL [12418]: Found rows: 0
|
||||||
|
- 18:20:16.916 SQL [12418]: Found rows: 0
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: added=2019-10-10 10:43:55.26967
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: created=
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: email=ameye@chiefsoft.com
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: firstname=Olu
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: id=
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: last_login=2019-10-10 17:55:23.835444
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: lastname=Amey
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: loc=
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: member_id=1
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: member_profile_id=
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: mypage=oluamey
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: password=8ef852e9c900de50c6e9d004f3463686
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: phone=
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: result=ECHO BACKEND
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: session=2AB29AC8698D9F9F7EBCB28A1FE41568
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: sessionid=2AB29AC8698D9F9F7EBCB28A1FE41568
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: status=1
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: stauts=OK
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: updated=
|
||||||
|
- 18:20:16.916 INFO [12418]: RET: username=ameye@chiefsoft.com
|
||||||
|
- 18:20:16.918 INFO [12418]: JUBABOX is stopping...
|
||||||
|
- 18:20:16.918 DEBUG [12418]: Closing database connection
|
||||||
|
- 18:20:16.918 SQL [12418]: pgsql_close()
|
||||||
|
*/
|
||||||
|
|
||||||
public function forgotpass() {
|
public function forgotpass() {
|
||||||
$this->index();
|
$this->index();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,14 +6,21 @@ class Page extends Member_Controller {
|
|||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->load->view('members/view_page');
|
$this->load->view('members/view_page');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function forgotpass(){
|
public function email(){
|
||||||
$this->index();
|
$this->index();
|
||||||
}
|
}
|
||||||
public function register(){
|
public function chat(){
|
||||||
$this->index();
|
$this->index();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function todo(){
|
||||||
|
$this->index();
|
||||||
|
}
|
||||||
|
public function calendar(){
|
||||||
|
$this->index();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,9 +51,11 @@ class JUB_Controller extends CI_Controller {
|
|||||||
|
|
||||||
protected function jubabox_webapi($action, $in, &$out) {
|
protected function jubabox_webapi($action, $in, &$out) {
|
||||||
$this->load->model('backend_model');
|
$this->load->model('backend_model');
|
||||||
$in["action"] = $action;
|
$in["action"] = $action;
|
||||||
$in["pid"] = 100;
|
$in["pid"] = 100;
|
||||||
return $this->backend_model->jubabox_api($in, $out);
|
$ret = $this->backend_model->jubabox_api($in, $out);
|
||||||
|
//echo $ret;
|
||||||
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatedMesage($msgType, $theMessage) {
|
function formatedMesage($msgType, $theMessage) {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class Start_Controller extends JUB_Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function buildUserSession($ret, $out) {
|
protected function buildUserSession($ret, $out) {
|
||||||
|
|
||||||
//session_destroy();
|
//session_destroy();
|
||||||
@@ -29,12 +30,10 @@ class Start_Controller extends JUB_Controller {
|
|||||||
$_SESSION['firstname'] = $out["firstname"]; // $ret->firstname;
|
$_SESSION['firstname'] = $out["firstname"]; // $ret->firstname;
|
||||||
$_SESSION['lastname'] = $out["lastname"]; // $ret->lastname;
|
$_SESSION['lastname'] = $out["lastname"]; // $ret->lastname;
|
||||||
$_SESSION['email'] = $out["email"]; // $ret->email;
|
$_SESSION['email'] = $out["email"]; // $ret->email;
|
||||||
$_SESSION['user_id'] = $out["user_id"]; // $ret->id;
|
$_SESSION['user_id'] = $out["member_id"]; // $ret->id;
|
||||||
$_SESSION['pid'] = $out["pid"]; // $ret->id;
|
|
||||||
$_SESSION['loc'] = $out["loc"];
|
$_SESSION['loc'] = $out["loc"];
|
||||||
$_SESSION['practice'] = $out["practice"];
|
$_SESSION['mypage'] = $out["mypage"];
|
||||||
$_SESSION['PracticeID'] = $out["PracticeID"];
|
|
||||||
$_SESSION['UserId'] = $out["UserId"];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
||||||
|
|||||||
@@ -17,9 +17,16 @@ class Backend_model extends CI_Model {
|
|||||||
$this->thisUser = $this->USER;
|
$this->thisUser = $this->USER;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function jubabox_api($in, $out = array()) {
|
public function jubabox_api($in, &$out) {
|
||||||
|
if (!is_array($out)) return -1;
|
||||||
$this->jubabox_load();
|
$this->jubabox_load();
|
||||||
$ret = $this->jubabox->jubabox_api($in, $out);
|
$rrr = array();
|
||||||
|
$jubabox = $this->jubabox;
|
||||||
|
$ret = $jubabox->jubabox_api($in, $rrr);
|
||||||
|
//print_r( $in );
|
||||||
|
//echo "-----\n";
|
||||||
|
//print_r( $rrr );
|
||||||
|
$out = $rrr;
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
<link rel="stylesheet" type="text/css" href="../../../app-assets/css/plugins/tour/tour.css">
|
<link rel="stylesheet" type="text/css" href="../../../app-assets/css/plugins/tour/tour.css">
|
||||||
<!-- END: Page CSS-->
|
<!-- END: Page CSS-->
|
||||||
|
|
||||||
|
|
||||||
<!-- BEGIN: Custom CSS-->
|
<!-- BEGIN: Custom CSS-->
|
||||||
<link rel="stylesheet" type="text/css" href="../../../assets/css/style.css">
|
<link rel="stylesheet" type="text/css" href="../../../assets/css/style.css">
|
||||||
<!-- END: Custom CSS-->
|
<!-- END: Custom CSS-->
|
||||||
@@ -63,11 +64,11 @@
|
|||||||
<div class="shadow-bottom"></div>
|
<div class="shadow-bottom"></div>
|
||||||
<div class="main-menu-content">
|
<div class="main-menu-content">
|
||||||
<ul class="navigation navigation-main" id="main-menu-navigation" data-menu="menu-navigation">
|
<ul class="navigation navigation-main" id="main-menu-navigation" data-menu="menu-navigation">
|
||||||
<li class=" nav-item"><a href="/page/index"><i class="feather icon-home"></i><span class="menu-title" data-i18n="Dashboard">Home</span><span class="badge badge badge-warning badge-pill float-right mr-2">2</span></a>
|
<li class=" nav-item"><a href="/page/index"><i class="feather icon-home"></i><span class="menu-title" data-i18n="Dashboard">Home</span></a>
|
||||||
<ul class="menu-content">
|
<ul class="menu-content">
|
||||||
<li class="active"><a href="dashboard-analytics.html"><i class="feather icon-circle"></i><span class="menu-item" data-i18n="Analytics">Analytics</span></a>
|
<li class="active"><a href="/page/index"><i class="feather icon-circle"></i><span class="menu-item" data-i18n="Analytics">My Page</span></a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="dashboard-ecommerce.html"><i class="feather icon-circle"></i><span class="menu-item" data-i18n="eCommerce">eCommerce</span></a>
|
<li><a href="/page/index"><i class="feather icon-circle"></i><span class="menu-item" data-i18n="eCommerce">Shared</span></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@@ -111,16 +112,16 @@
|
|||||||
<!-- li.nav-item.mobile-menu.d-xl-none.mr-auto-->
|
<!-- li.nav-item.mobile-menu.d-xl-none.mr-auto-->
|
||||||
<!-- a.nav-link.nav-menu-main.menu-toggle.hidden-xs(href='#')-->
|
<!-- a.nav-link.nav-menu-main.menu-toggle.hidden-xs(href='#')-->
|
||||||
<!-- i.ficon.feather.icon-menu-->
|
<!-- i.ficon.feather.icon-menu-->
|
||||||
<li class="nav-item d-none d-lg-block"><a class="nav-link" href="app-todo.html" data-toggle="tooltip" data-placement="top" title="Todo"><i class="ficon feather icon-check-square"></i></a></li>
|
<li class="nav-item d-none d-lg-block"><a class="nav-link" href="/page/todo" data-toggle="tooltip" data-placement="top" title="Todo"><i class="ficon feather icon-check-square"></i></a></li>
|
||||||
<li class="nav-item d-none d-lg-block"><a class="nav-link" href="app-chat.html" data-toggle="tooltip" data-placement="top" title="Chat"><i class="ficon feather icon-message-square"></i></a></li>
|
<li class="nav-item d-none d-lg-block"><a class="nav-link" href="/page/chat" data-toggle="tooltip" data-placement="top" title="Chat"><i class="ficon feather icon-message-square"></i></a></li>
|
||||||
<li class="nav-item d-none d-lg-block"><a class="nav-link" href="app-email.html" data-toggle="tooltip" data-placement="top" title="Email"><i class="ficon feather icon-mail"></i></a></li>
|
<li class="nav-item d-none d-lg-block"><a class="nav-link" href="/page/email" data-toggle="tooltip" data-placement="top" title="Email"><i class="ficon feather icon-mail"></i></a></li>
|
||||||
<li class="nav-item d-none d-lg-block"><a class="nav-link" href="app-calender.html" data-toggle="tooltip" data-placement="top" title="Calendar"><i class="ficon feather icon-calendar"></i></a></li>
|
<li class="nav-item d-none d-lg-block"><a class="nav-link" href="/page/calendar" data-toggle="tooltip" data-placement="top" title="Calendar"><i class="ficon feather icon-calendar"></i></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<li class="nav-item d-none d-lg-block"><a class="nav-link bookmark-star"><i class="ficon feather icon-star warning"></i></a>
|
<li class="nav-item d-none d-lg-block"><a class="nav-link bookmark-star"><i class="ficon feather icon-star warning"></i></a>
|
||||||
<div class="bookmark-input search-input">
|
<div class="bookmark-input search-input">
|
||||||
<div class="bookmark-input-icon"><i class="feather icon-search primary"></i></div>
|
<div class="bookmark-input-icon"><i class="feather icon-search primary"></i></div>
|
||||||
<input class="form-control input" type="text" placeholder="Explore Vuesax..." tabindex="0" data-search="template-list" />
|
<input class="form-control input" type="text" placeholder="Explore JubaBox..." tabindex="0" data-search="template-list" />
|
||||||
<ul class="search-list"></ul>
|
<ul class="search-list"></ul>
|
||||||
</div>
|
</div>
|
||||||
<!-- select.bookmark-select-->
|
<!-- select.bookmark-select-->
|
||||||
@@ -139,7 +140,7 @@
|
|||||||
<li class="nav-item nav-search"><a class="nav-link nav-link-search"><i class="ficon feather icon-search"></i></a>
|
<li class="nav-item nav-search"><a class="nav-link nav-link-search"><i class="ficon feather icon-search"></i></a>
|
||||||
<div class="search-input">
|
<div class="search-input">
|
||||||
<div class="search-input-icon"><i class="feather icon-search primary"></i></div>
|
<div class="search-input-icon"><i class="feather icon-search primary"></i></div>
|
||||||
<input class="input" type="text" placeholder="Explore Vuesax..." tabindex="-1" data-search="template-list" />
|
<input class="input" type="text" placeholder="Explore JubaBox..." tabindex="-1" data-search="template-list" />
|
||||||
<div class="search-input-close"><i class="feather icon-x"></i></div>
|
<div class="search-input-close"><i class="feather icon-x"></i></div>
|
||||||
<ul class="search-list"></ul>
|
<ul class="search-list"></ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -148,7 +149,7 @@
|
|||||||
<ul class="dropdown-menu dropdown-menu-media dropdown-menu-right">
|
<ul class="dropdown-menu dropdown-menu-media dropdown-menu-right">
|
||||||
<li class="dropdown-menu-header">
|
<li class="dropdown-menu-header">
|
||||||
<div class="dropdown-header m-0 p-2">
|
<div class="dropdown-header m-0 p-2">
|
||||||
<h3 class="white">5 New</h3><span class="notification-title">App Notifications</span>
|
<h3 class="white">5 New</h3><span class="notification-title">Notifications</span>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="scrollable-container media-list"><a class="d-flex justify-content-between" href="javascript:void(0)">
|
<li class="scrollable-container media-list"><a class="d-flex justify-content-between" href="javascript:void(0)">
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$jubabox_class = 'jubabox_api_oameye\\jubabox';
|
||||||
|
$jubabox = new $jubabox_class();
|
||||||
|
|
||||||
|
$in = array(
|
||||||
|
"page_title" => "",
|
||||||
|
"username" => "ameye@chiefsoft.com",
|
||||||
|
"password" => "jubabox",
|
||||||
|
"action" => 100011,
|
||||||
|
"pid" => 100
|
||||||
|
);
|
||||||
|
$out = array();
|
||||||
|
$ret = $jubabox->jubabox_api($in, $out);
|
||||||
|
|
||||||
|
var_dump($out);
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user