H69UNtblNBNpha2dtB1Odn8qYp1Qk5NK2gi7yfceofo9N
/
home
/
ymswebso
/
public_html
/
wlboosting
/
app
/
Controller
/
Nama File / Folder
Size
Action
Component
--
NONE
AuthrizeController.php
2.271KB
Hapus
Edit
Rename
BoostingController.php
19.031KB
Hapus
Edit
Rename
CoachController.php
10.278KB
Hapus
Edit
Rename
ErrorsController.php
0.272KB
Hapus
Edit
Rename
HomeController.php
2.809KB
Hapus
Edit
Rename
ManagecoachesController.php
51.679KB
Hapus
Edit
Rename
ManagelanguagesController.php
7.935KB
Hapus
Edit
Rename
ManagepositionsrolesController.php
8.006KB
Hapus
Edit
Rename
ManagereviewsController.php
6.113KB
Hapus
Edit
Rename
ManageserversController.php
3.105KB
Hapus
Edit
Rename
ManagespecailizationsController.php
8.21KB
Hapus
Edit
Rename
NetwinsordersController.php
17.211KB
Hapus
Edit
Rename
NewsController.php
4.057KB
Hapus
Edit
Rename
NewslettersController.php
3.163KB
Hapus
Edit
Rename
PagesController.php
11.997KB
Hapus
Edit
Rename
SettingsController.php
1.53KB
Hapus
Edit
Rename
SignupController.php
5.271KB
Hapus
Edit
Rename
UpdatecurrentleagueController.php
5.75KB
Hapus
Edit
Rename
UsersController.php
13.809KB
Hapus
Edit
Rename
<?php class UsersController extends AppController { var $components = array('Session', 'RequestHandler', 'Paginator', 'Captcha'); public $helpers = array('Html', 'Form'); public function login(){ if($this->Session->check('UserId')){ if($this->Session->read('UserType') == 'Coach'){ return $this->redirect(array('action' => '../my-account')); }else{ return $this->redirect(array('action' => '../user-account')); } } $title_for_layout = 'WL Boosting : Login'; $this->set(compact('title_for_layout')); if ($this->request->is('post')) { //print_r($this->request->data); if(isset($this->request->data['btn_sugnup'])){ $Userinfo = $this->User->find('first', array('conditions' => array('User.username' => $this->request->data['username'], 'User.password' => md5($this->request->data['password']), 'User.status' => 'Yes'))); if(!empty($Userinfo)){ if($this->Session->write('UserId', $Userinfo['User']['id']) && $this->Session->write('Username', $Userinfo['User']['username']) && $this->Session->write('UserEmail', $Userinfo['User']['email']) && $this->Session->write('UserType', $Userinfo['User']['user_type'])){ if($Userinfo['User']['user_type'] == 'Coach'){ return $this->redirect(array('action' => '../my-account')); }else{ return $this->redirect(array('action' => '../user-account')); } } }else{ $this->Session->setFlash(__(' <div class="col-md-12 text-center" style="background-color:#FFFF94; color:red; padding:7px 15px; margin-top:10px; margin-bottom:15px; font-size:15px; font-weight:bold;">You entered wrong username or password or your account has been deactivated.</div>')); return $this->redirect(array('action' => '../users/login/')); } } if(isset($this->request->data['btn_revcover'])){ $Userinfo = $this->User->find('first', array('conditions' => array('User.email' => $this->request->data['email']))); if(!empty($Userinfo)){ $Email = new CakeEmail(); $this->loadModel('Setting'); $setting = $this->Setting->find('first', array('conditions' => array('Setting.id'=>'1'))); $fromemail = $setting['Setting']['admin_email']; $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*_"; $password = substr( str_shuffle( $chars ), 0, 8 ); $Userinfo['User']['repeat_password'] = $password; $data = array( 'password' => '"'.md5($password).'"' ); if ($this->User->updateAll($data, array('id' => $Userinfo['User']['id']))) { $Email->template('forgotepassword', 'emaillayout') ->viewVars(array("user"=>$Userinfo['User'])) ->emailFormat('html') ->to($this->request->data['email']) ->from(array($fromemail => 'WLBOOSTING.COM')) ->subject('Dear '.$Userinfo['User']['first_name'].' '.$Userinfo['User']['last_name'].'. Your password has been changed successfully on WLBOOSTING.COM.') ->send(); $this->Session->setFlash(__(' <div class="col-md-12 text-center" style="background-color:#FFFF94; color:green; padding:7px 15px; margin-top:10px; margin-bottom:15px; font-size:15px; font-weight:bold;">Your Password has been sent to your email. Please also check your <span style="color:#F58023;">junk folder</span> because sometimes mail goes to the <span style="color:#F58023;">junk folder</span></div>')); return $this->redirect(array('action' => '../users/login/')); } }else{ $this->Session->setFlash(__(' <div class="col-md-12 text-center" style="background-color:#FFFF94; color:red; padding:7px 15px; margin-top:10px; margin-bottom:15px; font-size:15px; font-weight:bold;">You entered wrong email id.</div>')); return $this->redirect(array('action' => '../users/login/')); } } } } public function logout() { $this->Session->delete('UserId'); $this->Session->delete('Username'); $this->Session->delete('UserEmail'); $this->redirect('/users/login/'); if ($this->request->is('get')) { throw new MethodNotAllowedException(); } } // Here for Admin panael and code by Prabhakr public function admin_index() { $title_for_layout = 'Login'; $this->set(compact('title_for_layout')); if($this->Session->check('AdminUser')) { return $this->redirect(array('action' => '/dashboard/')); } // if the form was submitted $this->loadModel('Setting'); if(!empty($this->data)) { //print_r($this->data);exit; // find the user in the database $dbuser = $this->Setting->findByUsername($this->data['username']); //print_r($dbuser); // if found and passwords match if(!empty($dbuser) && ($dbuser['Setting']['password'] == md5($this->data['password']))) { if($this->Session->write('AdminUser', $dbuser['Setting']['username'])) { //$this->Session->setFlash(__('You have successfully logged in.')); return $this->redirect(array('action' => '/dashboard/')); } //return $this->redirect(array('action' => 'admin/users/dashboard/')); //$this->redirect('admin/users/dashboard/'); } else { $this->set('error', 'Either your username or password is incorrect.'); } } } public function admin_dashboard() { if(!$this->Session->check('AdminUser')){ return $this->redirect(array('action' => '../users')); } $title_for_layout = 'Dashboard'; $this->set(compact('title_for_layout')); $this->set('TotalNormalUsers', $this->User->find('count', array('conditions' => array('User.user_type ' => 'Normal User')))); $this->set('TotalCoaches', $this->User->find('count', array('conditions' => array('User.user_type ' => 'Coach')))); $this->loadModel('Order'); $this->set('TotalOrders', $this->Order->find('count')); $TotalIncome = $this->Order->find('first', array('conditions' => array('Order.order_status' => 'Completed'), 'fields'=>array('sum(Order.amount) as total'))); $this->set('TotalIncome', $TotalIncome[0]['total']); $this->loadModel('Visitor'); $this->set('MonthlyVisitors', $this->Visitor->find('count', array('conditions' => array('Visitor.month' => date("m"), 'Visitor.year' => date("Y"))))); $orders = $this->Order->find('all', array('conditions' => array('Order.status' => 'Yes'), 'order' => 'Order.id desc', 'limit' => 10)); if(!empty($orders)){ $this->loadModel('State'); $this->loadModel('Country'); $i = 0; $OrdersData = array(); foreach($orders as $order){ $CoachInfo = $this->User->find('first', array('conditions' => array('User.id' => $order['Order']['order_against_id']))); $state_for_coach = $this->State->find('first', array('conditions' => array('State.id' => $CoachInfo['User']['state_id']))); $country_for_coach = $this->Country->find('first', array('conditions' => array('Country.id' => $CoachInfo['User']['country_id']))); $CustomerInfo = $this->User->find('first', array('conditions' => array('User.id' => $order['Order']['user_id']))); $state_for_customer = $this->State->find('first', array('conditions' => array('State.id' => $CustomerInfo['User']['state_id']))); $country_for_customer = $this->Country->find('first', array('conditions' => array('Country.id' => $CustomerInfo['User']['country_id']))); $OrdersData[$i] = array( 'order_id' => $order['Order']['id'], 'order_against_id' => $order['Order']['order_against_id'], 'order_by_id' => $CustomerInfo['User']['id'], 'order_by' => $CustomerInfo['User']['first_name'].' '.$CustomerInfo['User']['last_name'], 'customer_email' => $CustomerInfo['User']['email'], 'customer_contact_no' => $CustomerInfo['User']['contact_no'], 'customer_location' => $CustomerInfo['User']['city'].', '.$state_for_customer['State']['name'].', '.$country_for_customer['Country']['name'], 'coach' => $CoachInfo['User']['username'], 'coach_email' => $CoachInfo['User']['email'], 'coach_contact_no' => $CoachInfo['User']['contact_no'], 'coach_location' => $CoachInfo['User']['city'].', '.$state_for_coach['State']['name'].', '.$country_for_coach['Country']['name'], 'duration' => $order['Order']['duration'], 'amount' => $order['Order']['amount'], 'admin_share' => $order['Order']['admin_share'], 'admin_share_percent' => $order['Order']['admin_share_percent'], 'coach_share' => $order['Order']['coach_share'], 'order_status' => $order['Order']['order_status'], 'payment_status' => $order['Order']['payment_status'], 'status' => $order['Order']['status'], 'created' => $order['Order']['created'] ); $i++; } $this->set('orders', $OrdersData); }else{ $this->set('orders', ''); } $users = $this->User->find('all', array('conditions' => array('User.user_type' => 'Normal User'), 'order' => 'User.id desc', 'limit' => 10)); if(!empty($users)){ $UsersData = array(); $i = 0; foreach($users as $user){ $this->loadModel('Country'); $country = $this->Country->find('first', array('conditions' => array('Country.id' => $user['User']['country_id']))); $this->loadModel('State'); $state = $this->State->find('first', array('conditions' => array('State.id' => $user['User']['state_id']))); $Order = $this->Order->find('count', array('conditions' => array('Order.user_id' => $user['User']['id']))); $price = $this->Order->find('first', array('conditions' => array('Order.order_status' => 'Completed', 'Order.user_id' => $user['User']['id']), 'fields'=>array('sum(Order.amount) as total'))); $UsersData[$i] = array( 'id' => $user['User']['id'], 'first_name' => $user['User']['first_name'], 'last_name' => $user['User']['last_name'], 'email' => $user['User']['email'], 'username' => $user['User']['username'], 'contact_no' => $user['User']['contact_no'], 'city' => $user['User']['city'], 'state' => $state['State']['name'], 'country' => $country['Country']['name'], 'total_order' => $Order, 'price' => $price[0]['total'], 'status' => $user['User']['status'], 'last_login' => date("j F, Y", strtotime($user['User']['modified'])) ); $i++; } $this->set('LatestTenNormalUsers', $UsersData); }else{ $this->set('LatestTenNormalUsers', ''); } $users = $this->User->find('all', array('conditions' => array('User.user_type' => 'Coach'), 'order' => 'User.id desc', 'limit' => 10)); if(!empty($users)){ $UsersData = array(); $i = 0; foreach($users as $user){ $this->loadModel('Country'); $country = $this->Country->find('first', array('conditions' => array('Country.id' => $user['User']['country_id']))); $this->loadModel('State'); $state = $this->State->find('first', array('conditions' => array('State.id' => $user['User']['state_id']))); $this->loadModel('Order'); $Order = $this->Order->find('count', array('conditions' => array('Order.order_against_id' => $user['User']['id']))); $price = $this->Order->find('first', array('conditions' => array('Order.order_status' => 'Completed', 'Order.order_against_id' => $user['User']['id']), 'fields'=>array('sum(Order.amount) as total'))); $UsersData[$i] = array( 'id' => $user['User']['id'], 'first_name' => $user['User']['first_name'], 'last_name' => $user['User']['last_name'], 'email' => $user['User']['email'], 'username' => $user['User']['username'], 'contact_no' => $user['User']['contact_no'], 'city' => $user['User']['city'], 'state' => $state['State']['name'], 'country' => $country['Country']['name'], 'total_order' => $Order, 'price' => $price[0]['total'], 'status' => $user['User']['status'], 'last_login' => date("j F, Y", strtotime($user['User']['modified'])) ); $i++; } $this->set('LatestTenLolCoaches', $UsersData); }else{ $this->set('LatestTenLolCoaches', ''); } } public function admin_logout() { // delete the user session $this->Session->delete('AdminUser'); // redirect to posts index page $this->redirect('/admin/users/'); } public function admin_changepassword() { if(!$this->Session->check('AdminUser')) { return $this->redirect(array('action' => '../users')); } $title_for_layout = 'Change Password'; $this->set(compact('title_for_layout')); if ($this->request->is('post')) { // print_r($this->request->data); $this->loadModel('Setting'); $CheckUser = $this->Setting->find('count', array('conditions' => array('Setting.password' => md5($this->request->data['password'])))); if($CheckUser > 0){ $data = array( 'password' => '"'.md5($this->request->data['new_password']).'"' ); $this->Setting->updateAll($data, array('id' => '1')); $this->Session->setFlash(__(' <div class="col-md-12 text-center" style="background-color:#FFFF94; color:green; padding:7px 15px; margin-top:15px; margin-bottom:15px; font-size:16px; font-weight:bold;">Password has been changed successfully.</div>')); return $this->redirect(array('action' => '../users/changepassword')); }else{ $this->Session->setFlash(__(' <div class="col-md-12 text-center" style="background-color:#FFFF94; color:red; padding:7px 15px; margin-top:15px; margin-bottom:15px; font-size:16px; font-weight:bold;">Old Password does not match.</div>')); return $this->redirect(array('action' => '../users/changepassword')); } } } } ?>