Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
Donovan
Client



Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Sat Feb 19, 2005 5:08 pm Reply with quote

I am deep into developing a backend for my MILPACS module. How does Nuke handle administration outside its public_html/admin/modules/module_name.php?

I have many pages for the backend such as editsoldier, editunit, addsoldier, addweapon, addrank....this list goes on.

Where should these be stored in the Nuke structure if I want to also have an external administration login?

Much like vWar. You can either access the admin function thru the admin panel in Nuke or there is a separate login in the modules.php?name=vwar page at the bottom.

I assume it can access modules/vwar/admin.php
 
View user's profile Send private message Visit poster's website ICQ Number
sixonetonoffun
Spouse Contemplates Divorce



Joined: Jan 02, 2003
Posts: 2496

PostPosted: Sat Feb 19, 2005 5:41 pm Reply with quote

I like the method of putting the modules admin files in the modules directory
Say modules/MILPACS/admin/
The reason I like this is its much easier to simply delete one directory then if you have to remove or upgrade a module. But it will require a little extra work to make it safe and still leave the non nuked access because the main protection for such a directory at least on Apache is to put deny from all in the .htaccess file and access those pages only with admin.php

_________________
[b][size=5]openSUSE 11.4-x86 | Linux 2.6.37.1-1.2desktop i686 | KDE: 4.6.41>=4.7 | XFCE 4.8 | AMD Athlon(tm) XP 3000+ | MSI K7N2 Delta-L | 3GB Black Diamond DDR
| GeForce 6200@433Mhz 512MB | Xorg 1.9.3 | NVIDIA 270.30[/size:2b8 
View user's profile Send private message
Donovan







PostPosted: Sat Feb 19, 2005 7:39 pm Reply with quote

Thanks for the feedback.

Do you happen to know why I would be getting this in a lost_password.php page.

Quote:
Fatal error: Cannot redeclare head() (previously declared in /home/thirdadm/public_html/header.php:29) in /home/thirdadm/public_html/header.php on line 28


All my other pages have an include("header.php") in them and don't get this error.

Code:
<? 

//////////////////////////////////////////////////////////////////////
//===========================
// MILPACS
//
// This is the Military Personell and Classification System.
//  Lost pasword page
//
//
///////////////////////////////////////////////////////////////////////

if (!eregi("modules.php", $PHP_SELF )) {
   die ("You can't access this file directly...");
    }
$index=0;
require_once("mainfile.php");
//finds the server's root directory
$self = dirname(__FILE__ );
$nukemod = basename($self);
$rootdir = eregi_replace("/modules/$nukemod", "", $self);
global $module_name, $db;
$module_name = basename(dirname(__FILE__ ));
include("modules/MILPACS/db.inc.php");
include("header.php");


switch($_POST['recover']){
    default:
    include 'lost_password.php';
    break;
     
    case "recover":
    recover_pw($_POST['email']);
    break;
}
function recover_pw($email){
    if(!$email){
        echo "You forgot to enter your Email address <strong>Soldier</strong><br />";
        include 'lost_password.php';
        exit();
    }
    // quick check to see if record exists     
    $sql_check = mysql_query("SELECT * FROM milpacs_members WHERE email='$email'");
    $sql_check_num = mysql_num_rows($sql_check);
    if($sql_check_num == 0){
        echo "No records found matching your email address<br />";
        include 'lost_password.php';
        exit();
    }
    // Everything looks ok, generate password, update it and send it!
     
    function makeRandomPassword() {
          $salt = "abchefghjkmnpqrstuvwxyz0123456789";
          srand((double)microtime()*1000000);
          $i = 0;
          while ($i <= 7) {
                $num = rand() % 33;
                $tmp = substr($salt, $num, 1);
                $pass = $pass . $tmp;
                $i++;
          }
          return $pass;
    }

    $random_password = makeRandomPassword();

    $db_password = md5($random_password);
     
    $sql = mysql_query("UPDATE milpacs_members SET password='$db_password' WHERE email='$email'");
     
    $subject = "Your password for the MILPCAS system!";
    $message = "Hello Soldier, your password as been reset.
     
    New Password: $random_password
      
   http://www.3rd-infantry-division.net
     
    Thanks!
    The Webmaster
     
    This is an automated response, please do not reply!";
     
    mail($email_address, $subject, $message, "From: 3rd Infantry Division<admin@3rd-infantry-division.net>\n
        X-Mailer: PHP/" . phpversion());
    echo "Your password has been sent! Please check your email!<br />";
    include 'login.php';
}
?>
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©