Fatal Error eval()'d code

Discussion for various published PHP frameworks, including Zend Framework, CodeIgniter, Kohana, CakePHP, Yii, Symfony, and others.

Moderator: General Moderators

Post Reply
ojoc88
Forum Newbie
Posts: 12
Joined: Tue Oct 22, 2013 6:50 pm

Fatal Error eval()'d code

Post by ojoc88 »

Hi all,

I'm run a script on xampp server.
After login , i get this error:

Fatal error: Call to undefined function session_register() in D:\xampp\htdocs\DSM\loader.php(22) : eval()'d code on line 25

php code as per below

Code: Select all

<?php require_once('Connections/drsa.php'); 

mysql_select_db($database_drsa, $drsa);
$query_test = "SELECT * FROM backups WHERE backups_id = 

10";
$test = @(mysql_query($query_test, $drsa));
if(@($test)) {


if(isset($_GET['load'])) {
$searchwords = $_GET['load']; 
$searchwords = stripslashes($searchwords);
$searchwords = strip_tags($searchwords);
$searchwords = trim($searchwords, "'");
$load = $_GET['load'];
mysql_select_db($database_drsa, $drsa);
$query_file = "SELECT * FROM system WHERE system_name = 

'$searchwords'";
$file = mysql_query($query_file, $drsa);
$row_file = mysql_fetch_assoc($file);
$totalRows_file = mysql_num_rows($file);

$str = $row_file['system_value'];
echo eval ( $str). "\n";
 
 } } else {  header("Location: install.php"); } 
?>

please help to fix this

tq
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Fatal Error eval()'d code

Post by requinix »

session_register() is not available in PHP 5.4+. Also, eval() is a horrible function - I'm sure there's a better way to do what you need without storing PHP code in a database.
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: Fatal Error eval()'d code

Post by Eric! »

I can't even think of a single reason to run code with eval from a database. Wow.

I took a google around and found this is an old xamp package C:\xampp\htdocs\DSM1.0\loader.php for xampp. This might work better if you delete XAMPP and install WAMP. And use v7.0.6 phpfusion or newer.
Post Reply