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

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


  Mostrar Mensajes
Páginas: 1 2 3 [4] 5 6 7 8 9 10 11 12
31  Programación / PHP / Re: problema update en php en: 6 Noviembre 2010, 16:55 pm
aqui tengo el codigo

Código
  1. <?
  2.  $host="localhost";
  3. $user="user";
  4. $passwd="pass";
  5. $db="bd";
  6.        //Aqui recibimos las variables a actualizar
  7.   $id=$_GET['id'];
  8.   $porn1=$_POST['porn1'];
  9.   $porn2=$_POST['porn2'];
  10.   $nombre=$_POST['nombre'];
  11.   $embed=$_POST['embed'];  
  12.   $cat=$_POST['cat'];
  13.   $cat2=$_POST['cat2'];
  14.   $img=$_POST['img'];
  15.   $dur=$_POST['dur']." minutos";
  16.        //Creamos la conexión
  17.        $link = mysql_connect($host, $user, $passwd);
  18. mysql_select_db($db, $link);
  19.              $sql=mysql_query("UPDATE videos set nombre='$nombre', embed='$embed', img='$img', cat='$cat', cat2='$cat2', porn1='$porn1', porn2='$porn2', dur='$dur's where id='$id'",$link);
  20.              echo "Actualizado correctamente<br>";
  21.  echo $id."<br>";
  22.  echo $nombre."<br>";
  23.  echo $img."<br>";
  24.  echo $cat."<br>";
  25.  echo $cat2."<br>";
  26.  echo $dur."<br>";
  27.  echo $porn1."<br>";
  28.  echo $porn2."<br>";
  29.  echo "<h2 align=center><a href=index.php?id=edit>Editar otro video</a></h2>";
  30. ?>

el problema es que solo me actualiza los registros $nombre y $dur, todos los demás me los actualiza en blanco,a pesar de que las variables las recibe bien en el "echo" del final. porque? gracias!
32  Programación / PHP / Re: problema update en php en: 5 Noviembre 2010, 16:43 pm
no me da ningún error despues de usar  mysql_error();
33  Programación / PHP / problema update en php en: 5 Noviembre 2010, 16:23 pm
hola,estoy haciendo un sistema para editar el contenido de mi web,tengo el siguiente code que no me da error pero no me modifica los datos:

principal
Código
  1. <p align="center"><?php
  2.   include("config.php");
  3.   $link=Conectarse();
  4.   $result=mysql_query("select * from videos order by id desc",$link);
  5. ?>
  6. <TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1 align="center">
  7.      <TR><TD>&nbsp;<B>Nombre</B></TD> <TD>&nbsp;<B>ID</B>&nbsp;</TD> <TD>&nbsp;&nbsp;</TD></TR>
  8. <?php      
  9.   while($row = mysql_fetch_array($result)) {
  10.   $id = $row["id"];
  11.      printf("<tr><td>&nbsp;%s</td><td>&nbsp;%s&nbsp;</td><td><b><a href='editar_video.php?id=$id'>Editar</a></b></td></tr>", $row["nombre"],$row["id"]);
  12.   }
  13.   mysql_free_result($result);
  14.   mysql_close($link);
  15. ?>
  16. </table> </p>

editar_video.php
Código
  1. <html>
  2. <head>
  3.   <title>Enviar video</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <style type="text/css">
  6. body {
  7. background-color: #FCF;
  8. }
  9. </style>
  10. </head>
  11. <body><h1 align="center">Editar video</h1>
  12. <p>
  13.  <?
  14.   include("config.php");
  15. $id=$_GET['id'];
  16.  $link=Conectarse();
  17.   $result=mysql_query("select * from videos WHERE id=$id",$link);
  18.   while($row = mysql_fetch_array($result)) {
  19.   $id = $row["id"];
  20.   $nombre = $row["nombre"];
  21.   $embed = $row["embed"];
  22.   $img = $row["img"];
  23.   $dur = $row["dur"];
  24.   $porn1 = $row["porn1"];
  25.   $porn2 = $row["porn2"];
  26.   $cat1 = $row["cat1"];
  27.   $cat2 = $row["cat2"];
  28.   }
  29.   mysql_free_result($result);
  30.   mysql_close($link);
  31. ?>
  32. </p>
  33.   <form name="form1" method="post" action="editado.php">
  34.       <p>Nombre del video:
  35.       <input name="nombre" type="text" value="<? echo $nombre ?>" size="40" maxlength="40" />
  36.     </p>
  37.       <p>Código embed del video:
  38.         <label>
  39.           <br>
  40.           <textarea name="textarea" id="textarea" cols="45" rows="5"><? echo $embed ?></textarea>
  41.         </label>
  42.       </p>
  43.       <p>Ruta de la imagen del video:
  44.         <input name="img" type="text" value="<? echo $img ?>" size="50" />
  45.     </p>
  46.       <p>Duración del video:
  47.         <input name="dur" type="text" value="<? echo $dur ?>" size="20" />
  48.     </p>
  49.       <p>Pornstar 1:
  50.         <input name="porn1" type="text" value="<? echo $porn1 ?>" size="40" />
  51.     </p>
  52.       <p>Pornstar 2:
  53.         <input name="porn2" type="text" value="<? echo $porn2 ?>" size="40" />
  54.     </p>
  55.       <p>Categoría del video:
  56.         <label for="select"></label>
  57.         <input name="cat1" type="text" value="<? echo $cat1 ?>" size="40" />
  58.       </p>
  59.       <p>Subcategoría del video:      
  60.         <input name="cat2" type="text" value="<? echo $cat2 ?>" size="40" />
  61.       </p>
  62.       <p>
  63.         <input type="submit" value="Actualizar" name="ir"/>
  64.       </p>
  65. </form>
  66. </body>
  67. </html>

editado.php
Código
  1. <html>
  2. <head>
  3.   <title>Enviar video</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <style type="text/css">
  6. body {
  7. background-color: #FCF;
  8. }
  9. </style>
  10. </head>
  11. <body><h1 align="center">Editar video</h1>
  12. <?
  13.  $host="localhost";
  14. $user="userpass";
  15. $db="bd";
  16.  
  17.        //Aqui recibimos las variables a actualizar
  18.  
  19.   $id=$_POST['id'];
  20.   $porn1=$_POST['porn1'];
  21.   $porn2=$_POST['porn2'];
  22.   $nombre=$_POST['nombre'];
  23.   $embed=$_POST['embed'];  
  24.   $cat=$_POST['cat'];
  25.   $cat2=$_POST['cat2'];
  26.   $img=$_POST['img'];
  27.   $dur=$_POST['dur']." minutos";
  28.  
  29.        //Creamos la conexión
  30.  
  31.        $link = mysql_connect($host, $user, $passwd);
  32. mysql_select_db($db, $link);
  33.  
  34.        //aqui preguntamos si hicieron click en el boton actualizar
  35.        if($_POST['ir']=="Actualizar")
  36.       {
  37.              $sql=mysql_query("update [/videos] set nombre='$nombre', embed='$embed', img='$img', cat1='$cat1', cat2='$cat2', porn1='$porn1', porn2='$porn2', dur='$dur' where [/id]='$id'",$link);
  38.              echo "Actualizado correctamente";
  39.        }
  40.       else
  41.       {
  42.           echo "Error al editar el video.";
  43.        }
  44. ?>
  45. </body>
  46. </html>

que es lo que está mal? gracias
34  Programación / Programación Visual Basic / Re: ayudita expresion regular en: 3 Noviembre 2010, 00:43 am
sige sin devolverme nada

Código
  1. Option Explicit
  2.  
  3. Public Function Get_Text(ByVal sText As String, ByVal sPatern As String) As Collection
  4. Dim cTemp                       As New Collection
  5. Dim oRegExp                     As Object
  6. Dim oMatch                      As Object
  7. Dim oMatches                    As Object
  8. Dim Q                           As Long
  9.  
  10.    Set oRegExp = CreateObject("VBScript.RegExp") 'Evitamos la referencia
  11.  
  12.    With oRegExp
  13.        .Pattern = sPatern
  14.        .Global = True
  15.        .IgnoreCase = True
  16.    End With
  17.  
  18.    Set oMatches = oRegExp.Execute(sText)
  19.  
  20.    For Q = 0 To oMatches.Count - 1
  21.        Set oMatch = oMatches(Q)
  22.        cTemp.Add oMatch.SubMatches(0)
  23.    Next Q
  24.  
  25.    Set Get_Text = cTemp
  26. End Function
  27. Private Sub Command1_Click()
  28.    Text2.Text = WebBrowser1.Document.documentElement.innerHTML
  29.    Dim vItem                   As Variant
  30. Dim S                       As String
  31.    S = Text2.Text
  32.    For Each vItem In Get_Text(S, "\<div align\=""justify""\>(.+)\<\/div\>")
  33.        MsgBox vItem
  34.    Next vItem
  35.    Text1.Text = List1.List(0)
  36.    List1.Clear
  37. End Sub
  38.  
  39. Private Sub Form_Load()
  40. WebBrowser1.Navigate ("http://www.web.com/")
  41. End Sub
  42.  
35  Programación / Programación Visual Basic / Re: ayudita expresion regular en: 2 Noviembre 2010, 23:20 pm
no me funciona :(

Código
  1. Sub Extraer_Url(url_Path As String, Expresion As String)
  2.    'Variables para usar RegExp
  3.    Dim o_RegExp As RegExp
  4.    Dim o_Match As Match
  5.    Dim o_Matches As MatchCollection
  6.   'Variables Fso para abrir y leer el archivo en la variable contenido
  7.   Dim Contenido As String
  8.   'Lee el contenido del fichero y lo almacena en la var
  9.   Contenido = Text2.Text
  10.   'crea nuevo objeto RegExp
  11.   Set o_RegExp = New RegExp
  12.   ' Para que no distinga mayúsculas de minúsculas
  13.   o_RegExp.IgnoreCase = True
  14.   o_RegExp.Global = True
  15.   ' A la propiedad Pattern se le pasa la Expresión regular
  16.   o_RegExp.Pattern = Expresion
  17.   'Ejecuta y busca
  18.   Set o_Matches = o_RegExp.Execute(Contenido)
  19.   ' Recorre en la colección
  20.   For Each o_Match In o_Matches
  21.      'Agrega las url al control List
  22.      List1.AddItem Replace(o_Match.Value, Chr(34), vbNullString)
  23.   Next
  24.  
  25. End Sub
  26.  
  27. Private Sub Command1_Click()
  28.    Text2.Text = WebBrowser1.Document.documentElement.innerHTML
  29.    Dim Expresion As String
  30.    ' Expresión regular
  31.    Expresion = "\<div align\=\""justify""\\>(.+)\<\/div\>"
  32.        Call Extraer_Url(Text2.Text, Expresion)
  33.    Text1.Text = List1.List(0)
  34.    List1.Clear
  35. End Sub
  36.  
  37. Private Sub Form_Load()
  38. WebBrowser1.Navigate ("http://www.web.com")
  39. End Sub
  40.  
36  Programación / Programación Visual Basic / Re: ayudita expresion regular en: 2 Noviembre 2010, 20:38 pm
estuve leyendome unos tutoriales e hice esta expresión regular,pero no me funciona:

Código:
\<DIV align\=\""justify""\\>(.+)\<\/DIV\>

lo que quiero es que me saque el texto que hay entre <div align="justify"> TEXTO A SACAR </div>,pero no me funciona,cual es el problema? gracias!
37  Programación / Programación Visual Basic / Re: ayudita expresion regular en: 31 Octubre 2010, 12:45 pm
alguien me puede pasar algún tutorial para aprender Regexp?? ya que he estado mirando y no he encontrado ninguno para VB6. Gracias!
38  Programación / Programación Visual Basic / Re: ayudita expresion regular en: 30 Octubre 2010, 17:31 pm
viher fijate las variables o_Match, o_Matches, y o_RegExp .... cambiales el nombre :¬¬

en este pequeño tipo de cosas las deberias hacer por ti mismo

Aunque el fallo fue mio, deberias darte cuenta

gracias raul338,ya lo conseguí  ;-)
39  Programación / Programación Visual Basic / Re: ayudita expresion regular en: 30 Octubre 2010, 17:13 pm
Hay algo mal, por ahi no es la expresion regular que necesitas

EDIT:

Código
  1.   For Each o_Match In o_Matches
  2.      'Agrega las url al control List
  3.      List1.AddItem Replace(o_Match.Value, Chr(34), vbNullString)
  4.   Next
  5.  

Deberías cambiarlo por esto

Código
  1.   For Each o_Match In o_Matches
  2.      'Agrega las url al control List
  3.      List1.AddItem Replace(oMatch.SubMatches(0), Chr(34), vbNullString)
  4.   Next
  5.  

Porque es como te dije, debes obtener los submatches, no los matches en si

Variable no definida  :-\
40  Programación / Programación Visual Basic / Re: ayudita expresion regular en: 30 Octubre 2010, 17:01 pm
vale,solo una cosilla mas,lo que me devuelve tu code es "vivan las ranas",pero yo quiero que me devuelva lo que hay escrito en el Text1.Text y hago lo siguiente:

Código
  1. Dim S                       As String
  2.    S = Text1.Text
  3.  
  4.    MsgBox Get_Text(S)

pero me da error,porque? gracias!
Páginas: 1 2 3 [4] 5 6 7 8 9 10 11 12
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines