- Joined
- Jun 27, 2009
- Messages
- 1,571
- Reaction score
- 170
Hey!!
so time is getting closer for me to release and it this is hopefully the last thing that needs to be coded is the bans for my CMS I've edited everything pertaining to bans. I've been testing it with my Test Account but it can still login to the CMS.
banned.php
checkBan.php
class.core.php (Ban Function)
so time is getting closer for me to release and it this is hopefully the last thing that needs to be coded is the bans for my CMS I've edited everything pertaining to bans. I've been testing it with my Test Account but it can still login to the CMS.
banned.php
PHP:
<?php
session_destroy();
?>
<title>{hotelName}: Banned</title>
<?php
if($_SESSION['user']['id']){
$getuserinfo = mysql_query("SELECT * FROM users WHERE id='".$_SESSION['user']['id']."'");
while($row = mysql_fetch_array($getuserinfo)){
$usernameban = $row['username'];
}
$getuserinfo= mysql_query("SELECT * FROM bans WHERE value='{$usernameban}'");
while($row = mysql_fetch_array($getuserinfo)){
$username2 = $row['value'];
$bantype = $row['type'];
$reason = $row['ban_reason'];
$expire = $row['ban_expire'];
echo '<center>';
echo "Username: " . $username2;
echo '<br /><br />';
echo "Reason: " . $reason;
echo '<br /><br />';
echo "Type: " . $bantype;
echo '<br /><br />';
$getuserinfo2= mysql_query("SELECT * FROM bans WHERE value='{$usernameban}'");
while($row = mysql_fetch_array($getuserinfo2)){
$expire = $row['ban_expire'];
if($expire < time()){
header('Location: me');
exit;
}
else
{
}
}
// Now we convert the Unix timestamp to a humanley readable time
$date = date("l d F Y H:i:s", $expire);
echo "Ban expires on: " . $date;
}
}
?></center></td>
</tr>
</table>
checkBan.php
PHP:
<?php
if($_SESSION['user']['id']){
$getuserinfo = mysql_query("SELECT * FROM users WHERE id='".$_SESSION['user']['id']."'");
while($row = mysql_fetch_array($getuserinfo)){
$usernameban = $row['username'];
$ipban = $row['ip_current'];
}
$getuserinfo= mysql_query("SELECT * FROM bans WHERE value='{$usernameban}' AND ban_expire > UNIX_TIMESTAMP() ORDER BY expire DESC LIMIT 1");
$getuserinfoip= mysql_query("SELECT * FROM bans WHERE value='{$ipban}' AND ban_expire > UNIX_TIMESTAMP() ORDER BY expire DESC LIMIT 1");
while($row = mysql_fetch_array($getuserinfo)){
$expire = $row['ban_expire'];
if($expire <= time()){
}
else{
header('Location: banned');
exit;
}
}
while($row = mysql_fetch_array($getuserinfoip)){
$expire = $row['ban_expire'];
if($expire <= time()){
}
else{
header('Location: ipbanned');
exit;
}
}
}
?>
PHP:
final public function getBans()
{
global $engine;
return $engine->result("SELECT count(id) from bans");
}