[Tool/Web/Other] Ban List v1 - View an active ban list [PHP] [MYSQL]
#1

MD5's PHP/MYSQL Ban List
Quote:
Ban List v1.0

I made this Ban List for my server originally. But, I've decided to release it as I haven't seen it in this section yet. Nothing is advanced here, and should be quite easy to get going.

- Minor PHP/MYSQL knowledge required to use this.

Quote:
Installation Procedure(s)

1. Download the file from the archive link below.
2. Extract it to your desktop, or a preferred folder.
3. Open up "index.php", and find the MySQL connection settings at the top. And change them to your own settings.
4. Then, find the "mysql_query" and edit the path variables to your own.
5. Now finally, goto the bottom and where you see "echo" find "playerbanned" etc, and change them to your own variables.

Quote:
License

There's not a strict license on it, but if you could. Leave "author=md5" in the script.

Reply
#2

Your code kind of looks like this gamemodes bans page https://sampforum.blast.hk/showthread.php?tid=527966

At least give credits.
Reply
#3

Quote:
Originally Posted by awsomedude
View Post
Your code kind of looks like this gamemodes bans page https://sampforum.blast.hk/showthread.php?tid=527966

At least give credits.
Didn't even know that existed until you've shared the link.
Reply
#4

MD5, why are you using
Code:
<!--
-->
to comment your code inside the PHP "space", when PHP doesn't even support that type of comments?
Reply
#5

Ah, I forgot about those. I will remove them.

Edit: Updated the links with the fixed files.
Reply
#6

PHP Code:
<!--Edit these variables to your own!--> 
Well, I think you forgot a line then.
PHP Code:
//KILLS THE MYSQL CONNECTION AFTER EXITED 
It doesn't kill the connection after the user exited the page but when the PHP reached that line.
PHP Code:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> 
Why ISO-8859-1 ?
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
As of HTML 5 you don't need everything after the PUBLIC
PHP Code:
<!DOCTYPE html
PHP Code:
if (mysqli_num_rows($result) > 0) { 
Eh, another one :v
why not simply
PHP Code:
if(mysqli_num_rows($result)) { 
PHP Code:
while($row mysqli_fetch_assoc($result)) {
        
//HTML codes inside of "echo" represent the actual *html* code.
        
echo "<div class='tablestuff2 table'>"
        echo 
"<table border='1'>";
        echo 
"<thead>";
        echo 
"<tr>";
        echo 
"<th id='th1' style='width: 150px'><font color = 'red'>Banned Player</font></th>";
        echo 
"<th id='th2' style='width: 150px'><font color = 'red'>Banned By</font></th>";
        echo 
"<th id='th3' style='width: 150px'><font color = 'red'>Banned Reason</font></th>";
        echo 
"</tr>";
        echo 
"</thead>";
        echo 
"</table>";
        echo 
"</div>";
    while(
$row mysqli_fetch_assoc($result)) 
    {
        echo 
"<div class='tablestuff2 table'>";
        echo 
"<table border='1'>";
        echo 
"<tbody>";
        echo 
"<tr>";
        echo 
"<td headers='th1' style='width: 150px'>".$row['player_banned']."</td>";
        echo 
"<td headers='th2' style='width: 150px'>".$row['banned_by']."</td>";
        echo 
"<td headers='th3' style='width: 150px'>".$row['banned_for']."</td>";
        echo 
"</tr>";
        echo 
"</tbody>";
        echo 
"</table>";
        echo 
"</div>";
        }
    } 
Why you made two while loops and used so many "echo" ?
You can sum it into one "echo"
PHP Code:
$sql "SELECT ban_id, bannedby, bannedfor, playerbanned FROM users"
You selected these columns, yet
PHP Code:
echo "<td headers='th1' style='width: 150px'>".$row['player_banned']."</td>";
        echo 
"<td headers='th2' style='width: 150px'>".$row['banned_by']."</td>";
        echo 
"<td headers='th3' style='width: 150px'>".$row['banned_for']."</td>"
You're outputing them with underscore _

EDIT: Tested, the first while loop deletes the first ban.
Reply
#7

Quote:
Originally Posted by Kaperstone
View Post
PHP Code:
<!--Edit these variables to your own!--> 
Well, I think you forgot a line then.
PHP Code:
//KILLS THE MYSQL CONNECTION AFTER EXITED 
It doesn't kill the connection after the user exited the page but when the PHP reached that line.
PHP Code:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> 
Why ISO-8859-1 ?
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
As of HTML 5 you don't need everything after the PUBLIC
PHP Code:
<!DOCTYPE html
PHP Code:
if (mysqli_num_rows($result) > 0) { 
Eh, another one :v
why not simply
PHP Code:
if(mysqli_num_rows($result)) { 
PHP Code:
while($row mysqli_fetch_assoc($result)) {
        
//HTML codes inside of "echo" represent the actual *html* code.
        
echo "<div class='tablestuff2 table'>"
        echo 
"<table border='1'>";
        echo 
"<thead>";
        echo 
"<tr>";
        echo 
"<th id='th1' style='width: 150px'><font color = 'red'>Banned Player</font></th>";
        echo 
"<th id='th2' style='width: 150px'><font color = 'red'>Banned By</font></th>";
        echo 
"<th id='th3' style='width: 150px'><font color = 'red'>Banned Reason</font></th>";
        echo 
"</tr>";
        echo 
"</thead>";
        echo 
"</table>";
        echo 
"</div>";
    while(
$row mysqli_fetch_assoc($result)) 
    {
        echo 
"<div class='tablestuff2 table'>";
        echo 
"<table border='1'>";
        echo 
"<tbody>";
        echo 
"<tr>";
        echo 
"<td headers='th1' style='width: 150px'>".$row['player_banned']."</td>";
        echo 
"<td headers='th2' style='width: 150px'>".$row['banned_by']."</td>";
        echo 
"<td headers='th3' style='width: 150px'>".$row['banned_for']."</td>";
        echo 
"</tr>";
        echo 
"</tbody>";
        echo 
"</table>";
        echo 
"</div>";
        }
    } 
Why you made two while loops and used so many "echo" ?
You can sum it into one "echo"
PHP Code:
$sql "SELECT ban_id, bannedby, bannedfor, playerbanned FROM users"
You selected these columns, yet
PHP Code:
echo "<td headers='th1' style='width: 150px'>".$row['player_banned']."</td>";
        echo 
"<td headers='th2' style='width: 150px'>".$row['banned_by']."</td>";
        echo 
"<td headers='th3' style='width: 150px'>".$row['banned_for']."</td>"
You're outputing them with underscore _

EDIT: Tested, the first while loop deletes the first ban.
This is my 2nd release, and I'm still learning PHP. But, thanks for the TIPs.

+Repped.
Reply
#8

I just updated the links and removed "if (mysqli_num_rows($result) > 0) {" as it was useless, and also removed the first ban on the list.
Reply
#9

Links does not works anymore, please fix it.
Reply
#10

Ah! nice work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)