Welcome to Fogfighters Hungary!
 
  Login or Register
.week  
Time
 
 
 
Languages
Select Interface Language:

 
Google Translation
Translation
 
Traffic Report
 
Where are you from?
 
Map Random
Objective
Subway
View Subway
Description:<br /> <br /> While on the retreat the Axis have planted dynamite in an key african city subway which threatens to destroy its foundations. The Allies have to remove the dynamite threat and detonate
Hits: 4
Total Maps: 85
 
Modules
· Home
· About Easter
· Büntetés kalkulátor
· Bible
· Biorythm
· Birds
· Black Gallery
· Cats
· Coppermine
· Dogs
· eCards
· ET Game manual
· ET Handbuch
· ET játékleírás
· ET Maps
· Fórumok
· FIFA World Cup 2006
· Fish
· Google Guide
· Googlemaps
· Hírküldés
· Help Desk
· Internet_TV
· Keresés
· Letöltések
· Members List
· Member_Map
· News
· Online Radios
· PHP-Nuke_HOWTO
· PHP-Nuke_Tools
· Private Messages
· Punkbuster
· Saját beállításaid
· Shout Box
· Statisztikák
· Szavazások
· Szerencsejáték
· Tagfelvétel
· Viccek
· Videó kollekció
· Web címek
· Web Development
 
MS-Analysis
Top-Ten Countries visiting Fogfighters Hungary

1 United States United States
2 China China
3 Viet nam Viet nam
4 Russian Federation Russian Federation
5 France France
6 Hungary Hungary
7 unknown unknown
8 Ukraine Ukraine
9 Canada Canada
10 United Kingdom United Kingdom
11 Germany Germany
12 Netherlands Netherlands
13 Poland Poland
14 Italy Italy
15 Taiwan, Province of China Taiwan, Province of China
16 Seychelles Seychelles
17 Australia Australia
18 Romania Romania
19 Indonesia Indonesia
20 India India
21 Thailand Thailand
22 Sweden Sweden
23 Brazil Brazil
24 Japan Japan
25 South Africa South Africa
26 Lithuania Lithuania
27 Argentina Argentina
28 Spain Spain
29 Iran, Islamic Republic of Iran, Islamic Republic of
30 Chile Chile
31 Luxembourg Luxembourg
32 Turkey Turkey
33 Moldova, Republic of Moldova, Republic of
34 Korea, Republic of Korea, Republic of
35 Belarus Belarus
36 Malaysia Malaysia
37 Venezuela Venezuela
38 Switzerland Switzerland
39 Singapore Singapore
40 Colombia Colombia
41 Hong Kong Hong Kong
42 Mexico Mexico
43 Mongolia Mongolia
44 Czech Republic Czech Republic
45 Belize Belize
46 Greece Greece
47 Honduras Honduras
48 Estonia Estonia
49 Latvia Latvia
50 Bulgaria Bulgaria

View MS-Analysis
 
Scrolling Links
Mods:































Community:




































Clans:






























































League:










Anticheat:












Other:

































 
Special days




World Sport Journalist Day


 
Képes Naptár
There is a problem right now with this block.
 
CPG Random Picture

Kilóg a lóláb

 
Latest Videos


Last added videos

Orvosnál

Orvosnál

Last added videos

Funny

Funny Mortar

Last added videos

Shy

Shy Rose - I Cry For You
 
Module creation, administrator part

21.4. Module creation, administrator part

It's time to create the administration part of the module. In this very simple module the only function that will work on the DB will be the one in which we can modify the text of one of the three languages that we have created. First of all, we have to create the files to insert in the folders:

  • admin/case

  • admin/links

  • admin/modules

It's important to remember how much we have just said in Section 9.1:

Admin:

contains 4 subdirectories (links, language, case, modules) that manage the various administration modules. The folder that holds the files is modules/admin/ .

The folder admin/links instead says that the admin module must recall and position one language in admin for that determined module.

Example (Administration for the FAQ module):

if (($radminsuper==1) OR ($radminfaq==1)) {
adminmenu("admin.php?op=FaqAdmin ", "" _FAQ." ", "faq.gif");
}

This module:

  • Verifies the administration rights (This module can be set up so it can be viewed by the superadmin or an admin)

  • It passes a "CASE" (op=FaqAdmin) that indicates to the admin.php file (that includes all the admin modules) the module to call, associates a value in order to translate the term "FAQ" and associates an image for the visual administration (faq.gif).

The folder admin/case instead serves to define the module to be used in each specified case . This is important when, using the same admin file, we need to perform more operations using a CASE statement:

case1 = insert
case2 = cancel
etc...

In fact it says which module to call in order to verify the CASE condition. For example, in the FAQ module there are lots of cases, here are the last 2:

case "FaqAdmin":
case "FaqCatGo":
include ("admin/modules/adminfaq.php");
break;

Both CASE statements call the adminfaq.php file, but they are used for different operations. The first one calls the file with the default scheme, the second, on the other hand, gives its O:K. to insert a new category.

This happens through a string like "admin.php?op=FaqAdmin" in the first case and "admin.php?op=FaqCatGo" in the second.

We will now create, in the following order, the files:

  • admin/modules/topolino.php

  • admin/case/case.topolino.php

  • admin/links/links.topolino.php

In order to create the file inside the modules folder (modules/topolino.php) we must have a structure of this type:

  • Starting part of the file (Similar for all the modules)

  • Definition of the necessary functions.

  • Definition of the necessary cases in order to call the various functions for the admin module.

  • Final part of the file.

The syntax for the starting part of the file is the following:

<?php
if (!eregi("admin.php", $_SERVER['PHP_SELF'])) { die ("Access Denied"); }
$querystr = "SELECT radminsuper, admlanguage FROM "
.$prefix."_authors where aid='$aid'";
$result = sql_query($querystr, $dbi) or die ("invalied query");
list($radminsuper) = sql_fetch_row($result, $dbi);
if ($radminsuper==1) {

This part of the file controls the administration rights for whoever calls it, a control on which language to use and (not in this module) a control on the administrator's rights. An administrator could have only partial rights of administration on modules or some modules can be managed only by a superadmin. In our specific case the module can be managed only by the superadmin because the control is only:

if ($radminsuper==1)

In case there are some specific rights (for example in the reviews module) the rights to control would have been:

if (($radminreviews==1) OR ($radminsuper==1))

Activating the rights on two levels on new modules indeed isn't simple, you must specify in the nuke_authors table a new field that designates the rights, then modify admin/modules/authors.php adding the checkbox for the rights of the new module and modify the corresponding UPDATE queries.

Let's go back to our module: we have already seen the initial part, which is obligatorily. The end of the open IF statement is:

} else {
echo "Access Denied";
}

All that we find in the middle, are the management functions and the cases that must be checked, which we will now go on to construct. There are a couple of rules to follow in order to construct the admin functions:

  • We must include a header at the beginning of the function and a footer at the end:

    include("header.php");
    include("footer.php");
    

We have to include the GraphicAdmin(); function immediately after the header. It will display the navigation panel that leads to all the other admin links. The functions we'll now go to create are:

  • Display of the database records

  • Selection of the record and its insertion in a modifiable text field

  • Modification of the record through insertion in the database of the value modified in the text field.

Here is the code of the function which accomplishes the record selection:

function mousedisplay() {
   global $admin, $bgcolor2, $prefix, $dbi, $multilingual;
   include ("header.php");
   GraphicAdmin();
   opentable();
   $querystr = "SELECT idperson, nameperson FROM ".$prefix."_topolino";
   $resultpersons = sql_query($querystr, $dbi) 
   or die ("invalid query in mousedisplay");
   for ($m=0; $m < sql_num_rows($resultpersons, $dbi); $m++)
   {
      list ($idperson, $nameperson) = mysql_fetch_row($resultpersons);
      $tmpLink = "<a href=\"admin.php?op=mouseselect&idtopo="
                 .$idperson."\">Select mouse</A><br>";
      echo   "$idperson - $nameperson $tmpLink";
   }
   closetable();
   include("footer.php");
}

The next function to implement is the one that corresponds to the selection of one of the three records:

function mouseselect() {
   global $admin, $bgcolor2, $prefix, $dbi, $multilingual, $idtopo;
   include ("header.php");
   GraphicAdmin();
   opentable();
   echo "idtopo=".$idtopo;
   $querystr = "SELECT idperson, nameperson 
                FROM ".$prefix."_topolino where idperson='$idtopo'";
   $resultpersons = sql_query($querystr, $dbi) 
   or die ("Invalid query in mouseselect");
   for ($m=0; $m < sql_num_rows($resultpersons, $dbi); $m++){
      list($idperson, $nameperson) = sql_fetch_row($resultpersons, $dbi);
      echo "<form action=\"admin.php\" method=\"post\">";
      echo "<input type=\"text\" name=\"nameperson\" size=\"20\" 
             maxlength=\"20\" value=\"$nameperson\"><br><br>";
      echo "<input type=\"hidden\" name=\"idperson\"value=\"$idtopo\" > ";
      echo "<input type=\"hidden\" name=\"op\" value=\"mousemodify\" > ";
      echo "<input type=\"submit\" value=\""._ADDTOPO."\" > ";
      echo "</form >";
   }
   closetable();
   include("footer.php");
}

It is very important to take note of some things:

  1. The variables that we insert will be the ones to be checked, in fact you can see the variable "$idtopo" was inserted between the used variables.

  2. The value checked in the CASE statements is passed to us through a hidden form field

(< input type=\"hidden\"name=\"op\"value=\"mousemodify\">).

The last function we consider is the one that corresponds to the update of the values in the database (Here too we added the two variables that we were interested in ($nameperson, $idperson):

function mousemodify() {
   global $admin, $bgcolor2, $prefix, $dbi, $multilingaul, 
$idtopo, $nameperson, $idperson;
   include ("header.php");
   GraphicAdmin();
   Opentable();
   sql_query("Update ".$prefix."_topolino set nameperson=' $nameperson' 
where idperson=$idperson", $dbi);
   echo"OK";
   die(mysql_error());
   closetable();
   include("footer.php");
}

The last two elements to insert are the definitions for the CASE statements (that is, which function to call according to the variable passed to the module) and the closing of the file.

Definition of the cases:

if ($radminsuper==1) {
   switch($op) {
      case "":
         mousedisplay();
         break;
      case "topolino";
         mousedisplay();
         break;
      case "mouseselect";
         mouseselect();
         break;
      case "mousemodify";
         mousemodify();
         break;
   }
}
else {
   echo "Access Denied";
}

The complete modules/topolino.php file is thus (see also Problems with new mods):

<?php
if (!eregi("admin.php", $_SERVER['PHP_SELF'])) { die ("Access Denied"); }
$querystr = "SELECT radminsuper, admlanguage FROM "
.$prefix."_authors where aid='$aid'";
$result = sql_query($querystr, $dbi) or die ("invalied query");
list($radminsuper) = sql_fetch_row($result, $dbi);
if ($radminsuper==1) {
   switch($op) {
      case "":
         mousedisplay();
         break;
      case "topolino";
         mousedisplay();
         break;
      case "mouseselect";
         mouseselect();
         break;
      case "mousemodify";
         mousemodify();
         break;
   }
}
else {
   echo "Access Denied";
}
function mousedisplay() {
   global $admin, $bgcolor2, $prefix, $dbi, $multilingual;
   include ("header.php");
   GraphicAdmin();
   Opentable();
   $querystr = "SELECT idperson, nameperson FROM ".$prefix."_topolino";
   $resultpersons = sql_query($querystr, $dbi) 
   or die ("invalid query in mousedisplay");
   for ($m=0; $m < sql_num_rows($resultpersons, $dbi); $m++)
   {
      list ($idperson, $nameperson) = mysql_fetch_row($resultpersons);
      $tmpLink = "<a href=\"admin.php?op=mouseselect&idtopo="
                  .$idperson."\">Select mouse</A><br>";
      echo   "$idperson - $nameperson $tmpLink";
   }
   closetable();
   include("footer.php");
}
function mouseselect() {
   global $admin, $bgcolor2, $prefix, $dbi, $multilingual, $idtopo;
   include ("header.php");
   GraphicAdmin();
   Opentable();
   echo "idtopo=".$idtopo;
   $querystr = "SELECT idperson, nameperson FROM ".$prefix."_topolino 
                where idperson='$idtopo'";
   $resultpersons = sql_query($querystr, $dbi) 
   or die ("Invalid query in mouseselect");
   for ($m=0; $m < sql_num_rows($resultpersons, $dbi); $m++)
   {
      list($idperson, $nameperson) = sql_fetch_row($resultpersons, $dbi);
      echo "<form action=\"admin.php\" method=\"post\">";
      echo "<input type=\"text\" name=\"nameperson\" size=\"20\" 
             maxlength=\"20\" value=\"$nameperson\"><br><br>";
      echo "<input type=\"hidden\" name=\"idperson\"value=\"$idtopo\" > ";
      echo "<input type=\"hidden\" name=\"op\" value=\"mousemodify\" > ";
      echo "<input type=\"submit\" value=\""._ADDTOPO."\" > ";
      echo "</form >";
   }
   closetable();
   include("footer.php");
}
function mousemodify() {
   global $admin, $bgcolor2, $prefix, $dbi, $multilingaul, $idtopo, 
          $nameperson, $idperson;
   include ("header.php");
   GraphicAdmin();
   Opentable();
   sql_query("Update ".$prefix."_topolino set nameperson=' $nameperson' 
              where idperson=$idperson", $dbi);
   echo"OK";
   die(mysql_error());
   closetable();
   include("footer.php");
}
?>

The cases definition page is very easy to construct, it gathers the cases that are included in the file admin/modules/topolino.php and puts them in the file admin/case/case.topolino.php

This is the syntax:

<?php
if (!eregi("admin.php", $_SERVER['PHP_SELF'])) { die ("Access Denied"); }
switch($op) {
   case "topolino":
      include("admin/modules/topolino.php");
      break;
   case "mouseselect":
      include("admin/modules/topolino.php");
      break;
   case "mousemodify":
      include("admin/modules/topolino.php");
      break;
}
>

The last two things we have to make are the compilation of the file admin/links/link.topolino.php and the creation of a language module: Compilation of the file link.topolino.php

<?php
if ($radminsuper==1) {
   adminmenu("admin.php?op=topolino ", "" _EDITTOPOLINO." ", "topolino.gif");
}
?>

Where: admin.php?op=topolino defines which module must be called, " _EDITTOPOLINO" is the term to translate (it must be compiled in admin/language). For the modification of the language module I refer you to the previous paragraph with one single note. The language file of the admin section is common for all (admin/language), the relative languages must be added to the end of those that already exist. Just another thing, the syntax of this example is not perfect, its beyond the scope of this to make it work perfectly but it does illustrate the operation of the module (Which you will find available for download at www.spaghettibrain.com so you will be able to study it).

Send all questions and comments to:
Webmaster
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest Fogfighters Hungary © 2007 - 2022

You can syndicate our news using the file backend.php or ultramode.txt

PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.20 Seconds

:: subBlack phpbb2 style by spectre :: PHP-Nuke theme by www.nukemods.com ::