Forum Moderators: coopster
Thanks,
Thomas
global $prefix, $dbi, $admin;
$result = sql_query("select main_module from ".$prefix."_main", $dbi);
list($main_module) = sql_fetch_row($result, $dbi);
$result = sql_query("select title from ".$prefix."_modules", $dbi);
while (list($title) = sql_fetch_row($result, $dbi)) {
$a = 0;
$handle=opendir('modules');
while ($file = readdir($handle)) {
if ($file == $title) {
$a = 1;
}
}
closedir($handle);
if ($a == 0) {
sql_query("delete from ".$prefix."_modules where title='$title'", $dbi);
}
}
......removed a ton of display code....jatar_k
/* For Admin */
if (is_admin($admin)) {
$handle=opendir('modules');
while ($file = readdir($handle)) {
if ( (!ereg("[.]",$file)) ) {
$modlist .= "$file ";
}
}
closedir($handle);
$modlist = explode(" ", $modlist);
sort($modlist);
for ($i=0; $i < sizeof($modlist); $i++) {
if($modlist[$i]!= "") {
$result = sql_query("select mid from ".$prefix."_modules where title='$modlist[$i]'", $dbi);
list ($mid) = sql_fetch_row($result, $dbi);
if ($mid == "") {
sql_query("insert into ".$prefix."_modules values (NULL, '$modlist[$i]', '$modlist[$i]', '0', '0')", $dbi);
}
}
}
......removed a few lines....jatar_k
$result = sql_query("select title, custom_title from ".$prefix."_modules where active='0' ORDER BY title ASC", $dbi);
while(list($mn_title, $custom_title) = sql_fetch_row($result, $dbi)) {
......removed a few more lines....jatar_k
[edited by: jatar_k at 7:43 pm (utc) on Feb. 2, 2004]
[edit reason] removed code dump [/edit]
I was working a little on phpBB and found that was pretty effective when I was doing larger changes on it, since I had no idea where all the stuff actually was located.
I would think that error is coming from the insert statement.
if ($mid == "") {
sql_query("insert into ".$prefix."_modules values (NULL, '$modlist[$i]', '$modlist[$i]', '0', '0')", $dbi);
}
you need to take a look at the actual query and compare it with the table it is trying to insert into. I would guess that the number of params in the insert statement is wrong.