1
Diabl0
DB problem, updating my module table resulting "Action not allowed"
  • 2004/7/3 14:50

  • Diabl0

  • Just popping in

  • Posts: 11

  • Since: 2004/7/3 1


Hi...

I'm working now on my first XOOPS module, and got huge problem with making administration for it.

When i trying to change datas stored in table created by my module, DB debug reports:
Quote:

SELECT * FROM xoops_config WHERE (conf_modid = 0 AND conf_catid = 1) ORDER BY conf_order ASC
SELECT sess_data FROM xoops_session WHERE sess_id = 'e3d0ff76764663e1b06b0d3187fad791'
SELECT * FROM xoops_users WHERE uid=1
SELECT * FROM xoops_modules WHERE dirname = 'ipboard'
SELECT * FROM xoops_modules WHERE dirname = 'pogoda'
SELECT * FROM xoops_group_permission WHERE (gperm_name = 'module_admin' AND gperm_modid = 1 AND (gperm_groupid = 1 OR gperm_groupid = 2))

UPDATE xoops_pogoda SET type=0 WHERE type=1
Error number: 0
Error message: Action not allowed


UPDATE xoops_pogoda SET type = 1 WHERE id = 3
Error number: 0
Error message: Action not allowed

select * from xoops_pogoda ORDER BY name ASC

Total: 9 queries


This admin.php file looks like this:
Quote:

<?php
include "../../../mainfile.php";
include XOOPS_ROOT_PATH."/include/cp_functions.php";
include_once XOOPS_ROOT_PATH."/class/xoopsmodule.php";

if (is_object($xoopsUser)) {
$xoopsModule =& XoopsModule::getByDirname("pogoda");
if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
redirect_header(XOOPS_URL."/",3,_NOPERM);
exit();
}
$admintest=1;
} else {
redirect_header(XOOPS_URL."/",3,_NOPERM);
exit();
}

/**
* Główna funkcja
*/
function admin_main() {
global $xoopsConfig, $xoopsModule, $xoopsDB, $module_name, $xoopsUser;

$xoopsDB->query( "UPDATE xoops_pogoda SET type=0 WHERE type=1" );
$xoopsDB->query( "UPDATE xoops_pogoda SET type = 1 WHERE id = 3 " );

OpenTable();
echo '<center><h4><b>Pogoda</b></h4><HR><BR></center>';

$result = $xoopsDB->query( "select * from ".$xoopsDB->prefix("pogoda")." ORDER BY name ASC" );
while( list( $id, $type, $name, $url ) = $xoopsDB->fetchRow( $result ) ) {

[rest of code]

CloseTable();
}

switch ( $_GET['op'] )
{
default:
xoops_cp_header();
admin_main( );
xoops_cp_footer();
}
?>


And xoops_version.php looks like this:

Quote:

<?php
$modversion['name'] = "Pogoda";
$modversion['version'] = "0.1";
$modversion['description'] = "Pogoda";
$modversion['credits'] = "Diabl0/MAO<br />diabl0@mao.pl";
$modversion['author'] = "Diabl0/MAO <diabl0@mao.pl>";
$modversion['license'] = "GNU/GPL";
$modversion['official'] = 0;
$modversion['image'] = "images/pogoda.jpg";
$modversion['dirname'] = "pogoda";

// Menu
$modversion['hasMain'] = 1;

// Templates

$modversion['hasAdmin'] = 1;
$modversion['adminindex'] = "admin/admin.php";
$modversion['adminmenu'] = "admin/menu.php";

// Sql file (must contain sql generated by phpMyAdmin or phpPgAdmin)
// All tables should not have any prefix!
$modversion['sqlfile']['mysql'] = "sql/mysql.sql";
$modversion['tables'][0] = "pogoda";
?>


Why this error happens, and how to fix this?

2
skalpa
Re: DB problem, updating my module table resulting "Action not allowed"
  • 2004/7/3 15:58

  • skalpa

  • Quite a regular

  • Posts: 300

  • Since: 2003/4/16


Welcome, but please use the search function before asking questions in forums, should be faster for everybody ( and sometimes you won't even get answers coz people are bored answering the same questions over and over again) .

Anyway, for your first time here: the db class only allows 'select' queries when the request method is 'GET'. So, ensure your update page is called using POST, or use the queryF() method instead of query().

skalpa.>

PS: I just changed the error message in CVS, will be easier to understand in next releases. One less FAQ

3
Diabl0
Re: DB problem, updating my module table resulting "Action not allowed"
  • 2004/7/3 18:07

  • Diabl0

  • Just popping in

  • Posts: 11

  • Since: 2004/7/3 1


Thanks a lot for answer, and sory that i don't find solution myself... Next time i will try..

Login

Who's Online

219 user(s) are online (142 user(s) are browsing Support Forums)


Members: 0


Guests: 219


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits