database call?
hi, i'm new to the community.
can anyone help me with this problem?
i'm working on a site where users login and have their own account names,
and trying to develop a username banning system which is based on an open source i.p banning script i found.
the script seems to work fine, but as it's cookie based it's causing some problems when you un-ban a user and grant them access again.
i store all my usernames in a SQL database table called: site_users, and the usernames in a field called: uname
how can i modify this script so it reffers to the database for the username, then checks it against the list of banned users store in a text file?
cookiedecode($user);
$username = $cookie[1];
$fd = fopen ("userban.txt", "r");
while (!feof ($fd)) {
$buffer = fgets($fd, 4096);
$buffer= chop($buffer);
$banneduser = $username;
if ($banneduser == "$buffer") {
// if so write it to a logfile
$file = "log.txt";
$log = fopen($file,"a+");
$line = fgets($log, 4096);
fclose($log);
// write banned user trying to access to logfile
$string = "$banneduser::PERMISSION DENIED\n";
$log = fopen($file, "a+");
$string = fwrite($log, $string);
fclose($log);
throws banned user to another page
// ? >
< script language="javascript" >
< !--
document . location= 'banned.php';
/// -- >
< /script >
can anyone help me with this problem?
i'm working on a site where users login and have their own account names,
and trying to develop a username banning system which is based on an open source i.p banning script i found.
the script seems to work fine, but as it's cookie based it's causing some problems when you un-ban a user and grant them access again.
i store all my usernames in a SQL database table called: site_users, and the usernames in a field called: uname
how can i modify this script so it reffers to the database for the username, then checks it against the list of banned users store in a text file?
cookiedecode($user);
$username = $cookie[1];
$fd = fopen ("userban.txt", "r");
while (!feof ($fd)) {
$buffer = fgets($fd, 4096);
$buffer= chop($buffer);
$banneduser = $username;
if ($banneduser == "$buffer") {
// if so write it to a logfile
$file = "log.txt";
$log = fopen($file,"a+");
$line = fgets($log, 4096);
fclose($log);
// write banned user trying to access to logfile
$string = "$banneduser::PERMISSION DENIED\n";
$log = fopen($file, "a+");
$string = fwrite($log, $string);
fclose($log);
throws banned user to another page
// ? >
< script language="javascript" >
< !--
document . location= 'banned.php';
/// -- >
< /script >
