Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 669
0 Users 1 Guests Online
Forum Index » PHP + MySQL » Admin Panel
Posted on Wednesday 30th May 2007 at 07:38 PM
MCP
templates/default/images/noavatar.png's Avatar
Junior Member
http://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
templates/default/images/noavatar.png's Avatar
Senior Member
post your code please lets see whats going on.
Posted on Wednesday 30th May 2007 at 09:14 PM
Diablosblizz
templates/default/images/noavatar.png's Avatar
Senior Member
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
templates/default/images/noavatar.png's Avatar
Junior Member
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
templates/default/images/noavatar.png's Avatar
Junior Member
http://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
templates/default/images/noavatar.png's Avatar
Senior Member
"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
templates/default/images/noavatar.png's Avatar
Junior Member
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
templates/default/images/noavatar.png's Avatar
Senior Member
PHP Code
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
<?
session_start
(); //allows session
include "config.php"// Includes the config
if($logged[username] && $logged[level] == 6)// Checks you are an admin
{
if(
$_GET[member])//gets the username
{
if (!
$_POST[edit])//Checks if you are editing a user already
{
$user mysql_query("SELECT * from members where username = '$_GET[member]'");// Selcts the right user from the database
$users mysql_fetch_array($user);
echo 
"<form method='POST">
<
table width="100%">
<
tr>
<
td align="right" width="25%">
User Level</td>
<
td align="left">
<
select name="level">
<
option value="2">User</option>
<
option value="4"Mod </option>
<
option value="6"Admin</option>
</
select> </td>
</
tr>
<
tr>
<
td align="right" width="25%">
Email</td>
<
td align="left">
<
input type="text" size="25" maxlength="25" name="email"
value="$users[email]"></td>
</
tr>
<
tr>
<
td align="right" width="25%">Location</td>
<
td align="left">
<
input size="25" name="location" value="$users[location]"></td>
</
tr>
<
tr>
<
td align="right" width="25%">Age</td>
<
td align="left">
<
input size="25" name="age"  value="$users[age]"></td>
</
tr>
<
tr>
<
td align="center"></td>
<
td align="left">
<
input type="submit" name="edit" value="Update"></td>
</
tr>
</
table>
</
form>
"; // Displays the form
}else{
$email = htmlspecialchars($_POST[email]);//removes all HTML
$age = htmlspecialchars($_POST[age]);//removes all HTML
$location = htmlspecialchars($_POST[location]);//removes all HTML
$level = htmlspecialchars($_POST[level]);//removes all HTML
echo "
Thank you $logged[username], $_GET[member]'s Profile was updated!"; // Shows the message of your choice (feel free to change it)
$update = mysql_query("Update members set location = '
$location', age = '$age', level = '$level', email = '$email' where username = '$_GET[member]'"); // updates the user
}
}else{
$adminuser = mysql_query("Select * from members order by username asc"); //Makes a list of all the users in alphabeticle order!
while($adminusers = mysql_fetch_array($adminuser))
{
echo "<a href='
admin.php?member=$adminusers[username]'>$users[username]</a>"; //Displayes the links to edit the user.
}
}
}else{
//If someone is trying to get onto this page without being an admin then they wont get through!
echo "Sorry, but only Admins may view this page. Please go back!";
}
?>


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
templates/default/images/noavatar.png's Avatar
Senior Member
Ahh sorry I clicked replace and it replaced one heres the code that will actually work:

PHP Code
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
<?
session_start
(); //allows session
include "config.php"// Includes the config
if($logged[username] && $logged[level] == 6)// Checks you are an admin
{
if(
$_GET[member])//gets the username
{
if (!
$_POST[edit])//Checks if you are editing a user already
{
$user mysql_query("SELECT * from members where username = '$_GET[member]'");// Selcts the right user from the database
$users mysql_fetch_array($user);
echo 
"<form method='POST'>
<table width='100%'>
<tr>
<td align='right' width='25%'>
User Level</td>
<td align='left'>
<select name='level'>
<option value='2'>User</option>
<option value='4'> Mod </option>
<option value='6'> Admin</option>
</select> </td>
</tr>
<tr>
<td align='right' width='25%'>
Email</td>
<td align='left'>
<input type='text' size='25' maxlength='25' name='email'
value='
$users[email]'></td>
</tr>
<tr>
<td align='right' width='25%'>Location</td>
<td align='left'>
<input size='25' name='location' value='
$users[location]'></td>
</tr>
<tr>
<td align='right' width='25%'>Age</td>
<td align='left'>
<input size='25' name='age'  value='
$users[age]'></td>
</tr>
<tr>
<td align='center'></td>
<td align='left'>
<input type='submit' name='edit' value='Update'></td>
</tr>
</table>
</form> 
"
// Displays the form
}else{
$email htmlspecialchars($_POST[email]);//removes all HTML
$age htmlspecialchars($_POST[age]);//removes all HTML
$location htmlspecialchars($_POST[location]);//removes all HTML
$level htmlspecialchars($_POST[level]);//removes all HTML
echo "Thank you $logged[username]$_GET[member]'s Profile was updated!"// Shows the message of your choice (feel free to change it)
$update mysql_query("Update members set location = '$location', age = '$age', level = '$level', email = '$email' where username = '$_GET[member]'"); // updates the user
}
}else{
$adminuser mysql_query("Select * from members order by username asc"); //Makes a list of all the users in alphabeticle order!
while($adminusers mysql_fetch_array($adminuser))
{
echo 
"<a href='admin.php?member=$adminusers[username]'>$users[username]</a>"//Displayes the links to edit the user.
}
}
}else{
//If someone is trying to get onto this page without being an admin then they wont get through!
echo "Sorry, but only Admins may view this page. Please go back!";
}
?>


Sorry for this and Double Post.
Posted on Thursday 31st May 2007 at 02:33 AM
MCP
templates/default/images/noavatar.png's Avatar
Junior Member
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.