C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\webboard\admin\rank.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php
/* $Id: rank.php,v 1.1.1.1 2002/10/28 19:13:51 pbaecher Exp $ */
/*
          ThWboard - PHP/MySQL Bulletin Board System
        ==============================================
            (c) 2000, 2001 by
               Paul Baecher         <paul@thewall.de>
               Felix Gonschorek   <funner@thewall.de>

          download the latest version:
            http://www.thwboard.de

          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,  or (at
          your option) any later version.

        ==============================================

*/

include "common.inc.php";
tb_header();

if( 
$config['enable_ranks'] )
{
    print 
'<b>Ranks</b><br><br>';

    if( 
$action == 'UpdateRanks' && is_array($rankid) )
    {
        while( list(, 
$rank['rankid']) = @each($rankid) )
        {
            if( 
$rankdelete[$rank['rankid']] == 'yes' )
            {
            
query("DELETE FROM ".$pref."rank WHERE rankid=$rank[rankid]");
            }
            else
            {
                
query("UPDATE ".$pref."rank SET
                    rankposts='" 
$rankposts[$rank['rankid']] . "',
                    ranktitle='" 
addslashes($ranktitle[$rank['rankid']]) . "',
                    rankimage='" 
addslashes($rankimage[$rank['rankid']]) . "'
                WHERE rankid=
$rank[rankid]");
            }
        }
        
        print 
'Ranks have been updated.<br><br>';
    }
    elseif( 
$action == 'InsertRank' )
    {
        if( 
$ranktitle && $rankposts )
        {
            
query("INSERT INTO ".$pref."rank (ranktitle, rankimage, rankposts)
                VALUES ('" 
addslashes($ranktitle) . "', '" addslashes($rankimage) . "', '$rankposts');");
        }
        
        print 
'Rank has been added.<br><br>';
    }


    print 
'<form name="theform" method="post" action="rank.php">
  <table border="0" cellspacing="1" cellpadding="8">
    <tr> 
      <td>Title</td>
      <td>Image (optional)</td>
      <td>Required posts</td>
      <td>Remove</td>
    </tr>'
;
    
    
$r_rank query("SELECT rankid, ranktitle, rankimage, rankposts FROM ".$pref."rank ORDER BY rankposts DESC");
    while( 
$rank mysql_fetch_array($r_rank) )
    {
        print 
'    <tr> 
      <td> 
        <input class="tbinput" type="hidden" name="rankid[' 
$rank['rankid'] . ']" value="' $rank['rankid'] . '">
        <input class="tbinput" type="text" name="ranktitle[' 
$rank['rankid'] . ']" value="' htmlspecialchars($rank['ranktitle']) . '">
      </td>
      <td> 
        <input class="tbinput" type="text" name="rankimage[' 
$rank['rankid'] . ']" value="' htmlspecialchars($rank['rankimage']) . '">
      </td>
      <td align="center"> 
        <input class="tbinput" type="text" name="rankposts[' 
$rank['rankid'] . ']" size="5" value="' $rank['rankposts'] . '">
      </td>
      <td align="center"> 
        <input type="checkbox" name="rankdelete[' 
$rank['rankid'] . ']" value="yes">
      </td>
    </tr>'
;
    }
    
    print 
'  </table>
  <p>
    <input type="hidden" name="action" value="UpdateRanks">
    <input type="hidden" name="session" value="' 
$session '">
    <input type="submit" name="update" value="Update &gt;&gt;">
  </p>
</form>
'
;
    print 
'<br><hr><br><b>Add rank</b><br><br>';
    
    print 
'
<form name="theform" method="post" action="rank.php">  
  <table border="0" cellspacing="1" cellpadding="8">
    <tr>
      <td>Title</td>
      <td>
        <input class="tbinput" type="text" name="ranktitle">
      </td>
    </tr>
    <tr>
      <td>Image (optional)</td>
      <td>
        <input class="tbinput" type="text" name="rankimage">
      </td>
    </tr>
    <tr>
      <td>Required posts</td>
      <td>
        <input class="tbinput" type="text" name="rankposts" size="5">
      </td>
    </tr>
  </table>
  <p>
    <input type="hidden" name="action" value="InsertRank">
    <input type="hidden" name="session" value="' 
$session '">
    <input type="submit" name="Abschicken" value="Insert &gt;&gt;">
  </p>
 </form>
'
;
}
else
{
    print 
'Ranks are currently disabled. You can enable them <a href="index.php?session=' $session '&action=EditSettings">here</a>.';
}

tb_footer();
?>