Points System

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Points System
onesite
CZ Newbie
onesite has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Sep 06, 2004
0.00 posts per day
Posts: 18
Points: 2,069
   
I have a copy of PHP-Nuke 7.4.
I was trying to use the points system.
But on the admin panel the page user groups is displayed totally wrong.
Under points system it comes up with;

_POINTS01 _DESC01 0 _UPDATE
_POINTS02 _DESC02 0 _UPDATE

and so on upto 21.

Below is the code on the page /admin/modules/groups.php

<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/*                                                                      */
/************************************************************************/
/* Additional security checking code 2003 by chatserv                   */
/* http://www.nukefixes.com -- http://www.nukeresources.com             */
/************************************************************************/


if (!eregi("admin.php", $_SERVER['SCRIPT_NAME'])) { die ("Access Denied"); }
global $prefix, $db;
$aid = substr("$aid", 0,25);
$row = $db->sql_fetchrow($db->sql_query("SELECT radminsuper FROM " . $prefix . "_authors WHERE aid='$aid'"));
if ($row['radminsuper'] == 1) {

/*********************************************************/
/* Users Groups Functions                                      */
/*********************************************************/

function Groups() {
   global $bgcolor2, $bgcolor4, $prefix, $user_prefix, $db;
   include("header.php");
   GraphicAdmin();
   title("" . _GROUPSADMIN . "");
   $grp_num = $db->sql_numrows($db->sql_query("SELECT * FROM " . $prefix . "_groups"));
   if ($grp_num == 0) {
       OpenTable();
       echo "<center><font class=\"title\"><b>" . _NOGROUPS . "</b></font></center>";
       CloseTable();
       echo "<br>";
   } else {
       OpenTable();
       echo "<center><font class=\"title\"><b>" . _UGROUPS . "</b></font></center>"
      ."<br><table border=\"1\" width=\"100%\"><tr>"
      ."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>" . _NAME . "</b></td>"
      ."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>" . _DESCRIPTION . "</b></td>"
      ."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>" . _POINTS . "</b></td>"
      ."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>" . _USERSCOUNT . "</b></td>"
      ."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>" . _FUNCTIONS . "</b></td></tr>";
       $result = $db->sql_query("SELECT id, name, description, points FROM " . $prefix . "_groups ORDER BY points");
       while ($row = $db->sql_fetchrow($result)) {
      $id = intval($row['id']);
      $name = $row['name'];
      $description = $row['description'];
      $points = intval($row['points']);
      $users_num = $db->sql_numrows($db->sql_query("SELECT * FROM " . $user_prefix . "_users WHERE points>='$points'"));
      echo "<tr>"
          ."<td align=\"left\" nowrap> ;;$name ;;</td>"
          ."<td align=\"left\">$description</td>"
          ."<td align=\"center\">$points</td>"
          ."<td align=\"center\">$users_num</td>"
          ."<td align=\"center\" nowrap><font class=\"content\"> ;;[ <a href=\"admin.php?op=grp_edit&amp;id=$id\">" . _EDIT . "</a> | <a href=\"admin.php?op=grp_del&amp;id=$id\">" . _DELETE . "</a> ] ;;</font></td></tr>";
       }
       echo "</table>";
       CloseTable();
       echo "<br>";
   }
   OpenTable();
   echo "<center><font class=\"option\"><b>" . _ADDNEWGROUP . "</b></font></center><br><br>"
       ."<form action=\"admin.php\" method=\"post\">"
       ."<table border=\"0\" width=\"100%\">"
       ."<tr><td>" . _GTITLE . ":</td><td><input type=\"text\" name=\"name\" size=\"50\" maxlength=\"255\"></td></tr>"
       ."<tr><td>" . _DESCRIPTION . ":</td><td><textarea name=\"description\" cols=\"50\" rows=\"10\"></textarea></td></tr>"
       ."<tr><td>" . _POINTSNEEDED . ":</td><td><input type=\"text\" name=\"points\" size=\"10\" maxlength=\"20\" value=\"0\"> ;;<i>(" . _ONLYNUMVAL . ")</i></td></tr>"
       ."</table><br><br>"
       ."<input type=\"hidden\" name=\"op\" value=\"grp_add\">"
       ."<input type=\"submit\" value=\"" . _CREATEGROUP . "\"></form>";
   CloseTable();
   echo "<br>";
   OpenTable();
   echo "<center><font class=\"option\"><b>" . _POINTSSYSTEM . "</b></font></center><br><br>"
       ."<table border=\"1\" width=\"100%\"><tr>"
       ."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>" . _NAME . "</b></td>"
       ."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>" . _DESCRIPTION . "</b></td>"
       ."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>" . _POINTS . "</b></td>"
       ."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>" . _FUNCTIONS . "</b></td></tr>"
       ."<tr>";
   $row2 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='1'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS01 . " ;;</td>"
       ."<td align=\"left\">" . _DESC01 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row2[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"1\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row3 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='2'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS02 . " ;;</td>"
       ."<td align=\"left\">" . _DESC02 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row3[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"2\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row4 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='3'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS03 . " ;;</td>"
       ."<td align=\"left\">" . _DESC03 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row4[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"3\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row5 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='4'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS04 . " ;;</td>"
       ."<td align=\"left\">" . _DESC04 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row5[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"4\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row6 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='5'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS05 . " ;;</td>"
       ."<td align=\"left\">" . _DESC05 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row6[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"5\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row7 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='6'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS06 . " ;;</td>"
       ."<td align=\"left\">" . _DESC06 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row7[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"6\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row8 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='7'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS07 . " ;;</td>"
       ."<td align=\"left\">" . _DESC07 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row8[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"7\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row9 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='8'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS08 . " ;;</td>"
       ."<td align=\"left\">" . _DESC08 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row9[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"8\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row10 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='9'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS09 . " ;;</td>"
       ."<td align=\"left\">" . _DESC09 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row10[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"9\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row11 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='10'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS10 . " ;;</td>"
       ."<td align=\"left\">" . _DESC10 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row11[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"10\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row12 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='11'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS11 . " ;;</td>"
       ."<td align=\"left\">" . _DESC11 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row12[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"11\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row13 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='12'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS12 . " ;;</td>"
       ."<td align=\"left\">" . _DESC12 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row13[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"12\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row14 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='13'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS13 . " ;;</td>"
       ."<td align=\"left\">" . _DESC13 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row14[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"13\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row15 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='14'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS14 . " ;;</td>"
       ."<td align=\"left\">" . _DESC14 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row15[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"14\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row16 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='15'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS15 . " ;;</td>"
       ."<td align=\"left\">" . _DESC15 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row16[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"15\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row17 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='16'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS16 . " ;;</td>"
       ."<td align=\"left\">" . _DESC16 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row17[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"16\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row18 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='17'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS17 . " ;;</td>"
       ."<td align=\"left\">" . _DESC17 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row18[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"17\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row19 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='18'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS18 . " ;;</td>"
       ."<td align=\"left\">" . _DESC18 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row19[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"18\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row20 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='19'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS19 . " ;;</td>"
       ."<td align=\"left\">" . _DESC19 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row20[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"19\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row21 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='20'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS20 . " ;;</td>"
       ."<td align=\"left\">" . _DESC20 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row21[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"20\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>"
       ."<tr>";
   $row22 = $db->sql_fetchrow($db->sql_query("SELECT points FROM " . $prefix . "_groups_points WHERE id='21'"));
   echo "<form action=\"admin.php\" method=\"post\">"
       ."<td align=\"left\" nowrap> ;;" . _POINTS21 . " ;;</td>"
       ."<td align=\"left\">" . _DESC21 . "</td>"
       ."<td align=\"center\"> ;;<input type=\"text\" value=\"$row22[points]\" size=\"5\" name=\"points\"> ;;</td>"
       ."<td align=\"center\" nowrap><font class=\"content\"> ;;"
       ."<input type=\"hidden\" name=\"id\" value=\"21\">"
       ."<input type=\"hidden\" name=\"op\" value=\"points_update\">"
       ."<input type=\"submit\" value=\"" . _UPDATE . "\"></form> ;;</font></td></tr>";
   echo "</table>";
   CloseTable();
   include("footer.php");
}

function grp_add($name, $description, $points) {
    global $prefix, $db;
    if (!is_numeric($points) || ereg("-", $points)) {
   include("header.php");
   GraphicAdmin();
   title("" . _GROUPSADMIN . "");
   OpenTable();
   echo "<center><b>" . _GROUPADDERROR . "</b><br><br>"
       ."" . _NONUMVALUE . "<br><br>"
       ."" . _GOBACK . "</center>";
   CloseTable();
   include("footer.php");
    } else {
   $db->sql_query("INSERT INTO " . $prefix . "_groups VALUES (NULL, '$name', '$description', '$points')");
   Header("Location: admin.php?op=Groups");
    }
}

function grp_edit($id) {
    global $prefix, $db;
    include("header.php");
    GraphicAdmin();
    title("" . _GROUPSADMIN . "");
    $id = intval($id);
    $row = $db->sql_fetchrow($db->sql_query("SELECT * FROM " . $prefix . "_groups WHERE id='$id'"));
        $id = intval($row['id']);
        $name = $row['name'];
        $description = $row['description'];
        $points = intval($row['points']);
    OpenTable();
    echo "<center><font class=\"option\"><b>" . _EDITGROUP . "</b></font></center><br><br>"
        ."<form action=\"admin.php\" method=\"post\">"
        ."<table border=\"0\" width=\"100%\">"
        ."<tr><td>" . _GTITLE . ":</td><td><input type=\"text\" name=\"name\" size=\"50\" maxlength=\"255\" value=\"$name\"></td></tr>"
        ."<tr><td>" . _DESCRIPTION . ":</td><td><textarea name=\"description\" cols=\"50\" rows=\"10\">$description</textarea></td></tr>"
        ."<tr><td>" . _POINTSNEEDED . ":</td><td><input type=\"text\" name=\"points\" size=\"10\" maxlength=\"20\" value=\"$points\"> ;;<i>(" . _ONLYNUMVAL . ")</i></td></tr>"
        ."</table><br><br>"
   ."<input type=\"hidden\" name=\"id\" value=\"$id\">"
        ."<input type=\"hidden\" name=\"op\" value=\"grp_edit_save\">"
        ."<input type=\"submit\" value=\"" . _SAVEGROUP . "\"></form>";
    CloseTable();
    include("footer.php");
}

function grp_edit_save($id, $name, $description, $points) {
    global $prefix, $db;
    $id = intval($id);
    if (!is_numeric($points)) {
   include("header.php");
   GraphicAdmin();
   title("" . _GROUPSADMIN . "");
   OpenTable();
   echo "<center><b>" . _GROUPADDERROR . "</b><br><br>"
       ."" . _NONUMVALUE . "<br><br>"
       ."" . _GOBACK . "</center>";
   CloseTable();
   include("footer.php");
    } else {
   $db->sql_query("UPDATE " . $prefix . "_groups SET name='$name', description='$description', points='$points' WHERE id='$id'");
   Header("Location: admin.php?op=Groups");
    }
}

function grp_del($id, $ok=0) {
    global $prefix, $db;
    $id = intval($id);
    if ($ok == 0) {
   include("header.php");
   GraphicAdmin();
   title("" . _GROUPSADMIN . "");
   OpenTable();
   $row = $db->sql_fetchrow($db->sql_query("SELECT name FROM " . $prefix . "_groups WHERE id='$id'"));
        $name = $row['name'];
   echo "<center><b>" . _GROUPDELETE . "</b><br><br>"
       ."" . _SUREGRPDEL1 . " <b>$name</b><br><br>"
       ."[ <a href=\"admin.php?op=grp_del&id=$id&ok=1\">" . _YES . "</a> | <a href=\"admin.php?op=Groups\">" . _NO . "</a> ]</center>";
   CloseTable();
   include("footer.php");
    } else {
   $db->sql_query("DELETE FROM " . $prefix . "_groups WHERE id='$id'");
   $db->sql_query("UPDATE " . $prefix . "_modules SET mod_group='0' WHERE mod_group='$id'");
   Header("Location: admin.php?op=Groups");
    }
}

function p_update($points, $id) {
    global $prefix, $db;
    $id = intval($id);
    $db->sql_query("UPDATE " . $prefix . "_groups_points SET points='$points' WHERE id='$id'");
    Header("Location: admin.php?op=Groups");
}

switch($op) {

    case "Groups":
    Groups();
    break;

    case "grp_add":
    grp_add($name, $description, $points);
    break;

    case "grp_edit":
    grp_edit($id);
    break;
   
    case "grp_edit_save":
    grp_edit_save($id, $name, $description, $points);
    break;

    case "grp_del":
    grp_del($id, $ok);
    break;

    case "points_update":
    p_update($points, $id);
    break;

}

} else {
    echo "Access Denied";
}

?>


Thanks for any help offered.


Back to top Reply with quote
#2   re: Points System
Gareth
CZ Addict
 Codezwiz Site Donator
Gareth has been a member for over 20 year's 20 Year Member
uk.gif
Occupation: Student, Webmaster
Gender: Male
Fav. Sports Team: Liverpool FC
Status: Offline
Joined: May 29, 2004
0.08 posts per day
Posts: 587
Points: 38,220
   
Add anywhere into admin/language/lang-english.php The following:

define("_UGROUPS","Users Groups");
define("_POINTS","Points");
define("_USERSCOUNT","Users Count");
define("_ADDNEWGROUP","Add New Users Group");
define("_GTITLE","Group Name");
define("_POINTSNEEDED","Points Needed");
define("_ONLYNUMVAL","Use numeric values only");
define("_CREATEGROUP","Create This Group");
define("_NOGROUPS","There aren't any Users Group created at this time");
define("_POINTSSYSTEM","Points System");
define("_UPDATE","Update");
define("_EDITGROUP","Edit Users Group");
define("_SAVEGROUP","Save Group");
define("_GROUPSADMIN","Users Group Administration");
define("_GROUPADDERROR","Group Creation Error!");
define("_GROUPDELETE","Delete Users Group");
define("_SUREGRPDEL1","Are you sure you want to remove/delete the group?:");
define("_NONUMVALUE","The value of the Points isn't numeric. Go back and fix it.");
define("_GROUP","Group");
define("_UGROUP","Users Group");
define("_VALIDIFREG","Valid only if Registered Users are selected above");
define("_POINTS01","Journal Entry");
define("_DESC01","Personal user's Journal entry. Valid for publics and privates entries");
define("_POINTS02","Journal Comment");
define("_DESC02","Each comment posted in a public user's Journal");
define("_POINTS03","Recommendation to a Friend");
define("_DESC03","Each time a user send the link to our site to a friend via Recommend Us Module");
define("_POINTS04","News Submission Published");
define("_DESC04","News that the user sends from Submit News module and then published by the administrator");
define("_POINTS05","News Comment");
define("_DESC05","Comment published for any article and/or news");
define("_POINTS06","News Sent to a Friend");
define("_DESC06","Each article's or news has an option to send it to a friend. Points valid for each time the user sends the article to a friend");
define("_POINTS07","News Article Rating");
define("_DESC07","Each time a user votes for any article");
define("_POINTS08","Vote in Surveys");
define("_DESC08","Each vote registered for any survey, actual or old ones are valid");
define("_POINTS09","Comment in Surveys");
define("_DESC09","Comment published for any actual or old survey");
define("_POINTS10","Forum New Post");
define("_DESC10","Each time the user opens a new thread in the Forums");
define("_POINTS11","Forum Answer Post");
define("_DESC11","Forums threads answered or replied");
define("_POINTS12","Review Comment");
define("_DESC12","Comment published for any review in the Reviews module");
define("_POINTS13","Page View");
define("_DESC13","Get points for each page view generated by the user. Valid for any page of the site");
define("_POINTS14","Visit to a WebLink");
define("_DESC14","Each time a user clicks to visit any resource on WebLinks module");
define("_POINTS15","Rate to any WebLink");
define("_DESC15","Each time a user votes for a resource in WebLinks module");
define("_POINTS16","Comment to any WebLink");
define("_DESC16","Comments posted on any resource in the WebLink module");
define("_POINTS17","Download of a File");
define("_DESC17","Each time a user clicks to download any file or resource on Downloads module");
define("_POINTS18","Rate to any Download");
define("_DESC18","Each time a user votes for a resource in Downloads module");
define("_POINTS19","Comment to any Download");
define("_DESC19","Comments posted on any resource in the Downloads module");
define("_POINTS20","Broadcast Message");
define("_DESC20","Each time a user publish a public message using the Broadcast message system");
define("_POINTS21","Click on any Banner");
define("_DESC21","The best way to give back a user something is to give him some points for banner clicks on your site");




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
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 cannot attach files in this forum
You cannot download files in this forum