php - migrating cacke 1.3 app problems logging in

779

I'm trying to migrate an old CackePHP app (v1.3) from one host to another. I've copied the files 1:1 and the database also by exporting via phpmyadmin.

The old host was an well old host, the database version (MySQL 5.1.33), did not check the PHP version but it was below 5.6.

After copying the files to the new host it seems that the login functionality stopped working the login screen appears but the login data aren't created in the session.

I've tried to change the PHP version from 5.6 to 5.4 and then 5.2 with no luck, I read some information online to clear the cache and so on but no luck.

The app isn't mine and I've never delt with CackePHP before - so any advice on where to look further or what files to add here would be appreciated.

From what I could tell till now I'm including the app_conteoller.php code here.

<?php
/**
 * Short description for file.
 *
 * This file is application-wide controller file. You can put all
 * application-wide controller-related methods here.
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       cake
 * @subpackage    cake.app
 * @since         CakePHP(tm) v 0.2.9
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */

/**
 * Short description for class.
 *
 * Add your application-wide methods in the class below, your controllers
 * will inherit them.
 *
 * @package       cake
 * @subpackage    cake.app
 */
class AppController extends Controller {

var $components = array('Acl','Auth','Session');
var $helpers = array('Form', 'Html', 'Javascript', 'Time','Session');


    function beforeFilter() {
        parent::beforeFilter();
        $this->disableCache();

      var_dump($this->Auth);

        $this->set('pageTitle','Transakcje');
        $this->Auth->authorize = 'crud';
        $this->Auth->allowedActions = array(
         'send',
         'register',
         'login',
         'logout',
         'thanks',
         'forgottenpassword',
         'lol',
         'view'
      );
        $this->Auth->redirect('/users/login');
        $this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'login');
        $this->Auth->loginAction = array('admin' => false, 'controller' => 'users', 'action' => 'login');
        $this->Auth->authError = "Brak dostępu do tej części witryny.";

      $this->Auth->actionMap['admin_display'] = 'update';
        $this->Auth->actionMap['admin_index'] = 'update';
        $this->Auth->actionMap['admin_edit'] = 'update';
        $this->Auth->actionMap['admin_export'] = 'update';
        $this->Auth->actionMap['addgroup'] = 'upddate';
        $this->Auth->actionMap['admin_activate'] = 'update';
        $this->Auth->actionMap['admin_email'] = 'update';
        $this->Auth->actionMap['admin_delete'] = 'delete';
        $this->Auth->actionMap['index'] = 'read';
        $this->Auth->actionMap['contact'] = 'read';
        $this->Auth->actionMap['changepassword'] = 'read';
        $this->set('username', $this->Auth->user('username'));

        if ($this->Auth->user('group_id') == 3) {
            $this->set('is_admin',true);
        }
        else {
            $this->set('is_admin',false);
        }
        define('HEADERS','From: webmas[email protected]' . "\r\n" .
            'Reply-To: [email protected]' . "\r\n" .
            'X-Mailer: PHP/' . phpversion());

    }
}
?>

I've var dumped the Auth object after trying to loggin and from what I can tell the login information isn't there

object(AuthComponent)#38 (26) {
  ["_loggedIn"]=>
  bool(false)
  ["components"]=>
  array(2) {
    [0]=>
    string(7) "Session"
    [1]=>
    string(14) "RequestHandler"
  }
  ["authenticate"]=>
  NULL
  ["authorize"]=>
  bool(false)
  ["ajaxLogin"]=>
  NULL
  ["flashElement"]=>
  string(7) "default"
  ["userModel"]=>
  string(4) "User"
  ["userScope"]=>
  array(0) {
  }
  ["fields"]=>
  array(2) {
    ["username"]=>
    string(8) "username"
    ["password"]=>
    string(8) "password"
  }
  ["sessionKey"]=>
  NULL
  ["actionPath"]=>
  NULL
  ["loginAction"]=>
  NULL
  ["loginRedirect"]=>
  NULL
  ["logoutRedirect"]=>
  NULL
  ["object"]=>
  NULL
  ["loginError"]=>
  NULL
  ["authError"]=>
  NULL
  ["autoRedirect"]=>
  bool(true)
  ["allowedActions"]=>
  array(0) {
  }
  ["actionMap"]=>
  array(18) {
    ["index"]=>
    string(4) "read"
    ["add"]=>
    string(6) "create"
    ["edit"]=>
    string(6) "update"
    ["view"]=>
    string(4) "read"
    ["remove"]=>
    string(6) "delete"
    ["create"]=>
    string(6) "create"
    ["read"]=>
    string(4) "read"
    ["update"]=>
    string(6) "update"
    ["delete"]=>
    string(6) "delete"
    ["admin_index"]=>
    string(4) "read"
    ["admin_add"]=>
    string(6) "create"
    ["admin_edit"]=>
    string(6) "update"
    ["admin_view"]=>
    string(4) "read"
    ["admin_remove"]=>
    string(6) "delete"
    ["admin_create"]=>
    string(6) "create"
    ["admin_read"]=>
    string(4) "read"
    ["admin_update"]=>
    string(6) "update"
    ["admin_delete"]=>
    string(6) "delete"
  }
  ["data"]=>
  array(0) {
  }
  ["params"]=>
  array(9) {
    ["controller"]=>
    string(5) "users"
    ["action"]=>
    &string(10) "admin_view"
    ["named"]=>
    array(0) {
    }
    ["pass"]=>
    array(1) {
      [0]=>
      string(2) "88"
    }
    ["prefix"]=>
    string(5) "admin"
    ["admin"]=>
    bool(true)
    ["plugin"]=>
    NULL
    ["form"]=>
    array(0) {
    }
    ["url"]=>
    array(1) {
      ["url"]=>
      string(19) "admin/users/view/88"
    }
  }
  ["_methods"]=>
  array(14) {
    [0]=>
    string(9) "admin_add"
    [1]=>
    string(10) "admin_edit"
    [2]=>
    string(12) "admin_delete"
    [3]=>
    string(5) "login"
    [4]=>
    string(6) "logout"
    [5]=>
    string(11) "admin_index"
    [6]=>
    string(10) "admin_view"
    [7]=>
    string(8) "register"
    [8]=>
    string(6) "thanks"
    [9]=>
    string(14) "admin_activate"
    [10]=>
    string(17) "forgottenpassword"
    [11]=>
    string(14) "changepassword"
    [12]=>
    string(7) "contact"
    [13]=>
    string(11) "admin_email"
  }
  ["enabled"]=>
  bool(true)
  ["Session"]=>
  &object(SessionComponent)#39 (15) {
    ["__active"]=>
    bool(true)
    ["__bare"]=>
    int(0)
    ["valid"]=>
    bool(false)
    ["error"]=>
    bool(false)
    ["_userAgent"]=>
    string(32) "926c6c491cb815708e7614617a013876"
    ["path"]=>
    string(1) "/"
    ["lastError"]=>
    NULL
    ["security"]=>
    string(6) "medium"
    ["time"]=>
    int(1530884153)
    ["sessionTime"]=>
    int(1530896153)
    ["watchKeys"]=>
    array(0) {
    }
    ["id"]=>
    NULL
    ["_started"]=>
    bool(false)
    ["host"]=>
    string(30) "i removed the address from here"
    ["enabled"]=>
    bool(true)
  }
  ["RequestHandler"]=>
  &object(RequestHandlerComponent)#40 (10) {
    ["ajaxLayout"]=>
    string(4) "ajax"
    ["enabled"]=>
    bool(true)
    ["__responseTypeSet"]=>
    NULL
    ["params"]=>
    array(0) {
    }
    ["__requestContent"]=>
    array(23) {
      ["javascript"]=>
      string(15) "text/javascript"
      ["js"]=>
      string(15) "text/javascript"
      ["json"]=>
      string(16) "application/json"
      ["css"]=>
      string(8) "text/css"
      ["html"]=>
      array(2) {
        [0]=>
        string(9) "text/html"
        [1]=>
        string(3) "*/*"
      }
      ["text"]=>
      string(10) "text/plain"
      ["txt"]=>
      string(10) "text/plain"
      ["csv"]=>
      array(2) {
        [0]=>
        string(24) "application/vnd.ms-excel"
        [1]=>
        string(10) "text/plain"
      }
      ["form"]=>
      string(33) "application/x-www-form-urlencoded"
      ["file"]=>
      string(19) "multipart/form-data"
      ["xhtml"]=>
      array(3) {
        [0]=>
        string(21) "application/xhtml+xml"
        [1]=>
        string(17) "application/xhtml"
        [2]=>
        string(10) "text/xhtml"
      }
      ["xhtml-mobile"]=>
      string(29) "application/vnd.wap.xhtml+xml"
      ["xml"]=>
      array(2) {
        [0]=>
        string(15) "application/xml"
        [1]=>
        string(8) "text/xml"
      }
      ["rss"]=>
      string(19) "application/rss+xml"
      ["atom"]=>
      string(20) "application/atom+xml"
      ["amf"]=>
      string(17) "application/x-amf"
      ["wap"]=>
      array(3) {
        [0]=>
        string(16) "text/vnd.wap.wml"
        [1]=>
        string(22) "text/vnd.wap.wmlscript"
        [2]=>
        string(18) "image/vnd.wap.wbmp"
      }
      ["wml"]=>
      string(16) "text/vnd.wap.wml"
      ["wmlscript"]=>
      string(22) "text/vnd.wap.wmlscript"
      ["wbmp"]=>
      string(18) "image/vnd.wap.wbmp"
      ["pdf"]=>
      string(15) "application/pdf"
      ["zip"]=>
      string(17) "application/x-zip"
      ["tar"]=>
      string(17) "application/x-tar"
    }
    ["mobileUA"]=>
    array(22) {
      [0]=>
      string(7) "Android"
      [1]=>
      string(7) "AvantGo"
      [2]=>
      string(10) "BlackBerry"
      [3]=>
      string(6) "DoCoMo"
      [4]=>
      string(4) "iPod"
      [5]=>
      string(6) "iPhone"
      [6]=>
      string(4) "J2ME"
      [7]=>
      string(4) "MIDP"
      [8]=>
      string(8) "NetFront"
      [9]=>
      string(5) "Nokia"
      [10]=>
      string(10) "Opera Mini"
      [11]=>
      string(6) "PalmOS"
      [12]=>
      string(10) "PalmSource"
      [13]=>
      string(9) "portalmmm"
      [14]=>
      string(7) "Plucker"
      [15]=>
      string(14) "ReqwirelessWeb"
      [16]=>
      string(12) "SonyEricsson"
      [17]=>
      string(7) "Symbian"
      [18]=>
      string(11) "UP\.Browser"
      [19]=>
      string(5) "webOS"
      [20]=>
      string(10) "Windows CE"
      [21]=>
      string(5) "Xiino"
    }
    ["__acceptTypes"]=>
    array(6) {
      [0]=>
      string(9) "text/html"
      [1]=>
      string(21) "application/xhtml+xml"
      [2]=>
      string(15) "application/xml"
      [3]=>
      string(10) "image/webp"
      [4]=>
      string(10) "image/apng"
      [5]=>
      string(3) "*/*"
    }
    ["__renderType"]=>
    NULL
    ["ext"]=>
    NULL
    ["__typesInitialized"]=>
    bool(false)
  }
}

I've turned off the debug option in CackePHP but it was not of much help. I can send the app link via private message.

People are also looking for solutions to the problem: php - wordpress sql regex to find urls starting with http not matching my own domain

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.