403Webshell
Server IP : 103.234.187.230  /  Your IP : 216.73.216.216
Web Server : Apache
System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/prathamtour.com/application/admin/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/prathamtour.com/application/admin/controllers/IndexController.php
<?php

/* * *************************************************************
 * Catabatic Technology Pvt. Ltd.
 * File Name     : IndexController.php
 * File Desc.    : Index Controller managed all dashboard and index page
 * Created By    : Piyush Tiwari <piyush@catpl.co.in>
 * Created Date  : 23 May 2018
 * Updated Date  : 23 May 2018
 * ************************************************************* */

class Admin_IndexController extends Zend_Controller_Action {

    public $dbAdapter;

    public function init() {
        /* Initialize action controller here */
        $this->dbAdapter = Zend_Db_Table::getDefaultAdapter();
        $aConfig = $this->getInvokeArg('bootstrap')->getOptions();
        $this->superAdminEmail = $aConfig['bootstrap']['superAdminEmail'];
        $aConfig = $this->getInvokeArg('bootstrap')->getOptions();
        $this->superAdminEmail = $aConfig['bootstrap']['superAdminEmail'];
        $BootStrap  = $aConfig['bootstrap'];
        $this->siteName = $BootStrap['siteName'];
        $this->baseUrl  = $BootStrap['siteUrl'];
        $this->gtxagencysysid = $aConfig['bootstrap']['gtxagencysysid'];
        $this->_resetsession = new Zend_Session_Namespace('AdminResetEmail'); 
        $this->_user = new Zend_Session_Namespace('User');
        $auth = Zend_Auth::getInstance();
        $authStorage = $auth->getStorage();
        $authStorage->read();
		$_SERVER["DOCUMENT_ROOT"] = $_SERVER["DOCUMENT_ROOT"].'/holidaybazaar';
    }

    /**
     * index() method is used to admin login for form call
     * @param Null
     * @return Array 
     */
    public function indexAction() {
        $this->_helper->layout()->disableLayout('');
        $dbAdapter = $this->dbAdapter;
        $auth = Zend_Auth::getInstance();
        //$admin = new Admin_Model_Admin();
        $form = new Admin_Form_Login();
        $form->setAction("admin/index/index");
        $form->setMethod("POST");
        $this->errorMessage = "";

        /*         * ************* check user identity *********** */
        if ($auth->hasIdentity()) {
            $this->_redirect('admin/dashboard/index');
        }
        $this->view->form = $form;

        if ($this->getRequest()->isPost()) {
            if ($form->isValid($_POST)) {
//                echo "<pre>";print_r($_POST);die;
                 $_POST['captcha'] = $_SESSION['captcha']=1;  //uncomment for login if captcha not loading in local
                 if (strtolower($_POST['captcha']) != $_SESSION['captcha']) {
                     $this->view->errorMessage = "Captcha code invalid.";
                 } else {


                    $data = $form->getValues();
                    $username = $data['username'];
                    $password = $data['password'];

//                echo $username , $password ; die;
                    $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);

                    //Set the input credential values
                    $authAdapter->setTableName('admin_user')
                            ->setIdentityColumn('username')
                            ->setCredentialColumn('password')
                            ->setCredentialTreatment("MD5(?) AND is_active='1' ");
                    $authAdapter->setIdentity($username)
                            ->setCredential($password);
                    //echo "<pre>"; print_r($authAdapter);die;

                    $result = $auth->authenticate($authAdapter);
                    if ($result->isValid()) {
                        $storage = new Zend_Auth_Storage_Session();
                        $storage->write($authAdapter->getResultRowObject());
                        $auth = Zend_Auth::getInstance();
                        $authStorage = $auth->getStorage();
                        $this->_redirect('admin/dashboard/index');
                    } else {
                        $this->view->errorMessage = "Invalid username and/or password";
                    }
                }
            }
        }
    }
  public function forgotpasswordAction()
    {
        $this->_helper->layout()->disableLayout('');
        //$this->view->headTitle('DCB Bank Admin');
        $admin = new Admin_Model_Admin();
        $form = new Admin_Form_Forgot();
        $form->setAction("admin/index/forgotpassword");
        $form->setMethod("POST");
        $this->view->form = $form;
        $message = "";
        if ($this->getRequest()->isPost()) {
            if ($form->isValid($_POST)) {
                $data = $form->getValues();
                $email = $data['email'];
                $result = $admin->getAdminUserListByEmail($email);
                // echo"<pre>";print_r($result);die;
                if (isset($result) && !empty($result)) {
                    $admin_id = $result->user_id;
                    $admin_username = ucfirst($result->username);
                    $admin_email = $result->email;
                    $datetime = date('d-m-y h:i:s');
                    $time_str = strtotime($datetime);
                    $password = $result->password;
                    $from_email = $this->superAdminEmail;
                    $reseturlclick = $this->baseUrl . "admin/index/checkresetlink?ag=$admin_id&eid=$admin_email&CTR=$time_str";
                    // print_r( $reseturlclick);die();
                    // $randomString = $this->randomString();
                    // $admin->updateChangePasswordByAdminId($randomString, $admin_id);
                    $subject = "Password Change Request ";
                    $message = "Hello $admin_username<br><br>";
                    $message .= "Greetings from $this->siteName team.<br><br>";
                    $message .= "It is our pleasure to fulfill your request for new password.<br><br>";
                    $message .= "To change your account password at $this->siteName please click this link or copy and paste the following link into your browser. This link expire within 10 minutes: <br><br>";
                    $message .= " <a href='$reseturlclick'>Click here to reset your password</a> <br><br><br>";
                    $message .= "Thank you.<br><br>";
                    $message .= "$this->siteName Team.";
                    // To send HTML mail, the Content-type header must be set
                    $headers = 'MIME-Version: 1.0' . "\r\n";
                    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
                    $headers .= 'From: ' . $admin_username . ' (' . $from_email . ')' . "\r\n";
                    $configs = [
                        'to' => $admin_email,
                        'fromName' => $this->siteName,
                        'fromEmail' => $admin_email,
                        'subject' => $subject,
                        'bodyHtml' => $message,
                    ];
                    // Mail it
                    $retval = $this->_helper->General->mailSentByElastice($configs, 'Forgot');
                    // $retval = mail($admin_email, $subject, $message, $headers);
                    echo "<pre>";
                    print_r($message);
                    die;
                    if ($retval == true) {
                        $this->view->successMessage = "Email has been sent successfully.";
                    } else {
                        $this->view->errorMessage = "Message could not be sent.";
                    }
                } else {
                    $this->view->errorMessage = "Invalid email. Please try again.";
                }
            }
        }
    }
    /**
     * forgotpassword() method is used to admin can forgot password
     * @param Null
     * @return Array 
     */
    public function delete_forgotpasswordAction() {
        $this->_helper->layout()->disableLayout('');
//       $this->view->headTitle('DCB Bank Admin');
        $admin = new Admin_Model_Admin();
        $form = new Admin_Form_Forgot();
        $form->setAction("admin/index/forgotpassword");
        $form->setMethod("POST");
        $this->view->form = $form;
        $message = "";
        if ($this->getRequest()->isPost()) {
            if ($form->isValid($_POST)) {
                $data = $form->getValues();
                $email = $data['email'];
                $result = $admin->getAdminUserListByEmail($email);
//                echo"<pre>";print_r($result);die;
                if (isset($result) && !empty($result)) {
                    $admin_id = $result->user_id;
                    $admin_username = ucfirst($result->username);
                    $admin_email = $result->email;
                    $datetime = date('d-m-y h:i:s');
                    $time_str = strtotime($datetime);
                    $password = $result->password;
                    $from_email = $this->superAdminEmail;
                    $reseturlclick = $this->baseUrl."admin/index/checkresetlink?ag=$admin_id&eid=$admin_email&CTR=$time_str";
                    // print_r( $reseturlclick);die();
                    // $randomString = $this->randomString();
                    // $admin->updateChangePasswordByAdminId($randomString, $admin_id);
                    $subject = "Password Change Request ";
                    $message = "Hello $admin_username<br><br>";
                    $message .= "Greetings from $this->siteName team.<br><br>";
                    $message .= "It is our pleasure to fulfill your request for new password.<br><br>";
                    $message .= "To change your account password at $this->siteName please click this link or copy and paste the following link into your browser. This link expire within 10 minutes: <br><br>";
                    $message .= " <a href='$reseturlclick'>Click here to reset your password</a> <br><br><br>";
                    $message .= "Thank you.<br><br>";
                    $message .= "$this->siteName Team.";  
                    // To send HTML mail, the Content-type header must be set
                    $headers = 'MIME-Version: 1.0' . "\r\n";
                    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
                    $headers .= 'From: ' . $admin_username . ' (' . $from_email . ')' . "\r\n";
                    $configs = [
                        'to' => $admin_email ,
                        'fromName' => $this->siteName ,
                        'fromEmail' => $admin_email ,
                        'subject' => $subject ,
                        'bodyHtml' => $message ,
                    ];
                    // Mail it
                    $retval= $this->_helper->General->mailSentByElastice( $configs , 'Forgot' );
                    // $retval = mail($admin_email, $subject, $message, $headers);
                    //   echo"<pre>";print_r($message);die;
//                    echo"<pre>";print_r($retval);die;
                    if ($retval == true) {
                        $this->view->successMessage = "Email has been sent successfully.";
                    } else {
                        $this->view->errorMessage = "Message could not be sent.";
                    }
                } else {
                    $this->view->errorMessage = "Invalid email. Please try again.";
                }
            }
        }
    }

    // public function randomString() {
    //     $length = 6;
    //     $chars = "0123456789ABCDEFGHI";
    //     $str = "";
    //     for ($i = 0; $i < $length; $i++) {
    //         $str .= $chars[mt_rand(0, strlen($chars) - 1)];
    //     }
    //     return $str;
    // }
    public function checkresetlinkAction(){
        $param = $this->getRequest()->getParams();
		//   echo "<pre>";print_r($param);die;
        $datetime = date('d-m-y h:i:s');
        $seconds = strtotime($datetime) - ($param['CTR']);
        $days    = floor($seconds / 86400);
        $hours   = floor(($seconds - ($days * 86400)) / 3600);
        $minutes = floor(($seconds - ($days * 86400) - ($hours * 3600))/60);
        //if($minutes <= 10){
            $eid = base64_decode($param['eid']);
            $ag = $param['ag'];
            $SubmitData = array(
                "eid" => $eid,
                "ag" => $ag,
                "CTR" => $param['CTR']
            );
            //   print_r( $SubmitData);die();
            $this->_resetsession->resetpass = $SubmitData;
            // print_r($SubmitData);die();
            $this->_redirect('admin/index/resetpassword');
        //}else{
          //  die('Oops your reset password link is expired!! try again.');
        //} 
    }
    /**
     * resetpassword() method is used to admin reset password for form call
     * @param Null
     * @return Array 
     */
     public function resetpasswordAction(){
         if(isset($_SESSION['AdminResetEmail']['resetpass'])){
        //  echo"<pre>";print_r($_SESSION['AdminResetEmail']['resetpass']);die();
        $this->_helper->layout()->disableLayout('');
           $admin = new Admin_Model_Admin();
           $form= new  Admin_Form_Forgot_Password();
           $form->setAction("admin/index/resetpassword");
           $form->setMethod("POST");
           $this->view->form = $form;
           $message = "";
           if ($this->getRequest()->isPost()){
            if ($form->isValid($_POST)) {
            $data = $form->getValues();
                //echo"<pre>";print_r($data);die();
                $password =$data['password'];
                $cpassword =$data['cpassword'];
                 $resetpassword = $admin->updateChangePasswordByAdminId($password);
                 $this->view->successMessage = "Password has been reset successfully.";
                // echo"<pre>";print_r($resetpassword);die();
                }else{
                    $this->view->errorMessage = "Oops there is no response.";
                }
            }
        }else{
            echo('Oops! There seems to be some problem in processing your request!');exit;
        }
    }


    /**
     * checklogin() method is used to check admin logedin or not
     * @param Null
     * @return Array 
     */
    public function checklogin() {
        $auth = Zend_Auth::getInstance();
        /*         * ************* check user identity *********** */
        if (!$auth->hasIdentity()) {
            $this->_redirect('admin/index/index');
        }
    }

    /*     * ** logout ********* */

    public function logoutAction() {
        if ($this->getRequest()->getParam('module') == 'admin') {
            $storage = new Zend_Auth_Storage_Session();
            $storage->clear();
            $this->_redirect('admin/index/index');
        } else {
            $this->_redirect('admin/index/index');
        }
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit