forked from AlexJezior/TheFallenImmortals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.php
35 lines (30 loc) · 1.3 KB
/
db.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
error_reporting(E_ALL ^ E_DEPRECATED);
//I've set this up to make the connection to your db, shouldn't need changing unless i got something wrong
include_once "includes/db.inc.php";
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $database) or trigger_error(mysqli_error(mysqli_connect($dbhost, $dbuser, $dbpass, $database)),E_USER_ERROR);
// mysqli_select_db($conn, $database) or die("Where?");
include('varset.php');
//Global Variables
$date = time();
//Auto Administration
//Banned
$getbanned = mysqli_query($conn, "SELECT * FROM banned WHERE ip='".$charip."'");
if(mysqli_num_rows($getbanned) == "1")
{
print("alert('You are banned.');");
print("window.location = 'http://fallenimmortals.old/';");
}
//Unmute
$getmuted = mysqli_query($conn, "SELECT * FROM muted");
while($muted = mysqli_fetch_array($getmuted))
{
if($muted['mutetime'] <= time())
{
$unmute = mysqli_query($conn, "DELETE FROM muted WHERE id='".$muted['id']."'");
$unmutemessage = "<b><font color=\'#DD00DD\'>Player ".$muted['username']." has been unmuted!</font></b><br />";
$query = mysqli_query($conn, "INSERT INTO chatroom (`date`, `userlevel`, `username`, `message`, `to`)
VALUES ('".$date."', '3', '".$muted['mutedby']."', '".$unmutemessage."', 'Chatroom')") or die(mysqli_error());
}
}
?>