Verzeichnisstruktur phpBB-1.0.0


Veröffentlicht
15.12.2000

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

smiles.php

Zuletzt modifiziert: 09.10.2024, 12:51 - Dateigröße: 15.41 KiB


001  <?php
002  /***************************************************************************
003                              admin.php  -  description
004                                 -------------------
005        begin                : Sat Oct 28 2000
006        copyright            : (C) 2000 by James Atkinson
007        email                : james@totalgeek.org
008    
009        $Id: smiles.php,v 1.5 2000/11/15 04:57:15 thefinn Exp $
010    
011   ***************************************************************************/
012  /****************************************************************************
013   *                                                                                                      
014   *   This program is free software; you can redistribute it and/or modify       
015   *   it under the terms of the GNU General Public License as published by  
016   *   the Free Software Foundation; either version 2 of the License, or          
017   *   (at your option) any later version.
018   *
019   ***************************************************************************/
020    /*
021     * This file was created by Viceroy (http://www.youdotheweb.com) as part of
022     * a 'Smile Control Panel' hack for phpBB. It was later imported into the
023     * official phpBB distribution.
024     */
025  include('../extention.inc');
026  include('../functions.'.$phpEx);
027  include('../config.'.$phpEx);
028  require('../auth.'.$phpEx);
029  if($login) {
030        if ($username == '') {
031             die("You have to enter your username. Go back and do so.");
032        }
033        if ($password == '') {
034             die("You have to enter your password. Go back and do so.");
035        }
036        if (!check_username($username, $db)) {
037             die("Invalid username \"$username\". Go back and try again.");
038        }
039        if (!check_user_pw($username, $password, $db)) {
040             die("Invalid password. Go back and try again.");
041        }
042             
043        $userdata = get_userdata($username, $db);
044        $sessid = new_session($userdata[user_id], $REMOTE_ADDR, $sesscookietime, $db);
045        set_session_cookie($sessid, $sesscookietime, $sesscookiename, $cookiepath, $cookiedomain, $cookiesecure);
046             
047        header("Location: $url_admin");
048  }
049  else if(!$user_logged_in) {
050        $pagetitle = "Forum Administration";
051        $pagetype = "admin";
052        include('../page_header.'.$phpEx);
053     
054     ?>
055            <TABLE BORDER="0" CELLPADDING="1" CELLSPACING="0" ALIGN="CENTER" VALIGN="TOP" WIDTH="<?php echo $TableWidth?>">
056            <TR><TD  BGCOLOR="<?php echo $table_bgcolor?>">
057            <TABLE BORDER="0" CELLPADDING="1" CELLSPACING="1" WIDTH="100%">
058            <TR BGCOLOR="<?php echo $color1?>" ALIGN="LEFT">
059            <TD><P><BR><FONT FACE="<?php echo $FontFace?>" SIZE="<? echo $FontSize2?>" COLOR="<?php echo $textcolor?>">
060            Please enter your username and password to login.<BR>
061       <i>(NOTE: You MUST have cookies enabled in order to login to the administration section of this forum)</i><BR>
062            <UL>
063            <FORM ACTION="<?php echo $PHP_SELF?>" METHOD="POST">
064       <b>User Name: </b><INPUT TYPE="TEXT" NAME="username" SIZE="25" MAXLENGTH="40" VALUE="<?php echo $userdata[username]?>"><BR>
065       <b>Password: </b><INPUT TYPE="PASSWORD" NAME="password" SIZE="25" MAXLENGTH="25"><br><br>
066            <INPUT TYPE="SUBMIT" NAME="login" VALUE="Submit">&nbsp;&nbsp;&nbsp;<INPUT TYPE="RESET" VALUE="Clear"></ul>
067            </FORM>
068            </TD></TR></TABLE></TD></TR></TABLE>
069       <?php
070            include('../page_tail.'.$phpEx);
071          exit();
072  }
073  else if($user_logged_in && $userdata[user_level] == 4) {
074     
075  $pagetitle = "Smiles Control";
076  $pagetype = "admin";
077  include('../page_header.'.$phpEx);
078   
079  echo "<font face=\"$FontFace\" size=\"$FontSize2\">";
080  echo "<TABLE width=\"45%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" bordercolor=\"$table_bgcolor\">";
081  echo "<tr><td align=\"center\" width=\"100%\" bgcolor=\"$color1\"><font face=\"$FontFace\" size=\"$FontSize4\" color=\"$textcolor\"><B>Smilies Utility.</B></font></td></TR>";
082  echo "<tr><td align=\"center\" width=\"100%\" bgcolor=\"$color1\"><font face=\"$FontFace\" size=\"$FontSize2\" color=\"$textcolor\"><a href=\"$PHP_SELF?mode=add\">Add Smile</a></TD></TR>";
083  echo "</TR></table></TD></TR></TABLE><BR><BR><center>";
084   
085  if ($mode == '') {
086     $mode = 'view';
087  }
088   
089  switch ($mode) {
090   case 'view':
091     if ($getsmiles = mysql_query("SELECT * FROM smiles")) {
092        if (($numsmiles = mysql_num_rows($getsmiles)) == "0") {
093       echo "<font face=\"$FontFace\" size=2>No smiles currently. <a href='$PHP_SELF?mode=add'>Click here</a> to add some.</font>";
094        } else {
095       echo "<table border=0 cellspacing=1 cellpadding=3><tr><td bgcolor=\"$color1\"><font face=\"$FontFace\" size=2>Code</font></td><td bgcolor='$color2'><font face=\"$FontFace\" size=2>Smile</font></td><td bgcolor='$color1'>&nbsp;</td><td bgcolor='$color2'>&nbsp;</td></tr>";
096       while ($smiles = mysql_fetch_array($getsmiles)) {
097          echo "<tr><td bgcolor='$color1'><font face=\"$FontFace\" size=2>$smiles[code]</font></td><td bgcolor='$color2'><img src=\"$url_smiles/$smiles[smile_url]\"></td><td bgcolor='$color1'><a href=\"$PHP_SELF?mode=edit&id=$smiles[id]\">Edit</a></td><td bgcolor='$color2'><a href=\"$PHP_SELF?mode=delete&id=$smiles[id]\">Delete</a></td></tr>";
098       }
099       echo "</table>";
100        }
101     } else {
102        echo "Could not retrieve from the smile database.";
103     }
104     break;
105     
106   case 'add':
107     if (!isset($submit)) {
108  echo "<TABLE width=\"45%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" bordercolor=\"$table_bgcolor\">";
109  echo "<tr><td align=\"center\" width=\"100%\" bgcolor=\"$color1\"><font face=\"$FontFace\" size=\"$FontSize2\" color=\"$textcolor\"><B>Add Smilie.</B></font></td>";
110  echo "</tr><TR><TD><TABLE width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><TR>";
111  echo "<td align=\"center\" width=\"100%\" bgcolor=\"$color2\"><font face=\"$FontFace\" size=\"$FontSize2\" color=\"$textcolor\"><P>";
112        ?>
113   
114      Make sure you uploaded your smiles in the proper directory.<br>
115      For Smile URL, just put the smile filename.
116      
117      <form method=post action="<?php echo $PHP_SELF?>">
118      Smile Code: <input type="text" name="code"><br>
119      Smile URL: <input type="text" name="smile_url"><br>
120      Smile Emotion: <input type="text" name="emotion"><br>
121      <input type="hidden" name="mode" value="add">
122      <input type="submit" name="submit" value="Add the Smile!">
123      </form>
124      <?php
125  echo "</font><P></TD>";
126  echo "</TR></table></TD></TR></TABLE>";
127     } else {
128        
129        $code = addslashes($code);
130        $smile_url = addslashes($smile_url);
131        $emotion = addslashes($emotion);
132        
133        if (!$insertsmile = mysql_query("INSERT INTO smiles (id, code, smile_url, emotion) VALUES ('', '$code', '$smile_url', '$emotion')")) {
134  echo "<TABLE width=\"45%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" bordercolor=\"$table_bgcolor\">";
135  echo "<tr><td align=\"center\" width=\"100%\" bgcolor=\"$color1\"><font face=\"$FontFace\" size=\"$FontSize2\" color=\"$textcolor\"><B>Add Smilie.</B></font></td>";
136  echo "</tr><TR><TD><TABLE width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><TR>";
137  echo "<td align=\"center\" width=\"100%\" bgcolor=\"$color2\"><font face=\"$FontFace\" size=\"$FontSize1\" color=\"$textcolor\"><P>&nbsp;&nbsp;Could Not Add The Smilie To The Database!</font><P></TD>";
138  echo "</TR></table></TD></TR></TABLE>";
139        } else {
140  echo "<TABLE width=\"45%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" bordercolor=\"$table_bgcolor\">";
141  echo "<tr><td align=\"center\" width=\"100%\" bgcolor=\"$color1\"><font face=\"$FontFace\" size=\"$FontSize2\" color=\"$textcolor\"><B>Add Smilie.</B></font></td>";
142  echo "</tr><TR><TD><TABLE width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><TR>";
143  echo "<td align=\"center\" width=\"100%\" bgcolor=\"$color2\"><font face=\"$FontFace\" size=\"$FontSize1\" color=\"$textcolor\"><P>&nbsp;&nbsp;Your Smilie Has Been Added!</font><P></TD>";
144  echo "</TR></table></TD></TR></TABLE>";
145        }
146        
147     }
148     
149     break;
150     
151   case 'edit':
152     
153     if (isset($id)) {
154        
155        $submit = "Let's Edit the Smile!";
156        $smile = $id;
157        
158     }
159     
160     if ($submit == "Let's Edit the Smile!") {
161        
162        if ($getsmiles = mysql_query("SELECT * FROM smiles WHERE id = '$smile'")) {
163       $smiles = mysql_fetch_array($getsmiles);
164   
165  echo "<TABLE width=\"45%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" bordercolor=\"$table_bgcolor\">";
166  echo "<tr><td align=\"center\" width=\"100%\" bgcolor=\"$color1\"><font face=\"$FontFace\" size=\"$FontSize2\" color=\"$textcolor\"><B>Edit Smilie.</B></font></td>";
167  echo "</tr><TR><TD><TABLE width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><TR>";
168  echo "<td align=\"center\" width=\"100%\" bgcolor=\"$color2\"><font face=\"$FontFace\" size=\"$FontSize2\" color=\"$textcolor\"><P>";
169   
170       ?>
171         <form method=post action="<?php echo $PHP_SELF?>">
172         Smile Code: <input type="text" name="code" value="<?php echo $smiles[code]?>"><br>
173         Smile URL: <input type="text" name="smile_url" value="<?php echo $smiles[smile_url]?>"><br>
174         Smile Emotion: <input type="text" name="emotion" value="<?php echo $smiles[emotion]?>"><br>
175         <input type="hidden" name="mode" value="edit">
176         <input type="hidden" name="smile_id" value="<?php echo $smile?>">
177         <input type="submit" name="submit" value="Submit Changes">
178         </form>
179         <?php
180  echo "</font><P></TD>";
181  echo "</TR></table></TD></TR></TABLE>";
182        } else {
183  echo "<TABLE width=\"45%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" bordercolor=\"$table_bgcolor\">";
184  echo "<tr><td align=\"center\" width=\"100%\" bgcolor=\"$color1\"><font face=\"$FontFace\" size=\"$FontSize2\" color=\"$textcolor\"><B>Edit Smilie.</B></font></td>";
185  echo "</tr><TR><TD><TABLE width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><TR>";
186  echo "<td align=\"center\" width=\"100%\" bgcolor=\"$color2\"><font face=\"$FontFace\" size=\"$FontSize1\" color=\"$textcolor\"><P>&nbsp;&nbsp;Could Not Retrieve The Image.</font><P></TD>";
187  echo "</TR></table></TD></TR></TABLE>";
188        }
189        
190     } elseif ($submit == "Submit Changes") {
191        $code = addslashes($code);
192        $smile_url = addslashes($smile_url);
193        $emotion = addslashes($emotion);
194        if ($updatesmile = mysql_query("UPDATE smiles SET code = '$code', emotion = '$emotion', smile_url = '$smile_url' WHERE id = '$smile_id'")) {
195   
196  echo "<TABLE width=\"45%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" bordercolor=\"$table_bgcolor\">";
197  echo "<tr><td align=\"center\" width=\"100%\" bgcolor=\"$color1\"><font face=\"$FontFace\" size=\"$FontSize2\" color=\"$textcolor\"><B>Edit Smilie.</B></font></td>";
198  echo "</tr><TR><TD><TABLE width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><TR>";
199  echo "<td align=\"center\" width=\"100%\" bgcolor=\"$color2\"><font face=\"$FontFace\" size=\"$FontSize1\" color=\"$textcolor\"><P>&nbsp;&nbsp;Smile Successfully Updated.</font><P></TD>";
200  echo "</TR></table></TD></TR></TABLE>";
201   
202        } else {
203  echo "<TABLE width=\"45%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" bordercolor=\"$table_bgcolor\">";
204  echo "<tr><td align=\"center\" width=\"100%\" bgcolor=\"$color1\"><font face=\"$FontFace\" size=\"$FontSize2\" color=\"$textcolor\"><B>Edit Smilie.</B></font></td>";
205  echo "</tr><TR><TD><TABLE width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><TR>";
206  echo "<td align=\"center\" width=\"100%\" bgcolor=\"$color2\"><font face=\"$FontFace\" size=\"$FontSize1\" color=\"$textcolor\"><P>&nbsp;&nbsp;Sorry Your Smilie Could Not Be Updated!</font><P></TD>";
207  echo "</TR></table></TD></TR></TABLE>";
208        }
209        
210     } else {
211        $count = 1;
212        
213        if ($getsmiles = mysql_query("SELECT * FROM smiles")) {
214       echo "Please select a smile from the pile below.";
215       if (($numsmiles = mysql_num_rows($getsmiles)) == "0") {
216          echo "<font face=\"$FontFace\" size=2>No smiles currently. <a href='$PHP_SELF?mode=add'>Click here</a> to add some.</font>";
217       } else {
218          echo "<form method=post action=\"$PHP_SELF\"><input type='hidden' name='mode' value='edit'>";
219          while ($smiles = mysql_fetch_array($getsmiles)) {
220             
221             echo "<input type=\"radio\" name=\"smile\" value=\"$smiles[id]\">&nbsp;&nbsp;<img src=\"$url_smiles/$smiles[smile_url]\">&nbsp;&nbsp;$smiles[code]&nbsp;&nbsp;&nbsp;&nbsp;\n"; 
222             
223             if (($count % "7") == "0") {
224            echo "<br>\n";
225             }
226             $count++;
227          }
228          echo "<br><input type='submit' name='submit' value=\"Let's Edit the Smile!\">";
229       }
230        }
231     }
232     
233     break;
234     
235   case 'delete':
236     
237     if (isset($id)) {
238        
239        $submit = "Delete Smile";
240        $smile_id = $id;
241        
242     }
243     
244     if (!isset($submit)) {
245        if ($getsmiles = mysql_query("SELECT * FROM smiles")) {
246       echo "Please select a smile from the pile below.";
247       
248       if (($numsmiles = mysql_num_rows($getsmiles)) == "0") {
249          echo "<font face=\"$FontFace\" size=2>No smiles currently. <a href='$PHP_SELF?mode=add'>Click here</a> to add some.</font>";
250       } else {
251          echo "<form method=post action=\"$PHP_SELF\"><input type='hidden' name='mode' value='delete'>";
252          $count = 1;
253          while ($smiles = mysql_fetch_array($getsmiles)) {
254             
255             echo "<input type=\"radio\" name=\"smile\" value=\"$smiles[id]\">&nbsp;&nbsp;<img src=\"$url_smiles/$smiles[smile_url]\">&nbsp;&nbsp;$smiles[code]&nbsp;&nbsp;&nbsp;&nbsp;\n"; 
256             echo "<input type='hidden' name='smile_id' value='$smiles[id]'>";
257             
258             if (($count % "7") == "0") {
259            echo "<br>\n";
260             }
261             $count++;
262          };
263          echo "<br><input type='submit' name='submit' value='Delete Smile'>";
264       }
265        }
266     } elseif ($submit == "Delete Smile") {
267        
268        if (!$delsmile = mysql_query("DELETE FROM smiles WHERE id = '$smile_id'")) {
269  echo "<TABLE width=\"45%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" bordercolor=\"$table_bgcolor\">";
270  echo "<tr><td align=\"center\" width=\"100%\" bgcolor=\"$color1\"><font face=\"$FontFace\" size=\"$FontSize2\" color=\"$textcolor\"><B>Delete Smilie.</B></font></td>";
271  echo "</tr><TR><TD><TABLE width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><TR>";
272  echo "<td align=\"center\" width=\"100%\" bgcolor=\"$color2\"><font face=\"$FontFace\" size=\"$FontSize1\" color=\"$textcolor\"><P>&nbsp;&nbsp;Sorry Your Smilie Could Not Be Deleted!</font><P></TD>";
273  echo "</TR></table></TD></TR></TABLE>";
274        } else {
275  echo "<TABLE width=\"45%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" bordercolor=\"$table_bgcolor\">";
276  echo "<tr><td align=\"center\" width=\"100%\" bgcolor=\"$color1\"><font face=\"$FontFace\" size=\"$FontSize2\" color=\"$textcolor\"><B>Delete Smilie.</B></font></td>";
277  echo "</tr><TR><TD><TABLE width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><TR>";
278  echo "<td align=\"center\" width=\"100%\" bgcolor=\"$color2\"><font face=\"$FontFace\" size=\"$FontSize1\" color=\"$textcolor\"><P>&nbsp;&nbsp;Your Smilie Has Be Deleted!</font><P></TD>";
279  echo "</TR></table></TD></TR></TABLE>";
280   
281        }
282     }
283     
284     
285     break;
286  }
287     
288     echo "</font></center><br><br>";
289  }
290  else {
291        $pagetype = "admin";
292        $pagetitle = "Access Denied!";
293     
294        include('../page_header.'.$phpEx);
295     ?>
296            <TABLE BORDER="0" CELLPADDING="1" CELLSPACING="0" ALIGN="CENTER" VALIGN="TOP" WIDTH="<?php echo $TableWidth?>">
297            <TR><TD  BGCOLOR="<?php echo $table_bgcolor?>">
298            <TABLE BORDER="0" CELLPADDING="1" CELLSPACING="1" WIDTH="100%">
299            <TR BGCOLOR="<?php echo $color1?>" ALIGN="center" VALIGN="TOP">
300            <TD><FONT FACE="<?php echo $FontFace?>" SIZE="<? echo $FontSize2?>" COLOR="<?php echo $textcolor?>">
301            <B>You do not have acess to this area!</b><BR>
302            Go <a href="<?php echo $url_phpbb?>">Back</a>
303            </TD></TR></TABLE></TD></TR></TABLE>
304       <?php
305  }
306   
307  include('../page_tail.'.$phpEx);
308  ?>
309