News:

Wondering if this will always be free?  See why free is better.

Main Menu

Hacking Attempt when Installing Mod

Started by heavyccasey, August 06, 2007, 01:25:06 AM

Previous topic - Next topic

heavyccasey

I'm testing a mod I created (first try  :D) and when including code, the package parser returns a "Hacking Attempt" message.

I checked the Error Log, it seems this query is the problem:

ALTER TABLE {$db_prefix}boards ADD hideBoard TINYINT NOT NULL DEFAULT '0';

Any help? Thanks :]

Sarge

What is the full error message in the error log?

    Please do not PM me with support requests unless I invite you to.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting

heavyccasey

"Hacking attempt...

ALTER TABLE (my database prefix)_boards ADD hideBoard TINYINT NOT NULL DEFAULT '0';
File: /home/themfu5/public_html/test/Packages/temp/addSetting.php
Line: 10"

Kirby


heavyccasey

It's just:

<?php

   $result
= db_query("
ALTER TABLE
{$db_prefix}boards ADD hideBoard TINYINT NOT NULL DEFAULT '0';", __FILE__, __LINE__);

?>


Am I not supposed to do that? o_O

Kirby

Nope, you need to add this before the query so that SMF doesn't think some random hacker is doing it:

// If SSI.php is in the same place as this file, and SMF isn't defined, this is being run standalone.
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
// Hmm... no SSI.php and no SMF?
elseif (!defined('SMF'))
die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');

Check out the reference add_settings.php in the package SDK ;)

heavyccasey

Thanks. Now it looks like this:
<?php
// If SSI.php is in the same place as this file, and SMF isn't defined, this is being run standalone.
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
// Hmm... no SSI.php and no SMF?
elseif (!defined('SMF'))
die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');

   
$result = db_query("
ALTER TABLE
{$db_prefix}boards ADD hideBoard TINYINT NOT NULL DEFAULT '0';", __FILE__, __LINE__);

?>


but it still doesn't work.

Kirby

ok, just get rid of what i told you to add and throw this in:

define('SMF');

heavyccasey

Sorry, but it still doesn't work.

I tried to shorten the query to:

      ALTER TABLE {$db_prefix}boards ADD hideBoard;

but it still doesn't work. I took the code out completely and it worked.

Sarge

You're using TINYINT (an integer type), not a varchar, so instead of this:
TINYINT NOT NULL DEFAULT '0';
try using this:
TINYINT NOT NULL DEFAULT 0;

    Please do not PM me with support requests unless I invite you to.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting

heavyccasey

I figured out the problem: I removed the semicolon at the end.

Apparently this (Subs.php, line 303) was causing the problem:
// Comments?  We don't use comments in our queries, we leave 'em outside!
elseif (strpos($clean, '/*') > 2 || strpos($clean, '--') !== false || strpos($clean, ';') !== false)
$fail = true;

Advertisement: