2

This is a licence based script and it has a valid licence using SourceGuardian. The script was working fine on client's old server and he hired me to migrate it to the new server.

After migrating, everything was working fine but not the login area, when trying to login it gives the follow error

Warning: require_once(includes/EliteScript.php) [function.require-once]: failed to open stream: No such file or directory in /home/sitetalk/public_html/interface/index.php on line 3

Fatal error: require_once() [function.require]: Failed opening required 'includes/EliteScript.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/sitetalk/public_html/interface/index.php on line 3

Registration works fine and can see the filled data in database. Tried to take it to the script developer, but there's no response since 3months.

Not sure, what causing this error to happen. Pasting the part of code of the shown file names.

EliteScript.php

    <?php
global $config;
global $country_array;
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ^ E_DEPRECATED);
define("ES_VERSION", "7.0.4");
define("ES_SERVER", "http://primary.shadowscripts.com/master/server.php");
define("ES_FLASH", "/includes/graphs/src/lang/my.inc.php");
define("ES_VERIFYDEV", "eth0");
require_once("ShadowScripts.php");
require_once("interface/template.php");
spl_autoload_register(function($class)
    {
    if ($class == "EliteScriptBase")
        {
        return 0;
        }
    if ($class != "FusionCharts_Gen.php")
        {
        $class = preg_replace("/\\_/", "/", $class);
        }
    $class       = preg_replace("/\\\\/", "/", $class);
   ?>

and

index.php

<?php 
global $es;
global $ui;
global $member_id;
global $base_url;
global $member_url;
global $image_url;
global $admin_url;
require_once("includes/EliteScript.php");
$es = new EliteScript();
$ui = new UserInterface();
$es->RequireMember();
$member_id = $es->GetMemberId();
$base_url = $es->GetConfig("baseUrl");
$member_url = $es->GetConfig("memberUrl");
$image_url = $es->GetConfig("imageUrl");
$f_login_page = $es->GetLoginUIPage();
if( $f_login_page ) 
{
    $ui->ChangePage($f_login_page);
}

$es->DisplayHeader($es->getText("home_window_title"), "member.php");
switch( $_REQUEST["do"] ) 
{
    case "toggle_autorenew":
        toggle_autorenew();
        break;
    default:
        display_main();
}
$es->DisplayFooter();
echo "\r\n\r\n\r\n\r\n\r\n\r\n";
function toggle_autorenew()
{
    global $es;
    global $ui;
    global $member_id;
    global $base_url;
    global $member_url;
    global $image_url;
    global $admin_url;
    $way = $_REQUEST["way"];
    $es->ToggleMembershipAutoRenew($member_id, $way);
    $ui->SetMessage("msg", $es->getText("home_togglerenew_success"));
    $ui->ChangePage($_SERVER["PHP_SELF"]);
}

function display_main()
?>

As it says on line 3, I find nothing to edit. Please help what I can do to fix this.

Thanks

Steve
  • 29
  • 2
  • 10
  • check your include directory file are there? – Qaisar Satti May 13 '15 at 05:14
  • EliteScript.php file directory path? – Qaisar Satti May 13 '15 at 05:17
  • public_html/includes/EliteScript.php – Steve May 13 '15 at 05:21
  • If you moved the files and folders as they were and it's a new server, consider to check your `require_path` in your php.ini file. – Ofir Baruch May 13 '15 at 05:23
  • Ok bro, let me check. – Steve May 13 '15 at 05:24
  • index.php file directory path? – Qaisar Satti May 13 '15 at 05:25
  • @QaisarSatti public_html/interface/index.php – Steve May 13 '15 at 05:33
  • @OfirBaruch can't find any php.ini file in the cpanel, but when I've created a new file for phpinfo();, it showed this Configuration File (php.ini) Path /usr/lib Loaded Configuration File /usr/local/lib/php.ini But I can't find the location of the file. – Steve May 13 '15 at 05:34
  • You are attempting to include the EliteScript file from public_html/interface/includes/EliteScript.pho but the file is located one directory up. So you changed directory structure while uploading. – Luceos May 13 '15 at 05:52
  • @Luceos no idea how it happend bro, I havn't changed anything, but now I have the idea where this error coming from. The script is actually encoded with sourceguardian, need to decode it. Tried to copy the includes/EliteScript.php to interface folder, but it was asking for more and more files and it's a big mess, so I'll ask my client to get one file decoded. So, Can you please advice me which file I should edit? just the includes/EliteScript.php or interface/index.php? – Steve May 13 '15 at 06:00

3 Answers3

3

Change this and check it is working or not

require_once("includes/EliteScript.php");

to

require_once("../includes/EliteScript.php");

Explanation current code calling current directory/includes/EliteScript.php but your file in previous directory so you have to add ../ it will include file from previous directory.

Qaisar Satti
  • 2,742
  • 2
  • 18
  • 36
2

The problem you encounter has to do with relative and absolute paths in the include and require functions of php. Your index file is requiring the EliteScript.php with a relative path.

Articles about the difference between relative and absolute:

In your comments you mention the files are encrypted, so the best way to handle this is to keep the directory structure in exact the same way as the files are given to you.

The specifically point out (as I've done in the comments) where the problem lies:

public_html/interface/index.php loads the relative path includes/EliteScript.php which therefor will require the path public_html/interface/includes/EliteScript.php however your EliteScript.php is located in public_html/includes/EliteScript.php.

Community
  • 1
  • 1
Luceos
  • 6,629
  • 1
  • 35
  • 65
  • I have tried to copy the files to where it is actually expecting, but it's asking for more files and tried to all I can. there are alot of files and it was hard to change anymore locations when it end up at /home/sitetalk/public_html/interface/includes/../config.inc.php How to make it to follow relative path then? I can get 1 file decoded, which one should I? The server it was migrated to now is from the same ISP, I havn't changed any file's location, I have migrated it as it is. – Steve May 13 '15 at 06:35
  • You don't change the code otherwise you break stuff. Try to get back to the directory structure it was meant to be and if it needs more files then you probably f**ked up :P Sorry to say. Try uploading from scratch and don't change directory structure (again). – Luceos May 13 '15 at 07:05
  • No, I havn't changed the directory structure in any form bro. I have just compressed the files and folders on old server and extracted in new one. It always works fine until it's changed to new server, and developer needs to fix it, but he's not active since last 3 months. That is why I'm here. :( – Steve May 13 '15 at 08:39
0

The other answers maybe true, but they didn't fix my problem.

I did exactly as it was showing in this article

I edited the include_path in php.ini and it's working like charm.

Steve
  • 29
  • 2
  • 10