Admin Panel

Posted on Wednesday 30th May 2007 at 07:38 PM
MCP
MCP's Avatar
https://rmb-scripting.com/tutorials.php?tutorial&tid=148

I used that tutorial and now it says "Zup, admin? Your userlevel is 6"

I cannot see any admin controls. Now I am stumped.

Help?
Thanks. :)
Posted on Wednesday 30th May 2007 at 08:52 PM
SkillMaster
SkillMaster's Avatar
post your code please lets see whats going on.
Posted on Wednesday 30th May 2007 at 09:14 PM
Diablosblizz
Diablosblizz's Avatar
That code I made was not meant to have any features.

You are supposed to use the other tutorials from the site and build from the tutorial that I made.

Like I said before, learn some PHP and maybe now HTML because you can't always ask for help.
Posted on Wednesday 30th May 2007 at 10:19 PM
MCP
MCP's Avatar
Your mistake my friend. You should have stated what all the tutorial provides before posting something and calling it an admin panel when it is merely an admin only page script.

I know php and html. Just not as much as both of us would like.
Posted on Wednesday 30th May 2007 at 10:28 PM
MCP
MCP's Avatar
https://rmb-scripting.com/tutorials.php?tutorial&tid=60

I then tried MOD-Dan's admin panel. It is a blank page. Can anyone help with this. Thanks.
Posted on Wednesday 30th May 2007 at 11:51 PM
Diablosblizz
Diablosblizz's Avatar
"Creating a Admin/mod page!"

Note the page part. I never said it was a PANEL with all the scripts. Read before you post.

Also, read the comments for MOD-Dans.
Posted on Thursday 31st May 2007 at 12:14 AM
MCP
MCP's Avatar
The only other comment is by someone who's having the same problem as me.
Posted on Thursday 31st May 2007 at 01:07 AM
Diablosblizz
Diablosblizz's Avatar
PHP Code
  1. <?
  2. session_start(); //allows session
  3. include "config.php"; // Includes the config
  4. if($logged[username] && $logged[level] == 6)// Checks you are an admin
  5. {
  6. if($_GET[member])//gets the username
  7. {
  8. if (!$_POST[edit])//Checks if you are editing a user already
  9. {
  10. $user = mysql_query("SELECT * from members where username = '$_GET[member]'");// Selcts the right user from the database
  11. $users = mysql_fetch_array($user);
  12. echo "<form method='POST">
  13. <table width="100%">
  14. <tr>
  15. <td align="right" width="25%">
  16. User Level</td>
  17. <td align="left">
  18. <select name="level">
  19. <option value="2">User</option>
  20. <option value="4"> Mod </option>
  21. <option value="6"> Admin</option>
  22. </select> </td>
  23. </tr>
  24. <tr>
  25. <td align="right" width="25%">
  26. Email</td>
  27. <td align="left">
  28. <input type="text" size="25" maxlength="25" name="email"
  29. value="$users[email]"></td>
  30. </tr>
  31. <tr>
  32. <td align="right" width="25%">Location</td>
  33. <td align="left">
  34. <input size="25" name="location" value="$users[location]"></td>
  35. </tr>
  36. <tr>
  37. <td align="right" width="25%">Age</td>
  38. <td align="left">
  39. <input size="25" name="age" value="$users[age]"></td>
  40. </tr>
  41. <tr>
  42. <td align="center"></td>
  43. <td align="left">
  44. <input type="submit" name="edit" value="Update"></td>
  45. </tr>
  46. </table>
  47. </form>
  48. "; // Displays the form
  49. }else{
  50. $email = htmlspecialchars($_POST[email]);//removes all HTML
  51. $age = htmlspecialchars($_POST[age]);//removes all HTML
  52. $location = htmlspecialchars($_POST[location]);//removes all HTML
  53. $level = htmlspecialchars($_POST[level]);//removes all HTML
  54. echo "Thank you $logged[username], $_GET[member]'s Profile was updated!"; // Shows the message of your choice (feel free to change it)
  55. $update = mysql_query("Update members set location = '$location', age = '$age', level = '$level', email = '$email' where username = '$_GET[member]'"); // updates the user
  56. }
  57. }else{
  58. $adminuser = mysql_query("Select * from members order by username asc"); //Makes a list of all the users in alphabeticle order!
  59. while($adminusers = mysql_fetch_array($adminuser))
  60. {
  61. echo "<a href='admin.php?member=$adminusers[username]'>$users[username]</a>"; //Displayes the links to edit the user.
  62. }
  63. }
  64. }else{
  65. //If someone is trying to get onto this page without being an admin then they wont get through!
  66. echo "Sorry, but only Admins may view this page. Please go back!";
  67. }
  68. ?>


This might work, the form part was messed. Just copy and paste it.

If you want to know what I did:

In the echo part I changed the " to '. If you did echo "<form action="blahblah"... then the second " would end the echo and possibly cause a error.

This should work if you use my code.
Posted on Thursday 31st May 2007 at 01:08 AM
Diablosblizz
Diablosblizz's Avatar
Ahh sorry I clicked replace and it replaced one heres the code that will actually work:

PHP Code
  1. <?
  2. session_start(); //allows session
  3. include "config.php"; // Includes the config
  4. if($logged[username] && $logged[level] == 6)// Checks you are an admin
  5. {
  6. if($_GET[member])//gets the username
  7. {
  8. if (!$_POST[edit])//Checks if you are editing a user already
  9. {
  10. $user = mysql_query("SELECT * from members where username = '$_GET[member]'");// Selcts the right user from the database
  11. $users = mysql_fetch_array($user);
  12. echo "<form method='POST'>
  13. <table width='100%'>
  14. <tr>
  15. <td align='right' width='25%'>
  16. User Level</td>
  17. <td align='left'>
  18. <select name='level'>
  19. <option value='2'>User</option>
  20. <option value='4'> Mod </option>
  21. <option value='6'> Admin</option>
  22. </select> </td>
  23. </tr>
  24. <tr>
  25. <td align='right' width='25%'>
  26. Email</td>
  27. <td align='left'>
  28. <input type='text' size='25' maxlength='25' name='email'
  29. value='$users[email]'></td>
  30. </tr>
  31. <tr>
  32. <td align='right' width='25%'>Location</td>
  33. <td align='left'>
  34. <input size='25' name='location' value='$users[location]'></td>
  35. </tr>
  36. <tr>
  37. <td align='right' width='25%'>Age</td>
  38. <td align='left'>
  39. <input size='25' name='age' value='$users[age]'></td>
  40. </tr>
  41. <tr>
  42. <td align='center'></td>
  43. <td align='left'>
  44. <input type='submit' name='edit' value='Update'></td>
  45. </tr>
  46. </table>
  47. </form>
  48. "; // Displays the form
  49. }else{
  50. $email = htmlspecialchars($_POST[email]);//removes all HTML
  51. $age = htmlspecialchars($_POST[age]);//removes all HTML
  52. $location = htmlspecialchars($_POST[location]);//removes all HTML
  53. $level = htmlspecialchars($_POST[level]);//removes all HTML
  54. echo "Thank you $logged[username], $_GET[member]'s Profile was updated!"; // Shows the message of your choice (feel free to change it)
  55. $update = mysql_query("Update members set location = '$location', age = '$age', level = '$level', email = '$email' where username = '$_GET[member]'"); // updates the user
  56. }
  57. }else{
  58. $adminuser = mysql_query("Select * from members order by username asc"); //Makes a list of all the users in alphabeticle order!
  59. while($adminusers = mysql_fetch_array($adminuser))
  60. {
  61. echo "<a href='admin.php?member=$adminusers[username]'>$users[username]</a>"; //Displayes the links to edit the user.
  62. }
  63. }
  64. }else{
  65. //If someone is trying to get onto this page without being an admin then they wont get through!
  66. echo "Sorry, but only Admins may view this page. Please go back!";
  67. }
  68. ?>


Sorry for this and Double Post.
Posted on Thursday 31st May 2007 at 02:33 AM
MCP
MCP's Avatar
It is not blank anymore.

It just says "Sorry, but only Admins may view this page. Please go back!" whether I am set at userlevel 6 or not.
Login or register to respond to this forum topic.