Page 1 of 1

Move website to another hosting - issues

Posted: Mon Jul 21, 2014 3:13 am
by EugenX
Hello,

I'm trying to move a website to another hosting, but I get some errors, the website was build by someone I cannot reach anymore so I need to solve this issue by myself and of course with your help.
I think the issue is linked with the path of the files, but not 100% sure. If someone could help me solve my issue, I would really appreciate. Thank you.

This are the errors:

Code: Select all

Deprecated: Assigning the return value of new by reference is deprecated in /home/vol7_5/byethost7.com/b7_15102602/va.likesyou.org/htdocs/__kernel/loader.php on line 80
Strict Standards: Declaration of php4DOMDocument::dump_node() should be compatible with php4DOMNode::dump_node() in /home/vol7_5/byethost7.com/b7_15102602/va.likesyou.org/htdocs/__kernel/domxml-php4-to-php5.php on line 1
Fatal error: Call to undefined function session_unregister() in /home/vol7_5/byethost7.com/b7_15102602/va.likesyou.org/htdocs/__kernel/cot.lib.php on line 64
loader.php:

Code: Select all

<?PHP 
if(!session_id()) session_start();
$_SESSION['ERROR']=0;
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Expires: " . date("r", time()));
header("Content-type: text/html; charset=windows-1251");


// defining absolute path
// for hosting host.md
function LOADER_DOCUMENT_ROOT($path=false) {
	if (!$path) { $path=preg_replace("/\\\\/","/",realpath(dirname(__FILE__))); }
	$result=substr($path,-strlen($path),strpos($path,"public_html"))."public_html";
	if ($result=="public_html") { $result=$_SERVER['DOCUMENT_ROOT']; }
	return $result;
}

$HOST_MD_REAL_PATH=LOADER_DOCUMENT_ROOT();
include_once($HOST_MD_REAL_PATH."/__config/config.inc.php");
// check for the existence of settings.php
 $need_inst=false;
if (!file_exists($HOST_MD_REAL_PATH."/settings.php"))
{
    $need_inst=true;
}
if (@filesize($HOST_MD_REAL_PATH."/settings.php")===0)
{
      $need_inst=true;
}

if ($need_inst)
{
   $inst_txt="<html><head><meta http-equiv='Content-Type' content='text/html; charset=windows-1251'>";
   $inst_txt.="<title>COT.CMS Version 1.2 - Error: No configuration!</title>";
   $inst_txt.="<style>body{font: 84.5% Verdana, Arial, Helvetica, sans-serif;}</style></head><body>";
   $inst_txt.="<br><br><center><strong>COT.CMS Version 1.2</strong>";
   $inst_txt.="<p><font color='red'>Fatal error: no configuration.</font><br> Reinstall the system.<br>";
   echo $inst_txt; exit;
}



if (file_exists($HOST_MD_REAL_PATH."/install.php"))
{
   $inst_txt="<html><head><meta http-equiv='Content-Type' content='text/html; charset=windows-1251'>";
   $inst_txt.="<title>COT.CMS Version 1.2 - Installation is not completed!</title>";
   $inst_txt.="<style>body{font: 84.5% Verdana, Arial, Helvetica, sans-serif;}</style></head><body>";
   $inst_txt.="<br><br><center><strong>COT.CMS Version 1.2</strong>";
   $inst_txt.="<p><font color='red'>Installation is not complete! Delete the file install.php !</font><br>";
   echo $inst_txt;  exit;    
}


include_once($HOST_MD_REAL_PATH."/settings.php");

require_once($HOST_MD_REAL_PATH."/__lang/russian-win-1251_s.inc.php");

if (version_compare(PHP_VERSION,'5','>=')) 
{ 
	require_once('domxml-php4-to-php5.php');
} 
require_once("cot.lib.php");
require_once("kernel.lib.php");
require_once("writeresponse.php");

$XML=domxml_new_doc("1.0");
$Root=$XML->create_element($GLOBALS['cfg']['XML']['Root']);
$XML->append_child($Root);
foreach ($GLOBALS['mod'] as $key=>$value) 
{ 
	if (!$value['status']) 
	{ 
		$inc_path=my_getAbsPath($value['Path']);
		if ($inc_path) 
		{ 
			require_once($inc_path);
		} 
	} next($mod);
} 
$DB=&new MySQLClass();
$DB->openDB($GLOBALS['cfg']['MySQL']['host'],$GLOBALS['cfg']['MySQL']['user'],$GLOBALS['cfg']['MySQL']['password'],$GLOBALS['cfg']['MySQL']['database']);
if ($DB->err)
{
        _catch(1);
};
?>
cot.lib.php:

Code: Select all

<?php 
function isNum($val)
{
(preg_match("/^\d+$/",$val)) ? $res=true:$res=false;return $res;
}
function c($str_value)
{
    return @iconv("windows-1251","UTF-8",$str_value);
}
function my_getAbsPath($path)
{
    return realpath($GLOBALS['cfg']['Server']['root'].$path);
}

function httpGet($var)
{
    if (isset($_GET[$var])) return trim($_GET[$var]);else return false;
}

function httpPost($var)
{
    if (isset($_POST[$var])) return trim($_POST[$var]);else return false;
}

function httpCookie() { }

function httpSess($var)
{
    if(isset($_SESSION[$var])) return $_SESSION[$var];else return false;
}

function mem_state($var,$sesvar)
{
    if ($var!="")
    {
        $_SESSION[$sesvar]=$var;
    }
    elseif (httpSess($sesvar)!="")
    {
        $var=httpSess($sesvar);
    }
    else
    {
        $_SESSION[$sesvar]="";
    }
    return $var;
}

function clearSess()
{
    if(!session_id()) session_start();
    $_SESSION=array();
    if (isset($_COOKIE[session_name()])) setcookie(session_name(),'',time()-42000,'/');
    session_destroy();
}

function _catch($flag=0)
{
    $ret=0;
    ($flag)?$sessname="_ERROR_":$sessname="_MESSAGE_";
    if (httpSess($sessname))
    {
        $ret=httpSess($sessname);
        session_unregister($sessname);
        unset($_SESSION[$sessname]);
        unset($sessname);
    }
    return $ret;
}

function _throw($code=0,$flag=0)
{
($flag)?$sessname="_ERROR_":$sessname="_MESSAGE_";
$_SESSION[$sessname]=$code;
}

function getRandomStringN($numchars=8)
{
    $ret="";
    $a ="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
    for($i=0;$i<$numchars;$i++) $ret.=substr($a,rand(0,strlen($a)),1);
    return $ret;
}

function getRandomString()
{
    return md5(microtime().rand());
}
//date from the database comes as timestamp, returns an array with the date
function dateFromBase($date)
{
    $ret['year']=date("Y",$date);
    $ret['month']=date("m",$date);
    $ret['day']=date("d",$date);
    $ret['hour']=date("H",$date);
    $ret['minute']=date("i",$date);
    $ret["second"]=date("s",$date);
    return $ret;
}
//comes an array, returns the timestamp
function date2Base($date)
{
    $ret=time();
    if (is_array($date))
    {
        $date['year']=(key_exists('year',$date))?$date['year']:date("Y");
        $date['month']=(key_exists('month',$date))?$date['month']:date("m");
        $date['day']=(key_exists('day',$date))?$date['day']:date("d");
        $date['hour']=(key_exists('hour',$date))?$date['hour']:date("H");
        $date['minute']=(key_exists('minute',$date))?$date['minute']:date("i");
        $date['second']=(key_exists('second',$date))?$date['second']:date("s");
        $ret=date("U",mktime($date['hour'],$date['minute'],$date['second'],$date['month'],$date['day'],$date['year']));
    }
    return $ret;
}
//check the array with the date
function checkDateArr($formDate)
{
    $formDate['year']=(isNum($formDate['year']))?$formDate['year']:date('Y');
    $formDate['month']=(isNum($formDate['month']))?$formDate['month']:date('m');
    $formDate['day']=(isNum($formDate['day']))?$formDate['day']:date('d');
    $formDate['hour']=(isNum($formDate['hour']))?$formDate['hour']:date('H');
    $formDate['minute']=(isNum($formDate['minute']))?$formDate['minute']:date('i');
    return $formDate;
}
?>
Image
Image

Re: Move website to another hosting - issues

Posted: Mon Jul 21, 2014 3:38 am
by requinix
Ugh. Not a fan of that code.

All of those error message refer to specific lines...
Deprecated: Assigning the return value of new by reference is deprecated in /home/vol7_5/byethost7.com/b7_15102602/va.likesyou.org/htdocs/__kernel/loader.php on line 80
Remove the &. That hasn't been needed for more than a decade.
Strict Standards: Declaration of php4DOMDocument::dump_node() should be compatible with php4DOMNode::dump_node() in /home/vol7_5/byethost7.com/b7_15102602/va.likesyou.org/htdocs/__kernel/domxml-php4-to-php5.php on line 1
There's not much you can/should do about that. See if there isn't an updated version of whatever that file is (because it's probably written by someone else and not the developer you had).
Fatal error: Call to undefined function session_unregister() in /home/vol7_5/byethost7.com/b7_15102602/va.likesyou.org/htdocs/__kernel/cot.lib.php on line 64
Remove it. What it used to do is covered by the other code around it.

Re: Move website to another hosting - issues

Posted: Mon Jul 21, 2014 4:51 am
by EugenX
requinix wrote:Remove the &. That hasn't been needed for more than a decade.
If I remove & then I get another error:
Parse error: syntax error, unexpected '=' in /home/vol7_5/byethost7.com/b7_15102602/va.likesyou.org/htdocs/__kernel/loader.php on line 80
There's not much you can/should do about that. See if there isn't an updated version of whatever that file is (because it's probably written by someone else and not the developer you had).
No other file
Remove it. What it used to do is covered by the other code around it.
If I remove that line I get this error:

Fatal error: Incompatible file format: The encoded file has format major ID 3, whereas the Loader expects 5 in /home/vol7_5/byethost7.com/b7_15102602/va.likesyou.org/htdocs/code/code.php on line 0

The fact is that everything works fine on the old hosting it should work the same on the new hosting without changing anything.

Re: Move website to another hosting - issues

Posted: Mon Jul 21, 2014 3:33 pm
by requinix
EugenX wrote:
requinix wrote:Remove the &. That hasn't been needed for more than a decade.
If I remove & then I get another error:
Parse error: syntax error, unexpected '=' in /home/vol7_5/byethost7.com/b7_15102602/va.likesyou.org/htdocs/__kernel/loader.php on line 80
What do you have? It should look like

Code: Select all

$DB=new MySQLClass();
EugenX wrote:
There's not much you can/should do about that. See if there isn't an updated version of whatever that file is (because it's probably written by someone else and not the developer you had).
No other file
That sucks. Are you able to set php.ini settings somewhere?
EugenX wrote:
Remove it. What it used to do is covered by the other code around it.
If I remove that line I get this error:

Fatal error: Incompatible file format: The encoded file has format major ID 3, whereas the Loader expects 5 in /home/vol7_5/byethost7.com/b7_15102602/va.likesyou.org/htdocs/code/code.php on line 0
That sucks.

Does you host offer different versions of PHP? Like the choice of running PHP 5.3 and 5.5?
EugenX wrote:The fact is that everything works fine on the old hosting it should work the same on the new hosting without changing anything.
Uh, no. Merely going from 5.3 to 5.5 is four years of changes, and some of that code is written for PHP 4 which hasn't even been supported, let alone in active development, for almost 6 years.