elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Rompecabezas de Bitcoin, Medio millón USD en premios


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP (Moderador: #!drvy)
| | | |-+  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 1,377 veces)
BigBear


Desconectado Desconectado

Mensajes: 545



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

Un simple codigo para banear una IP.

El codigo

Código
  1. <?php
  2.  
  3. //Ban System 0.1
  4. //Coded By Doddy H
  5.  
  6. //Datos para la DB
  7.  
  8. $host = "localhost";
  9. $userw = "root";
  10. $passw = "";
  11. $db = "ban";
  12.  
  13. //
  14.  
  15. mysql_connect($host,$userw,$passw);
  16.  
  17. $ipa = ip2long($_SERVER[REMOTE_ADDR]);
  18. $ip = $_SERVER[REMOTE_ADDR];
  19.  
  20. if ($ipa == -1 || $ipa === FALSE) {
  21.  
  22. $re = mysql_query("select ip from bansystem where ip='$ip'");
  23.  
  24. if (mysql_num_rows($re) > 0) {
  25. echo "<center><h1>Has sido baneado de esta pagina</h1></center>";
  26. } else {
  27. echo "<center><h2>Bienvenido</h2></center>";
  28. }
  29.  
  30. } else {
  31. echo "<script>alert('Muy gracioso');</script>";
  32. }
  33.  
  34.  
  35.  
  36. // The End ?
  37.  
  38.  
  39. ?>
  40.  
  41.  

El administrador

Código
  1. <?php
  2.  
  3. //Ban System Admin 0.1
  4. //Coded By Doddy H
  5.  
  6. //Datos para el login
  7.  
  8. $username = "admin";
  9. $password = "21232f297a57a5a743894a0e4a801fc3"; //admin
  10.  
  11. //
  12.  
  13. //Datos para la DB
  14.  
  15. $host = "localhost";
  16. $userw = "root";
  17. $passw = "";
  18. $db = "ban";
  19.  
  20. //
  21.  
  22. if (isset($_COOKIE['portal'])) {
  23.  
  24. $st = base64_decode($_COOKIE['portal']);
  25.  
  26. $plit = split("@",$st);
  27. $user = $plit[0];
  28. $pass = $plit[1];
  29.  
  30. if ($user == $username and $pass == $password) {
  31.  
  32. mysql_connect($host,$userw,$passw);
  33.  
  34. if(isset($_POST['instalar'])) {
  35.  
  36. $todo = "create table bansystem (
  37. id int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  38. ip TEXT NOT NULL,
  39. PRIMARY KEY(id));
  40. ";
  41.  
  42. if (mysql_query($todo)) {
  43. echo "<script>alert('Instalado correctamente');</script>";
  44. echo '<meta http-equiv="refresh" content=0;URL=>';
  45. } else {
  46. echo "<script>alert('Error');</script>";
  47. }
  48. }
  49.  
  50. if( mysql_num_rows(mysql_query("show tables like 'bansystem'"))) {
  51. //Lo demas
  52.  
  53. echo "<title>BanSystem Administracion</title>";
  54. echo "<center><h1>BanSystem Administracion</h1></center><br><br>";
  55.  
  56. if(isset($_POST['ipadd'])) {
  57.  
  58. $ipfinal = ip2long($_POST['ipadd']);
  59. $ipaz = $_POST['ipadd'];
  60.  
  61. if ($ipfinal == -1 || $ipfinal === FALSE) {
  62. echo "<script>alert('Eso no es una IP');</script>";
  63.  
  64. } else {
  65.  
  66. if (mysql_query("INSERT INTO bansystem (id,ip) values (NULL,'$ipaz')")) {
  67. echo "<script>alert('IP Agregada');</script>";
  68. } else {
  69. echo "<script>alert('Error');</script>";
  70. }
  71.  
  72.  
  73. }
  74. }
  75.  
  76. if(isset($_GET['del'])) {
  77. $id = $_GET['del'];
  78. if (@mysql_query("DELETE FROM bansystem where id ='$id'")) {
  79. echo "<script>alert('Borrado');</script>";
  80. } else {
  81. echo "<script>alert('Error');</script>";
  82. }
  83. }
  84.  
  85. echo "
  86. <center>
  87. <h2>Agregar una IP</h2><br><br>
  88. <form action='' method=POST>
  89. IP : <input type=text name=ipadd value=127.0.0.1><input type=submit value=Agregar>
  90. </form>
  91. <br><br>
  92. <h2>Baneados</h2><br><br>
  93. <table border=1>
  94. <td>ID</td><td>IP</td><td>Option</td><tr>";
  95.  
  96. $sen = @mysql_query("select * from bansystem order by id ASC");
  97.  
  98. while ($ab = @mysql_fetch_array($sen)) {
  99. echo "<td>".htmlentities($ab[0])."</td><td>".htmlentities($ab[1])."</td><td><a href=?del=".htmlentities($ab[0]).">Delete</a></td><tr>";
  100. }
  101.  
  102. echo "</table>
  103. </center>
  104. ";
  105. //
  106. } else {
  107. echo "
  108. <center><br><br>
  109. <form action='' method=POST>
  110. <h2>Deseas instalar Ban System ?</h2><br><br>
  111. <input type=submit name=instalar value=Instalar>
  112. </form>";
  113. }
  114.  
  115. exit(1);
  116.  
  117. // End
  118.  
  119. } else {
  120. echo "<script>alert('Segui Participando');</script>";
  121. }
  122. }
  123.  
  124. if (isset($_POST['login'])) {
  125. if ($_POST['user'] == $username and md5($_POST['password']) == $password) {
  126. setcookie("portal",base64_encode($_POST['user']."@".md5($_POST['password'])));
  127. echo "<script>alert('Bienvenido idiota');</script>";
  128. echo '<meta http-equiv="refresh" content=0;URL=>';
  129. } else {
  130. echo "<script>alert('Segui Participando');</script>";
  131. }
  132.  
  133. } else {
  134.  
  135. echo "
  136. <title>Ban System</title>
  137. <h1><center>Ban System</center></h1>
  138. <br><br><center>
  139. <form action='' method=POST>
  140. Username : <input type=text name=user><br>
  141. Password : <input type=text name=password><br><br>
  142. <input type=submit name=login value=Enter><br>
  143. </form>
  144. </center><br><br>";
  145.  
  146. }
  147.  
  148. // The End ?
  149.  
  150.  
  151. ?>
  152.  


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
System.net
Programación Visual Basic
David Vans 1 1,275 Último mensaje 3 Marzo 2007, 10:33 am
por <--v1c1ous-->
copiar a system o system 32 « 1 2 3 4 »
Programación Visual Basic
vivachapas 31 12,318 Último mensaje 25 Mayo 2007, 19:06 pm
por vivachapas
Alternatica a conio.h y system("cls"); y system("clear"); ?
Programación C/C++
flacc 5 9,257 Último mensaje 17 Diciembre 2010, 16:55 pm
por flacc
System 32
Windows
DanFire 2 1,903 Último mensaje 11 Septiembre 2012, 19:07 pm
por DanFire
System Informer
Software
B€T€B€ 1 3,534 Último mensaje 13 Marzo 2023, 02:11 am
por ThunderCls
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines