Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: goitalone on September 03, 2007, 02:00:29 PM

Title: How do I disable EVAL with query? (RESOLVED) Thanks!
Post by: goitalone on September 03, 2007, 02:00:29 PM
I never figured out how to send queries. I need to know how so I disable eval and figure out a buncha errors in my log.


Thanks!
Title: Re: How do I disable EVAL with query?
Post by: Elmacik on September 03, 2007, 02:04:38 PM
Run this query in phpMyAdmin:
REPLACE INTO smf_settings (variable, value) VALUES ('disableTemplateEval', 1);
Title: Re: How do I disable EVAL with query?
Post by: goitalone on September 03, 2007, 02:07:01 PM
Does it have to be from phpMyAdmin? $#!tz!

My phpMyAdmin is broken and I cannot get the stupid thing to work not matter what I try and do to fix it.
Title: Re: How do I disable EVAL with query?
Post by: goitalone on September 03, 2007, 02:12:26 PM
Anyone ever have an error like this before?

Error
MySQL said: 

#1045 - Access denied for user 'root'@'localhost' (using password: NO)


phpMyAdmin was unable to read your configuration file!
This might happen if PHP finds a parse error in it or PHP cannot find the file.
Please call the configuration file directly using the link below and read the PHP error message(s) that you receive. In most cases a quote or a semicolon is missing somewhere.
If you receive a blank page, everything is fine.

./config.inc.php
Title: Re: How do I disable EVAL with query?
Post by: Elmacik on September 03, 2007, 02:14:55 PM
Then save the code below into a file and name it eval.php
Upload it to your forum directory. Its important.
Run it from the browser, it will do the query for you.


<?php
if (!@include_once('Settings.php'))  die ('Put this file to where SMF is.');
mysql_connect($db_server$db_user$db_passwd);
if (!@
mysql_select_db($db_name)) die ('Cant get the database information.');
$request mysql_query("REPLACE INTO {$db_prefix}settings (variable, value) VALUES ('disableTemplateEval', '1');");
if (
$request) echo 'Using eval in templates is now disabled.';
else echo 
'Something wrong. Debug info:'mysql_error();
mysql_close();
?>



Edit: Your phpMyAdmin is not broken actually. It doesnt know the MySQL password. Quickly contact your host and ask them to configure phpMyAdmin correctly to know the valid MySQL password.
Title: Re: How do I disable EVAL with query?
Post by: goitalone on September 03, 2007, 02:34:16 PM
How will I know if it worked? I don't see anything different happening.
Title: Re: How do I disable EVAL with query?
Post by: babjusi on September 03, 2007, 02:38:32 PM
After you point your browser to that code elmacik posted, you should see a message saying something like ''Using eval in templates is now disabled''
Title: Re: How do I disable EVAL with query?
Post by: goitalone on September 03, 2007, 02:42:54 PM
Quote from: babjusi on September 03, 2007, 02:38:32 PM
After you point your browser to that code elmacik posted, you should see a message saying something like ''Using eval in templates is now disabled''

Edit: NM
Title: Re: How do I disable EVAL with query?
Post by: goitalone on September 03, 2007, 05:19:16 PM
How do I swtich it back to eval?
Title: Re: How do I disable EVAL with query?
Post by: Elmacik on September 03, 2007, 06:18:09 PM

<?php
if (!@include_once('Settings.php'))  die ('Put this file to where SMF is.');
mysql_connect($db_server$db_user$db_passwd);
if (!@
mysql_select_db($db_name)) die ('Cant get the database information.');
$request mysql_query("REPLACE INTO {$db_prefix}settings (variable, value) VALUES ('disableTemplateEval', '0');");
if (
$request) echo 'Using eval in templates is now enabled.';
else echo 
'Something wrong. Debug info:'mysql_error();
mysql_close();
?>

Title: Re: How do I disable EVAL with query?
Post by: goitalone on September 04, 2007, 10:44:06 AM
K, I got it...fixed all my errors in my log I think...so far anyway.

Many thanks to Elmacik for the quick response and for the resolution.
Title: Re: How do I disable EVAL with query? (RESOLVED) Thanks!
Post by: Webrunner on September 05, 2007, 02:14:13 AM
Actually, it doesn't fix any errors, it justs disables them.
Kind of like sticking your head in the sand ;)
Title: Re: How do I disable EVAL with query? (RESOLVED) Thanks!
Post by: goitalone on September 05, 2007, 07:29:27 AM
Quote from: Webrunner on September 05, 2007, 02:14:13 AM
Actually, it doesn't fix any errors, it justs disables them.
Kind of like sticking your head in the sand ;)

Um, no what I mean was... I was able to fix the errors by locating them after disabling eval. It was nearly impossible to see where the errors were coming from until it was disabled.

I never meant to imply that disabling eval alone solved the errors.

Just wanted to clear that up.
Title: Re: How do I disable EVAL with query? (RESOLVED) Thanks!
Post by: Webrunner on September 05, 2007, 05:37:06 PM
Ahh.. OK, that was a misunderstanding then :)
Title: Re: How do I disable EVAL with query? (RESOLVED) Thanks!
Post by: goitalone on September 05, 2007, 05:50:38 PM
No biggie, just making sure no one else gets confused. ;)