-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
55 lines (47 loc) · 1.41 KB
/
index.php
File metadata and controls
55 lines (47 loc) · 1.41 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
// EDITABLE STUFF
// in the bottom, add motd body ( welcome message or whatever )
define( 'DB_HOST', '127.0.0.1' );
define( 'DB_USER', 'root' );
define( 'DB_PASS', '' );
define( 'DB_DB' , 'mysql_dust' );
// same as MAX_COOKIE_SIZE in the cookie_ban plugin ( default 32 )
define( 'MAX_COOKIE_SIZE', 32 );
//same as table in the cookie_ban.sma plugin ( default db_bancookies )
$table_name = "db_bancookies";
$table_check = "db_checkcookies";
//mySQL
$mysqli = mysqli_connect(
DB_HOST,
DB_USER,
DB_PASS,
DB_DB
);
// cookie stuff
$cookie_name = "ban";
$userindex = ( isset($_GET[ 'uid' ] ) )? $_GET[ 'uid' ]:0;
$server = ( isset($_GET[ 'srv' ] ) )? $_GET[ 'srv' ]:0;
function GetRandomWord( $len = MAX_COOKIE_SIZE ) {
$word = range( 'a', 'z' );
shuffle( $word );
return substr( implode( $word ), 0, $len );
}
if( $userindex != 0 )
{
if( !isset( $_COOKIE[ $cookie_name ] ) )
{
$cookie = GetRandomWord();
setcookie( $cookie_name, $cookie, time() + ( 31536000 * 2 ) );
}
else
{
$cookie = $_COOKIE[$cookie_name];
}
$query = "REPLACE INTO ".$table_check." VALUES ( NULL, ".$userindex.", '".$cookie."', ".$server." )";
$mysqli->query($query);
}
?>
<head>
</head>
<body>
</body>