Username:
Password:
Remember me:
Register

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


Search forums via Google


0 Users appreciate this thread.

Manually Banning Users PHP
Started by ChampionLeake
(2016-01-02 03:43:22)
ChampionLeake (2016-01-02 03:43:22)
I seriously recommend you guys to do a databased ban system. This is just something simple or some to start on.

Source Code
<?php session_start(); $username=$_SESSION['username']; $banneduser = 'ChampionLeake'; if(strtolower($username)== strtolower($banneduser)){ { die ("You are currently banned" ) ; } } ?>


This is basically a secure way of banning a user without a database. If they try to use captial letters they can't bypass it due to "if(strtolower($username)== strtolower($banneduser)){ "

Simple, put lame, and a pain putting that in all of your website pages. Enjoy

This post has been edited one or more times, the last time was:
2016-01-02 03:44:58

I'm a web developer, a game developer, a digital artist, musician, and a reverse engineer. A weird mix right?
My Twitter
TheAlexRider (2016-01-06 21:35:11)
I get your point, BUT
Its already connecting to a database

if($_SESSION['banned'] === true) {
die('You're banned.');
}
CoolApps (2016-01-08 12:36:08)
^ This script doesn't connect to the database and that's not how you should be banning people.

I was thinking a more complicated yet useful version of this script. Like using an array of usernames to "ban" and if that name is found to be in that array then they would get cut off.
Newer account: NodePoint
TwilightWinter (2016-05-31 19:59:50)
Wouldn't it be simple if you just make a table of banned users and ban period?
This way you wouldn't need to strlower() the username and there is no way the banned person can bypass it.
‚úč
NodePoint (2016-06-01 04:13:53)
^ That would depend on the table and column collation.
Pentester, web developer, artist, and tech enthusiast.
My site
~Justin~ (2017-04-10 03:45:51)
Well if its using session, its not using a database unless you set it up where it connects to a database and then update the session info based off of the db.
 

Log in to submit a comment

This topic's ID: 81916

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




Total registered users: 7666
New registered users today: 0
Newest registered user: Willy3DS

©  Copyright 2018 3DSPlaza. All Rights Reserved