News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

How do I disable EVAL with query? (RESOLVED) Thanks!

Started by goitalone, September 03, 2007, 02:00:29 PM

Previous topic - Next topic

goitalone

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!

Elmacik

Run this query in phpMyAdmin:
REPLACE INTO smf_settings (variable, value) VALUES ('disableTemplateEval', 1);
Home of Elmacik

goitalone

#2
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.

goitalone

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

Elmacik

#4
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.
Home of Elmacik

goitalone

How will I know if it worked? I don't see anything different happening.

babjusi

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''

goitalone

#7
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

goitalone

#8
How do I swtich it back to eval?

Elmacik


<?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();
?>

Home of Elmacik

goitalone

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.

Webrunner

Actually, it doesn't fix any errors, it justs disables them.
Kind of like sticking your head in the sand ;)
There is a difference between knowing the path and walking the path.

=========================================
Vrouwen Power! | Sprintweb: No nonsense e-Business consultancy

goitalone

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.

Webrunner

There is a difference between knowing the path and walking the path.

=========================================
Vrouwen Power! | Sprintweb: No nonsense e-Business consultancy

goitalone

No biggie, just making sure no one else gets confused. ;)

Advertisement: