Steve Steve - 3 months ago 14
PHP Question

Warning: require_once(includes/EliteScript.php) [function.require-once]: failed to open stream: No such file or directory in

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

Answer

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.

Comments