Yep I do have JS enabled, And haven't really changed anything yet. I'll try to make another account and make it admin and test?Do you have Java script enabled?
It works 100% for me, so I'm not sure what you've changed.
Yep I do have JS enabled, And haven't really changed anything yet. I'll try to make another account and make it admin and test?Do you have Java script enabled?
It works 100% for me, so I'm not sure what you've changed.
in post.php there's two commands already in there (Current released version).@Macemore
How do I create my own commands? Such as
/commands - which shows the commands list
/ban <user> - Which Bans the user
if (substr($message, 0, 1) == '/' && substr($message, 1) == 'clear') {
if ($rank == 1) {
$mysqli->query("TRUNCATE TABLE messages");
} else {
return false;
}
}
if (substr($message, 0, 1) == '/' && substr($message, 1, 3) == 'ban') {
if ($rank == 1) {
$variables = explode(" ", $message);
$username = substr($variables[1], 0);
$username1 = 'Server';
$thepost = "{$username} has been banned";
$mysqli->query("UPDATE `users` SET rank='2' WHERE username = '{$username}'");
$mysqli->query("INSERT INTO `messages` (user, message, timestamp) VALUES ('$username1', '$thepost', '$time')");
} else {
return false;
}
}
//unban (literally the opposite of the obove)
if (substr($message, 0, 1) == '/' && substr($message, 1, 5) == 'unban') {
if ($rank == 1) {
$variables = explode(" ", $message);
$username = substr($variables[1], 0);
$username1 = 'Server';
$thepost = "{$username} has been unbanned";
$mysqli->query("UPDATE `users` SET rank='0' WHERE username = '{$username}'");
$mysqli->query("INSERT INTO `messages` (user, message, timestamp) VALUES ('$username1', '$thepost', '$time')");
} else {
return false;
}
}
if (substr($message, 0, 1) == '/' && substr($message, 1, 8) == 'commands') {
$nm = "Available commands:\n
+1 [user] - adds one to a user\n
-1 [user] - removes one from a user\n
/op [user] - makes a user admin \n
/clear - removes all messages\n
/color [user] #[color] - changes a user's color\n
/mfw [link to image] [words] - does 4chan style mfw\n
>[words] - 4chan green text\n";
$user = 'Server';
$mysqli->query("INSERT INTO `messages` (user, message, timestamp) VALUES ('$user', '$message', '$time')");
}
Yeah something with sharefast @RastaLulz sharefast doesnt download on@Macemore the download link doesn't work. But I will try and integrate the commands into the version I have
You can try the sscanf() function for the commands, its more efficient. Check the documentation if you're interested.in post.php there's two commands already in there (Current released version).
What I do is I copy one already made, the version I have on my pc has more commands, I'll link that in the bottom.
That's your standard clear commandPHP:if (substr($message, 0, 1) == '/' && substr($message, 1) == 'clear') { if ($rank == 1) { $mysqli->query("TRUNCATE TABLE messages"); } else { return false; } }
if you don't understand php very well I'm not going to make a tutorial for that too, lrn2php on google.
$message is the message the user tried to send, the if statement gets $message's first character (a b ? etc.) and checks
if it's a "/", standard for commands but you can use anything you want. I suggest you learn substr for more advanced commands (ones with more variables).
The ban command I made basically changed the users rank to 2, in the database rank value can be 0, or a 1, 1 being admin. I changed the table so that 2 is banned (it would be better to have 0 as banned 1 as user and 2 as admin).
Here's the current running version on gamma.mace.pw:PHP:if (substr($message, 0, 1) == '/' && substr($message, 1, 3) == 'ban') { if ($rank == 1) { $variables = explode(" ", $message); $username = substr($variables[1], 0); $username1 = 'Server'; $thepost = "{$username} has been banned"; $mysqli->query("UPDATE `users` SET rank='2' WHERE username = '{$username}'"); $mysqli->query("INSERT INTO `messages` (user, message, timestamp) VALUES ('$username1', '$thepost', '$time')"); } else { return false; } } //unban (literally the opposite of the obove) if (substr($message, 0, 1) == '/' && substr($message, 1, 5) == 'unban') { if ($rank == 1) { $variables = explode(" ", $message); $username = substr($variables[1], 0); $username1 = 'Server'; $thepost = "{$username} has been unbanned"; $mysqli->query("UPDATE `users` SET rank='0' WHERE username = '{$username}'"); $mysqli->query("INSERT INTO `messages` (user, message, timestamp) VALUES ('$username1', '$thepost', '$time')"); } else { return false; } }
You must be registered for see links
Here's an example configuration for /commands to list all commands
inside the quotes from "Available" to "green text\n" you can add any commands you've made yourself using \n to make a new line.PHP:if (substr($message, 0, 1) == '/' && substr($message, 1, 8) == 'commands') { $nm = "Available commands:\n +1 [user] - adds one to a user\n -1 [user] - removes one from a user\n /op [user] - makes a user admin \n /clear - removes all messages\n /color [user] #[color] - changes a user's color\n /mfw [link to image] [words] - does 4chan style mfw\n >[words] - 4chan green text\n"; $user = 'Server'; $mysqli->query("INSERT INTO `messages` (user, message, timestamp) VALUES ('$user', '$message', '$time')"); }
I haven't tested this.