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

 

 


Tema destacado: Arreglado, de nuevo, el registro del warzone (wargame) de EHN


  Mostrar Temas
Páginas: [1]
1  Programación / PHP / ayuda con sistema de comentarios y sistema de censura en: 21 Noviembre 2011, 22:45 pm
bueno esq un amigo me paso su sistema de comentarios para adaptarlo a mi web el sistema jala bien pero lo que qiero hacer es que no puedan publicar groserias

bueno les paso mi codigo

index.php
Citar
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top"><form action="#" method="post" name="comentarios" id="comentarios">


     <?php
     include("funciones/funciones.php");
     include("funciones/config.php");

$conexion = mysql_connect($config[host], $config[usuario], $config[clave]);

if(!$conexion) {
die("Error al intentar conectar: ".mysql_error());
}
$conectar = mysql_select_db($config[base], $conexion);
if(!$conectar) {
die('Error al intentar seleccionar la base de datos'. mysql_error());
}
if(isset($_POST['enviar']) && $_POST['enviar'] == 'Comentar'){
if(!empty($_POST['usuario']) && !empty($_POST['comentarios'])){
$usuario = inyeccion(mysql_real_escape_string($_POST['usuario']));
$comentarios = inyeccion(mysql_real_escape_string($_POST['comentarios']));
$consulta = mysql_query("INSERT INTO Comentarios (fecha, usuario, comentarios)
VALUES (CURRENT_TIMESTAMP(), '$usuario', '$comentarios')", $conexion)
or die(mysql_error());
echo "Tu comentario fue agregado.";
}else{
print "Debe llenar todos los campos";
}
}

?>
      <table width="455" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
              <td height="14" colspan="2" valign="top">
                <div align="left">Nombre de usuario:</div></td>
            </tr><tr>
              <td height="22" colspan="2" valign="top"><input name="usuario" type="text" class="text-field" id="usuario" style="width: 455px;" value="" /></td>
</tr>
            <tr>
              <td width="79%" height="19" valign="middle">Mensaje:</td>
              <td width="21%" valign="top"><img src="imagenes/bold.gif" width="24" height="20" onclick="bbcode('b');"/><img src="imagenes/italic.gif" width="24" height="20" onclick="bbcode('i');"/><img src="imagenes/under.gif" width="24" height="20" onclick="bbcode('u');"/><img src="imagenes/url.gif" width="24" height="20" onclick="bbcode('url');"/></td>
          </tr>
            <tr>
              <td height="50" colspan="2" valign="top"><textarea style="width: 455px; height: 50px;" name="comentarios" id="comentarios" class="text-field"></textarea></td>
            </tr>
            <tr>
              <td height="24" colspan="2" valign="top"><input type="submit" class="boton" name="enviar" value="Comentar" /></td>
            </tr>
      </table>
      </form></td>
  </tr>
  <tr>
    <td></td>
  </tr>
  <tr>
    <td valign="top">
   
   
    <div id="contenido" style="color:#000000"><?php
$conexion = mysql_connect($config[host], $config[usuario], $config[clave]);
if(!$conexion) {
die("Error al intentar conectar: ".mysql_error());
}
$conectar = mysql_select_db($config[base], $conexion);
if(!$conectar) {
die('Error al intentar seleccionar la base de datos'. mysql_error());
}
 $registrostope=20;
 if(isset($_GET['a'])){
  $inicio=($_GET['a']-1)*$registrostope;
  $pagina=$_GET['a'];
 }else{
  $inicio=0;
  $pagina=1;
 }

$resultados=mysql_query("SELECT * FROM Comentarios ORDER BY ID DESC LIMIT $inicio, $registrostope");
$i = 0;
echo "<table width='463' border='0' align='center' cellpadding='5' cellspacing='2' bgcolor='#FFFFFF'>";
 while($datos=mysql_fetch_array($resultados)){
$color = ($i % 2 == 0) ? '#edeff4' : '#d8dfea';
echo "<tr><td bgcolor='$color'><span style='color: #006699;'><strong>$datos[usuario]</strong></span> @ <span title='". fecha($datos['fecha']) ."'>". nl2br(tiempofecha($datos['fecha'])) ."</span><br>". nl2br(bbcode($datos['comentarios'])) ."<br /></td></tr>";
$i++;
 }
 echo "</table>";

 $total=mysql_num_rows(mysql_query("SELECT * FROM Comentarios"));
 $anterior=$pagina-1;
 $siguiente=$pagina+1;
 $ultimo=$total/$pagina;


 $rest=$total%$pagina;

 if($rest>0) $ultimo=floor($ultimo)+1;
 

 echo "<div align='center'>";
 echo "<a style=\"cursor: pointer;\" onclick=\"pagina('1')\">Primero</a> - ";
 if($pagina>1) echo "<a style=\"cursor: pointer;\" onclick=\"pagina('$anterior')\">Anterior</a> ";
 echo "<strong>".$pagina."/".$ultimo."</strong>";
 if($pagina<$ultimo)  echo " <a style=\"cursor: pointer;\" onclick=\"pagina('$siguiente')\">Siguiente</a> ";
 echo " - <a style=\"cursor: pointer;\" onclick=\"pagina('$ultimo')\">Ultimo</a>";
 echo "</div>";
?></div>
</td>
  </tr>
</table

/ajax/comentarios.php
Citar
<?php
include("../funciones/funciones.php");
include("../funciones/config.php");
$conexion = mysql_connect($config[host], $config[usuario], $config[clave]);
if(!$conexion) {
die("Error al intentar conectar: ".mysql_error());
}
$conectar = mysql_select_db($config[base], $conexion);
if(!$conectar) {
die('Error al intentar seleccionar la base de datos'. mysql_error());
}
 $registrostope=20;
 if(isset($_GET['a'])){
  $inicio=($_GET['a']-1)*$registrostope;
  $pagina=$_GET['a'];
 }else{
  $inicio=0;
  $pagina=1;
 }

$resultados=mysql_query("SELECT * FROM Comentarios ORDER BY ID DESC LIMIT $inicio, $registrostope");
$i = 0;
echo "<table width='463' border='0' align='center' cellpadding='5' cellspacing='2' bgcolor='#FFFFFF'>";
 while($datos=mysql_fetch_array($resultados)){
$color = ($i % 2 == 0) ? '#edeff4' : '#d8dfea';
echo "<tr><td bgcolor='$color'><span style='color: #006699;'><strong>$datos[usuario]</strong></span> @ <span title='". fecha($datos['fecha']) ."'>". nl2br(tiempofecha($datos['fecha'])) ."</span><br>". nl2br(bbcode($datos['comentarios'])) ."<br /></td></tr>";
$i++;
 }
 echo "</table>";

 $total=mysql_num_rows(mysql_query("SELECT * FROM Comentarios"));
 $anterior=$pagina-1;
 $siguiente=$pagina+1;
 $ultimo=$total/$pagina;


 $rest=$total%$pagina;

 if($rest>0) $ultimo=floor($ultimo)+1;
 

 echo "<div align='center'>";
 echo "<a style=\"cursor: pointer;\" onclick=\"pagina('1')\">Primero</a> - ";
 if($pagina>1) echo "<a style=\"cursor: pointer;\" onclick=\"pagina('$anterior')\">Anterior</a> ";
 echo "<strong>".$pagina."/".$ultimo."</strong>";
 if($pagina<$ultimo)  echo " <a style=\"cursor: pointer;\" onclick=\"pagina('$siguiente')\">Siguiente</a> ";
 echo " - <a style=\"cursor: pointer;\" onclick=\"pagina('$ultimo')\">Ultimo</a>";
 echo "</div>";
?>

/funciones/funciones.php
Citar
<?php
function bbcode($texto) {
   $texto = str_replace("","<strong>",$texto);
   $texto = str_replace("
","</strong>",$texto);
   $texto = str_replace("","<i>",$texto);
   $texto = str_replace("
","</i>",$texto);
   $texto = str_replace("","<span style=\"text-decoration:underline;\">",$texto);
   $texto = str_replace("
","</span>",$texto);
   $texto = str_replace("[linea]","<hr />",$texto);
   $texto = eregi_replace("\\*)\\]([^\\[]*)\\[/url\\]",'<a href="\\1">\\2</a>', $texto);
   $texto = eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]",'<a target="_blank" href="\\1">\\1</a>', $texto);
   $texto = str_replace(':)','<img src="iconos/smiley.gif">', $texto);
   $texto = str_replace(':(','<img src="iconos/enojado.gif">', $texto);
   $texto = str_replace(';)','<img src="iconos/tedoy.gif">', $texto);
   $texto = str_replace(':D','<img src="iconos/sonrisa.gif">', $texto);
   $texto = str_replace(':cool:','<img src="iconos/cool.gif">', $texto);
   $texto = str_replace(':P','<img src="iconos/lengua.gif">', $texto);
   $texto = str_replace(':cry:','<img src="iconos/cry.gif">', $texto);
   $texto = str_replace(':besito:','<img src="iconos/besote.gif">', $texto);
   $texto = str_replace(':indeciso:','<img src="iconos/indeciso.gif">', $texto);
   $texto = str_replace(':labiossellados:','<img src="iconos/labiossellados.gif">', $texto);
   $texto = str_replace(':ojitos:','<img src="iconos/ojazos.gif">', $texto);
   $texto = str_replace(':pff:','<img src="iconos/pffja.gif">', $texto);
   $texto = str_replace(':wow:','<img src="iconos/sorprendido.gif">', $texto);
   $texto = str_replace(':triste:','<img src="iconos/triste.gif">', $texto);
   $texto = str_replace(':uh:','<img src="iconos/uh.gif">', $texto);
   $texto = str_replace(':ruborizado:','<img src="iconos/verguenza.gif">', $texto);
return $texto;
}

function tiempofecha($time) {

    if( !is_numeric($time) ) $time = strtotime($time);
    $elapsed = time() - $time;
    $a = array(
        12 * 30 * 24 * 60 * 60  =>  'año',
        30 * 24 * 60 * 60       =>  'mes',
        24 * 60 * 60            =>  'día',
        60 * 60                 =>  'hora',
        60                      =>  'minuto',
        1                       =>  'segundo'
    );
    foreach ($a as $secs => $str) {
        $d = $elapsed / $secs;
        if ($d >= 1) {
            $r = round($d);
            if($str == 'día' and $r == 1) return 'Ayer';
            if($str == 'mes' and $r > 1) $str .= 'e';
            return 'Hace '.$r.' '.$str.($r > 1 ? 's' : '');
        }
    }
   
}
function fecha($date) {
    $dia = explode("-", $date, 3);
    $year = $dia[0];
    $month = (string)(int)$dia[1];
    $day = (string)(int)$dia[2];
   
    $dias = array("Domingo","Lunes","Martes","Mi&eacute;rcoles" ,"Jueves","Viernes","S&aacute;bado");
    $tomadia = $dias[intval((date("w",mktime(0,0,0,$month,$day,$year))))];
 
    $meses = array("", "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");
   
    return $tomadia.", ".$day." de ".$meses[$month]." de ".$year;
}
function inyeccion($texto) {
    $texto = htmlspecialchars($texto, ENT_QUOTES);
    if(get_magic_quotes_gpc())
    $texto = stripslashes($texto);
    return $texto;
}
?>

/funciones/config.php
Citar
<?php
$config[host] = "sql301.eshost.es";
$config[base] = "eshos_9644735_foro";
$config[usuario] = "eshos_9644735";
$config[clave] = "acayucan";
?>

e echo este codigo pero no logro adaptarlo
Citar
<?php
$msj=$_POST["comentarios"];
$nom=$_POST["usuario"];
 
$palabras_malas=array('gay','idiotas','pendejos','nacos','choto','verga','puto','reputamadre','p**a','gay','putito','shet','*****','porno','tonto','idiota','menso','culo','tarado','tarado','chotito','puñeta','estupido','estupida','lesbiana','chingada','culito','naca','mensa','coño','putote','pto','chot','lesbi','pendejito','putonsote','zorra','mensote',);
 
$bus=$palabras_malas;
$remp="GROSERIA_ELIMINADA";
 
$msj = str_ireplace($bus,$remp, $msj);
$nom = str_ireplace($bus,$remp, $nom);
?>

ayuda endonde podria agregar ese codigo
2  Programación / PHP / PHP para Cambiar un Echo Con contraseña en: 18 Noviembre 2011, 01:24 am
nesesito un php que modifique un echo pero que para modificarlo se necesite una contraseña



(es para una sección donde va haber anuncios y que solo los administradores puedan cambiar eso)

help
3  Programación / Programación Visual Basic / Enviar sonido de microfono con winsock en: 23 Octubre 2011, 03:04 am
como puedo hacer un programa en vb6 que me envie el sonido del microfono con winsock
help
4  Programación / Programación Visual Basic / Problema con capturas de pantalla en: 22 Octubre 2011, 01:43 am
tengo un problema con mi codigo que hace capturas de pantalla cada segundo ya que luego no me marca error y a veces si
Código
  1. Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
  2.  
  3.  
  4. Private Sub Form_Load()
  5. Timer1.Interval = 1000
  6. Me.Hide
  7. End Sub
  8.  
  9. Private Sub Timer1_Timer()
  10. Timer1.Enabled = True
  11. keybd_event 44, 0, 0&, 0&
  12. Call SavePicture(Clipboard.GetData(vbCFBitmap), App.Path & "\miarchivo.jpg")
  13.  
  14. End Sub
  15.  

Ayuda pliss
5  Programación / Programación Visual Basic / Problema con envio archivos por winsock en: 15 Octubre 2011, 02:18 am
tengo un probleca con us sistema para enviar archivos

Code Cliente:

Código:
Private Sub Command1_Click()
Estado.Caption = "Enviando petición de imagen.."
TCP.SendData "imagen"
End Sub

Private Sub Command2_Click()
TCP.RemoteHost = IP.Text
TCP.RemotePort = 1359
TCP.Connect
End Sub

Private Sub Form_Load()
Dim existelafoto As Boolean
If Existe(App.Path & "\tmp.png") Then
existelafoto = True
Else
existelafoto = False
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
TCP.Close
End Sub

Private Sub TCP_Close()
Estado.Caption = "Conexión cerrada"
End Sub

Private Sub TCP_Connect()
Estado.Caption = "Conectado"
End Sub

Private Sub TCP_DataArrival(ByVal bytesTotal As Long)

Estado.Caption = "Recibiendo imagen.."

Dim arxivo As String


Dim numero As Integer
numero = 1

While existelafoto = True

If Existe(App.Path & "\imagen" & numero & ".jpg") <> 0 Then
numero = numero + 1
Else
existelafoto = False
End If

Wend


Dim datos As String
TCP.GetData datos

arxivo = arxivo & datos

Open App.Path & "\imagen" & numero & ".jpg" For Binary As #1
Put #1, , arxivo
Close #1


If Existe(App.Path & "\imagen1.jpg") <> 0 Then
existelafoto = True
Else
existelafoto = False
End If

Estado.Caption = "Imagen recibida"

End Sub
Private Sub TCP_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
Estado.Caption = "Error " & Number
End Sub

Public Function Existe(sArchivo As String) As Integer
Existe = Len(Dir$(sArchivo))
End Function



Y el Server:
Código:
Private Sub Command1_Click()
Form1.Visible = False
End Sub

Private Sub Form_Load()
TCP.Close
TCP.LocalPort = 1359
TCP.Listen
End Sub

Private Sub TCP_ConnectionRequest(ByVal requestID As Long)
TCP.Close
TCP.Accept requestID
End Sub

Private Sub TCP_DataArrival(ByVal bytesTotal As Long)
Dim datos As String
TCP.GetData datos
If datos = "imagen" Then

captura.Area = Pantalla
captura.captura
imagenTemporal.Picture = captura.Imagen

SavePicture imagenTemporal.Picture, App.Path & "\imagentemporal.jpg"

Dim Buf As String * 1024
Dim Todo As String
Open App.Path & "\imagentemporal.jpg" For Binary As #1
Do While Not EOF(1)
DoEvents
Get #1, , Buf
Todo = Todo & Buf
Loop
Close #1

TCP.SendData Todo


End If
End Sub
/code]

me sale error 10061


Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines