Author |
Message |
Donovan
Client

Joined: Oct 07, 2003
Posts: 735
Location: Ohio
|
Posted:
Sat Feb 11, 2006 12:37 pm |
|
I have been working on a module for some time now and have it on a test site. I started development on this back when I was running Nuke 7.3
I was frustrated I couldn't let others administer it since Nuke didn't let you, unless you made them a superuser. I have it working "outside" of Nuke on my main site but now I want to move it inside protected by the use of if ( !defined('ADMIN_FILE') )
Since I now run RavenNuke 7.6 v2.02, I am in the process of this.
My question is of the &op= and the case statments that "direct traffic" so to speak.
I have a large case statement in my modules/MILPACS/admin/index.php
Code:switch($op) {
case "AddMedal":include("modules/$module_name/admin/addmedal.php");break;
case "AddRank":include("modules/$module_name/admin/addrank.php");break;
case "AddSoldier":include("modules/$module_name/admin/addsoldier.php");break;
case "AddWeapon":include("modules/$module_name/admin/addweapon.php");break;
case "EditMedal":include("modules/$module_name/admin/editmedal.php");break;
case "EditRank":include("modules/$module_name/admin/editrank.php");break;
case "EditSoldier":include("modules/$module_name/admin/editsoldier.php");break;
case "EditSubUnit":include("modules/$module_name/admin/editsubunit.php");break;
case "EditUnit":include("modules/$module_name/admin/edutunit.php");break;
case "EditWar":include("modules/$module_name/admin/editwar.php");break;
case "EditWeapon":include("modules/$module_name/admin/editweapon.php");break;
case "ServiceRecord":include("modules/$module_name/admin/servicerecord.php");break;
case "EditService":include("modules/$module_name/admin/editservice.php");break;
case "AddServiceRecord":include("modules/$module_name/admin/addservicerecord.php");break;
case "EditServiceRecord":include("modules/$module_name/admin/editservicerecord.php");break;
case "EditWeapon":include("modules/$module_name/admin/editweapon.php");break;
case "AddMedalRecord":include("modules/$module_name/admin/addmedalrecord.php");break;
case "DelServiceRecord":include("modules/$module_name/admin/delservicerecord.php");break;
case "AddMedalRecord":include("modules/$module_name/admin/addmedalrecord.php");break;
case "EditMedalRecord":include("modules/$module_name/admin/editmedalrecord.php");break;
case "DelMedalRecord":include("modules/$module_name/admin/delmedalrecord.php");break;
case "AddDrillReport":include("modules/$module_name/admin/adddrillreport.php");break;
case "EditDrillReport":include("modules/$module_name/admin/editdrillreport.php");break;
case "DelSubUnit":include("modules/$module_name/admin/delsubunit.php");break;
case "AddSubUnit":include("modules/$module_name/admin/addsubunit.php");break;
case "AddAdminUnit":include("modules/$module_name/admin/addadminunit.php");break;
case "DelAdminUnit":include("modules/$module_name/admin/deladminunit.php");break;
break;
}
|
And more in my admin/case/case.milpacs.php
Code:switch($op) {
case "milpacs":
case "AddMedal":
case "AddRank":
case "AddSoldier":
case "AddWeapon":
case "EditMedal":
case "EditRank":
case "EditSoldier":
case "EditSubUnit":
case "EditUnit":
case "EditWar":
case "EditWeapon":
case "ServiceRecord":
case "EditService":
case "AddServiceRecord":
case "EditServiceRecord":
case "EditWeapon":
case "AddMedalRecord":
case "DelServiceRecord":
case "AddMedalRecord":
case "EditMedalRecord":
case "DelMedalRecord":
case "AddDrillReport":
case "EditDrillReport":
case "DelSubUnit":
case "AddSubUnit":
case "AddAdminUnit":
case "DelAdminUnit":
@include("modules/$module_name/admin/index.php");
break;
}
|
But I still have trouble displaying admin pages. The page just refreshes back to the public index.php of my module.
For instance this link here does nothing but sends me to my public index.php
Code:<p><a href="modules.php?name=MILPACS&op=AddSoldier">Add a new troop</a></p>
|
I study others work but can't figure this out. I've had trouble like this before and Kevin has helped me in the past. Evader99 has also assisted and I really appreciate both of their work. I am actually saving much of what they did for me to incorporated into other pages.
Thanks for your time.
-Donovan |
|
|
 |
 |
kguske
Site Admin

Joined: Jun 04, 2004
Posts: 6437
|
Posted:
Sat Feb 11, 2006 6:00 pm |
|
I'd guess you might need the security logic from the 3.1 patch added to your MILPACS admin index file. If you're using old (pre-3.1) logic, it would have that effect. |
_________________ I search, therefore I exist...
Only registered users can see links on this board! Get registered or login! |
|
|
 |
Donovan

|
Posted:
Sat Feb 11, 2006 6:20 pm |
|
Could you direct me in what I would have to do? |
|
|
|
 |
Donovan

|
Posted:
Sat Feb 11, 2006 6:33 pm |
|
Each of my admin pages has
Code:if ( !defined('ADMIN_FILE') )
{
die("Illegal File Access");
}
|
Here is the top of my admin/index.php
Code:
if ( !defined('ADMIN_FILE') )
{
die("Illegal File Access");
}
define('ADMIN_FILE', true);
if (!isset($admin_file)) {
$admin_file = "admin";
}
global $db, $prefix, $aid, $admin_file, $module_name, $sitename;
$module_name = basename(dirname(__FILE__));
require_once("mainfile.php");
$aid = substr("$aid", 0,25);
/* Get list of valid authors */
$row = $db->sql_fetchrow($db->sql_query("SELECT title, admins FROM ".$prefix."_modules WHERE title='$module_name'"));
$row2 = $db->sql_fetchrow($db->sql_query("SELECT name, radminsuper FROM ".$prefix."_authors WHERE aid='$aid'"));
$admins = explode(",", $row['admins']);
$auth_user = 0;
for ($i=0; $i < sizeof($admins); $i++) {
if ($row2['name'] == "$admins[$i]" AND $row['admins'] != "") {
$auth_user = 1;
}
}
/* Check if not an admin*/
if ($row2['radminsuper'] == 1 || $auth_user == 1) {
milpacs();
} else {
include("header.php");
GraphicAdmin();
OpenTable();
echo "<center><b>"._ERROR."</b><br><br>You do not have administration permission for module \"$module_name\"</center>";
CloseTable();
include("footer.php");
}
|
|
|
|
|
 |
Donovan

|
Posted:
Mon Feb 13, 2006 9:06 am |
|
Anybody know how I can fix this. I have a work stoppage
Kevin I think you helped last time and fixed this, but you had to ftp to the site itself and look at and fix my files. I need to understand where I am going wrong so I don't keep repeating mistakes. |
|
|
|
 |
montego
Site Admin

Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Tue Feb 14, 2006 7:14 am |
|
Donovan, you still have an extra break; in your modules/MILPACS/admin/index.php file at the end of your list. That may or may not be it, but try removing that and see if it works. |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
 |
|