elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.
 
Inicio Ayuda Buscar Ingresar Registrarse
28 Mayo 2012, 13:07  


Tema destacado: Últimos eventos sobre seguridad/inseguridad

+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP
| | | |-+  Ban System 0.1
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Ban System 0.1  (Leído 157 veces)
Doddy

Desconectado Desconectado

Mensajes: 219



Ver Perfil
Ban System 0.1
« en: 31 Enero 2012, 21:58 »

Un simple codigo para banear una IP.

El codigo

Código
<?php 
 
//Ban System 0.1
//Coded By Doddy H
 
//Datos para la DB
 
$host = "localhost";
$userw = "root";
$passw = "";
$db = "ban";
 
//
 
mysql_connect($host,$userw,$passw);
mysql_select_db($db);
 
$ipa = ip2long($_SERVER[REMOTE_ADDR]);
$ip = $_SERVER[REMOTE_ADDR];
 
if ($ipa == -1 || $ipa === FALSE) {
 
$re = mysql_query("select ip from bansystem where ip='$ip'");
 
if (mysql_num_rows($re) > 0) {
echo "<center><h1>Has sido baneado de esta pagina</h1></center>";
} else {
echo "<center><h2>Bienvenido</h2></center>";
}
 
} else {
echo "<script>alert('Muy gracioso');</script>";
}
 
mysql_close();
 
 
// The End ?
 
 
?>
 
 

El administrador

Código
<?php 
 
//Ban System Admin 0.1
//Coded By Doddy H
 
//Datos para el login
 
$username = "admin";
$password = "21232f297a57a5a743894a0e4a801fc3"; //admin
 
//
 
//Datos para la DB
 
$host = "localhost";
$userw = "root";
$passw = "";
$db = "ban";
 
//
 
if (isset($_COOKIE['portal'])) {
 
$st = base64_decode($_COOKIE['portal']);
 
$plit = split("@",$st);
$user = $plit[0];
$pass = $plit[1];
 
if ($user == $username and $pass == $password) {
 
mysql_connect($host,$userw,$passw);
mysql_select_db($db);
 
if(isset($_POST['instalar'])) {
 
$todo = "create table bansystem (
id int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
ip TEXT NOT NULL,
PRIMARY KEY(id));
"
;
 
if (mysql_query($todo)) {
echo "<script>alert('Instalado correctamente');</script>";
echo '<meta http-equiv="refresh" content=0;URL=>';
} else {
echo "<script>alert('Error');</script>";
}
}
 
if( mysql_num_rows(mysql_query("show tables like 'bansystem'"))) {
//Lo demas
 
echo "<title>BanSystem Administracion</title>";
echo "<center><h1>BanSystem Administracion</h1></center><br><br>";
 
if(isset($_POST['ipadd'])) {
 
$ipfinal = ip2long($_POST['ipadd']);
$ipaz = $_POST['ipadd'];
 
if ($ipfinal == -1 || $ipfinal === FALSE) {
echo "<script>alert('Eso no es una IP');</script>";
 
} else {
 
if (mysql_query("INSERT INTO bansystem (id,ip) values (NULL,'$ipaz')")) {
echo "<script>alert('IP Agregada');</script>";
} else {
echo "<script>alert('Error');</script>";
}
 
 
}
}
 
if(isset($_GET['del'])) {
$id = $_GET['del'];
if (@mysql_query("DELETE FROM bansystem where id ='$id'")) {
echo "<script>alert('Borrado');</script>";
} else {
echo "<script>alert('Error');</script>";
}
}
 
echo "
<center>
<h2>Agregar una IP</h2><br><br>
<form action='' method=POST>
IP : <input type=text name=ipadd value=127.0.0.1><input type=submit value=Agregar>
</form>
<br><br>
<h2>Baneados</h2><br><br>
<table border=1>
<td>ID</td><td>IP</td><td>Option</td><tr>"
;
 
$sen = @mysql_query("select * from bansystem order by id ASC");
 
while ($ab = @mysql_fetch_array($sen)) {
echo "<td>".htmlentities($ab[0])."</td><td>".htmlentities($ab[1])."</td><td><a href=?del=".htmlentities($ab[0]).">Delete</a></td><tr>";
}
 
echo "</table>
</center>
"
;
//
} else {
echo "
<center><br><br>
<form action='' method=POST>
<h2>Deseas instalar Ban System ?</h2><br><br>
<input type=submit name=instalar value=Instalar>
</form>"
;
}
 
mysql_close();
exit(1);
 
// End
 
} else {
echo "<script>alert('Segui Participando');</script>";
}
}
 
if (isset($_POST['login'])) {
if ($_POST['user'] == $username and md5($_POST['password']) == $password) {
setcookie("portal",base64_encode($_POST['user']."@".md5($_POST['password'])));
echo "<script>alert('Bienvenido idiota');</script>";
echo '<meta http-equiv="refresh" content=0;URL=>';
} else {
echo "<script>alert('Segui Participando');</script>";
}
 
} else {
 
echo "
<title>Ban System</title>
<h1><center>Ban System</center></h1>
<br><br><center>
<form action='' method=POST>
Username : <input type=text name=user><br>
Password : <input type=text name=password><br><br>
<input type=submit name=login value=Enter><br>
</form>
</center><br><br>"
;
 
}
 
// The End ?
 
 
?>
 


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
System V 4
GNU/Linux
creu 1 351 Último mensaje 1 Septiembre 2003, 06:37
por Mordor
Windows System Error 0x800f0203 y Windows System Error 1411
Windows
Kampfen 0 748 Último mensaje 21 Febrero 2006, 15:23
por Kampfen
copiar a system o system 32 « 1 2 3 »
Programación Visual Basic
vivachapas 31 2,574 Último mensaje 25 Mayo 2007, 19:06
por vivachapas
Can you believe Linux system instead of windows system in office work ?
GNU/Linux
boilpass 2 586 Último mensaje 1 Julio 2009, 10:52
por J-Hide
Alternatica a conio.h y system("cls"); y system("clear"); ?
Programación C/C++
Mini_Nauta 5 2,523 Último mensaje 17 Diciembre 2010, 16:55
por Mini_Nauta
Powered by SMF 1.1.16 | SMF © 2006-2008, Simple Machines