Username:
Password:
Remember me:
Register

Back to forum: Web Programming (HTML, JS, CSS, PHP, MySQL)


Search forums via Google


0 Users appreciate this thread.

How to Program Moderators?
Started by PLMasterSSB
(2013-08-06 18:02:54)
PLMasterSSB (2013-08-06 18:02:54)
Sup Guys,
I need to know how to program moderator privileges and give the privileges to people.

This post has been edited one or more times, the last time was:
2013-08-07 01:03:09

angelrulez7 (2013-08-06 19:12:15)
Create a row in your users table "mod" with default "no" and varchar(3)

Change the row of the mods you want to "yes"

And for mod functions:
<?php if($row['mod'] == 'yes'{
echo "You are a mod";
}else{
echo "You are not a mod";
} ?>
a
PLMasterSSB (2013-08-07 04:00:10)
@angelrulez7 it's not working. Even if I put yes in the "mod" row it just still echoes what I set it to say if your not moderator:

You are currently a member


Anyway to fix that?

This post has been edited one or more times, the last time was:
2013-08-07 11:00:51

PLMasterSSB (2013-08-07 05:30:53)
I actually memorized the code, but in: $row['userlevel'], you have to change $row something? If yes, then what?
(Capt.)Orb (2013-08-08 19:42:31)
You need to select data from your users table then do a while loop.

Also, try reading Akise's post again.
Aviation fact: The a380 is the largest commerical aircraft in service!

Go to Splashiverse! Splashiverse
PLMasterSSB (2013-08-09 05:02:30)
How does a while loop involve this?
(Capt.)Orb (2013-08-09 21:32:47)
To specify what $row is.....
Aviation fact: The a380 is the largest commerical aircraft in service!

Go to Splashiverse! Splashiverse
PLMasterSSB (2013-08-09 22:56:54)
Yeah I found out like 2 minutes later
PLMasterSSB (2013-08-10 14:05:45)
Man, it's still not working. It keeps saying I'm a normal user
11Drago (2013-08-10 16:28:04)
Source Code
<?php Session_start(); Include'connect.php'; $session=htmlentities($_SESSION['username']; $sql=$con->prepare("SELECT * FROM users WHERE username=ession"; $sql->bindParam("ession",$session); $sql->execute(); While($row=$sql->fetch()){ If($row['rank']=="Mod"{ Echo 'You are a mod!';} Else{ Echo 'You are a user!';} }} ?>


That's like the easiest thing you could do.

This post has been edited one or more times, the last time was:
2013-08-10 23:29:17

11Drago (2013-08-10 16:30:23)
Once you set up the table correctly and the connect file, that code should work.
PLMasterSSB (2013-08-10 21:39:25)
I got it to work now. I did a while statement

This post has been edited one or more times, the last time was:
2013-08-11 04:39:57

PLMasterSSB (2013-08-11 05:43:30)
Closed
 

This topic is closed, so you can not post a comment.

This topic's ID: 51590

Back to forum: Web Programming (HTML, JS, CSS, PHP, MySQL)




Total registered users: 8321
New registered users today: 7
Newest registered user: ElegantVulpes

©  Copyright 2026 3DSPlaza. All Rights Reserved