Foros del Web » Programando para Internet » PHP »

PHP OO ereg_replace Deprecated: Function

Estas en el tema de ereg_replace Deprecated: Function en el foro de PHP en Foros del Web. hola amigos como estan saludos tengo esta linea que es de calendario el error es de ereg_replace dice Deprecated: Function, por que ocupo 5.3 que ...
  #1 (permalink)  
Antiguo 27/12/2011, 16:58
Avatar de jose mario  
Fecha de Ingreso: abril-2007
Mensajes: 165
Antigüedad: 17 años
Puntos: 0
Pregunta ereg_replace Deprecated: Function

hola amigos como estan saludos tengo esta linea que es de calendario
el error es de ereg_replace dice Deprecated: Function, por que ocupo 5.3 que es mas estable.
---------------------
$QUERY_STRING = ereg_replace("&date=".$month."-".$year,"",$_SERVER['QUERY_STRING']);
----------------------

como puedo hacer para poder cambiarla que palabra utilizo o remplazo.

muchas gracias de ante por su ayuda...
  #2 (permalink)  
Antiguo 27/12/2011, 17:00
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: ereg_replace Deprecated: Function

Consulta el manual de php, ahí se indican los cambios.
http://www.php.net/manual/en/referen...tern.posix.php
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #3 (permalink)  
Antiguo 27/12/2011, 17:09
Avatar de jose mario  
Fecha de Ingreso: abril-2007
Mensajes: 165
Antigüedad: 17 años
Puntos: 0
Respuesta: ereg_replace Deprecated: Function

segun lo que me mandas seria preg_replace pero sale esto.

Warning: preg_replace() [function.preg-replace]: No ending delimiter '&' found in
  #4 (permalink)  
Antiguo 27/12/2011, 17:11
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: ereg_replace Deprecated: Function

Cita:
Iniciado por jose mario Ver Mensaje
segun lo que me mandas seria preg_replace pero sale esto.

Warning: preg_replace() [function.preg-replace]: No ending delimiter '&' found in
A ver, según el manual no sólo hay que cambiar la función.

Hay cambios significativos en cuanto a la misma expresión también, por favor lee con atención.
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #5 (permalink)  
Antiguo 27/12/2011, 17:18
Avatar de jose mario  
Fecha de Ingreso: abril-2007
Mensajes: 165
Antigüedad: 17 años
Puntos: 0
Respuesta: ereg_replace Deprecated: Function

hice el cambio quedara asi:
preg_replace("date=".$month."-".$year,"",$_SERVER['QUERY_STRING']);


sale hoy:
Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash
  #6 (permalink)  
Antiguo 27/12/2011, 17:21
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: ereg_replace Deprecated: Function

¿De verdad estás leyendo con atención?

Las expresiones PCRE requieren delimitadores válidos, pero veo que no los indicas.
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #7 (permalink)  
Antiguo 27/12/2011, 17:26
Avatar de jose mario  
Fecha de Ingreso: abril-2007
Mensajes: 165
Antigüedad: 17 años
Puntos: 0
Respuesta: ereg_replace Deprecated: Function

Cita:
Iniciado por pateketrueke Ver Mensaje
¿De verdad estás leyendo con atención?

Las expresiones PCRE requieren delimitadores válidos, pero veo que no los indicas.
eso es lo que no entiendo delimitadores.
  #8 (permalink)  
Antiguo 27/12/2011, 17:44
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: ereg_replace Deprecated: Function

Cita:
Iniciado por jose mario Ver Mensaje
eso es lo que no entiendo delimitadores.
Justo en el enlace que te pase:
Cita:
1. The PCRE functions require that the pattern is enclosed by delimiters.
Y aquí la versión en español.
http://www.php.net/manual/es/regexp....delimiters.php

Recuerda que puedes cambiar el idioma del manual con solo modificar /en/ a /es/
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #9 (permalink)  
Antiguo 29/12/2011, 22:43
Avatar de jose mario  
Fecha de Ingreso: abril-2007
Mensajes: 165
Antigüedad: 17 años
Puntos: 0
Respuesta: ereg_replace Deprecated: Function

$QUERY_STRING = ereg_replace("&date=".$month."-".$year,"",$_SERVER['QUERY_STRING']);
sabe esta linea me da error como deberia quedar?
erro dice:
Warning: preg_replace() [function.preg-replace]: No ending delimiter '&' found in
se que se cambia por preg_replac pero no se de delimitadores me ayudan gracias de ante mano.
  #10 (permalink)  
Antiguo 29/12/2011, 22:46
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: ereg_replace Deprecated: Function

¿Ya leíste lo que dice el enlace del manual?
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #11 (permalink)  
Antiguo 29/12/2011, 22:49
Avatar de jose mario  
Fecha de Ingreso: abril-2007
Mensajes: 165
Antigüedad: 17 años
Puntos: 0
Respuesta: ereg_replace Deprecated: Function

Cita:
Iniciado por pateketrueke Ver Mensaje
¿Ya leíste lo que dice el enlace del manual?
si pero no entiendo me ayudas
  #12 (permalink)  
Antiguo 30/12/2011, 00:20
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: ereg_replace Deprecated: Function

Claro que te ayudo.

¿Que parte no entiendes?
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #13 (permalink)  
Antiguo 30/12/2011, 00:35
Avatar de jose mario  
Fecha de Ingreso: abril-2007
Mensajes: 165
Antigüedad: 17 años
Puntos: 0
Respuesta: ereg_replace Deprecated: Function

como quedaria la linea no tengo ni idea.
  #14 (permalink)  
Antiguo 30/12/2011, 00:39
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: ereg_replace Deprecated: Function

A ver, ¿quieres aprender a hacerlo o que alguien te haga el trabajo?

Es una simple linea caray, ¿exactamente que no entiendes de los delimitadores?

No seas vago, se nota que de plano no te interesa el tema, y así como que no dan ganas de asistir.
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #15 (permalink)  
Antiguo 30/12/2011, 00:44
Avatar de jose mario  
Fecha de Ingreso: abril-2007
Mensajes: 165
Antigüedad: 17 años
Puntos: 0
Pregunta Respuesta: ereg_replace Deprecated: Function

Cita:
Iniciado por pateketrueke Ver Mensaje
A ver, ¿quieres aprender a hacerlo o que alguien te haga el trabajo?

Es una simple linea caray, ¿exactamente que no entiendes de los delimitadores?

No seas vago, se nota que de plano no te interesa el tema, y así como que no dan ganas de asistir.
no me tomes como aprobechado pero es que lo lei y aun me sale error ya le di mil vueltas sale lo mismo ayudame a saber que debo hacer? la coas es que si no me tocara cambiar todo el modulo donde esta esta linea.
  #16 (permalink)  
Antiguo 30/12/2011, 00:47
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: ereg_replace Deprecated: Function

Es mejor que no le sigas dando vueltas, mejor muestra como lo has estado haciendo, de todas las formas que lo has intentado.

Así te podemos ayudar, por favor.
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #17 (permalink)  
Antiguo 30/12/2011, 00:53
Avatar de jose mario  
Fecha de Ingreso: abril-2007
Mensajes: 165
Antigüedad: 17 años
Puntos: 0
Respuesta: ereg_replace Deprecated: Function

Código PHP:
<?php



    
/////////////////////////////////////////////
    //Filter the current $_GET['date'] from the QUERY_STRING
    //
    
$QUERY_STRING preg_replace("&date=".$month."-".$year,"",$_SERVER['QUERY_STRING']);
    
//
    /////////////////////////////////////////////
en esta linea del script es donde esta el problema, segun lo que me mandaste preg_replace lo cambie por el equivalente segun el link (ereg_replace) que me mandaste lee sobre lo delimitadores y aun asi da error
  #18 (permalink)  
Antiguo 30/12/2011, 00:55
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: ereg_replace Deprecated: Function

¿Cual equivalente?

¿Puedes mostrar lo que tenías antes?

Espero que no hayas cambiado sólo el nombre de la función, porque no es lo único que necesitas.
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #19 (permalink)  
Antiguo 30/12/2011, 01:03
Avatar de jose mario  
Fecha de Ingreso: abril-2007
Mensajes: 165
Antigüedad: 17 años
Puntos: 0
Pregunta Respuesta: ereg_replace Deprecated: Function

Código PHP:
<?php



    $calendar_script          
"calendario_mp.php"//The location of this script
    
$calendar_language        "es";       //The extension of the calendar language file.

    
$content_background_color "#EEEEEE";   //Background color of the column
    
$content_font_color       "#000000";   //The font color
    
$content_font_size        11;          //Font-size in pixels
    
$content_font_style       "normal";    //Set to italic or normal
    
$content_font_weight      "normal";    //Set to bold or normal

    
$today_background_color   "white";   //Background color of the column
    
$today_font_color         "green";   //The font color
    
$today_font_size          11;          //Font-size in pixels
    
$today_font_style         "normal";    //Set to italic or normal
    
$today_font_weight        "bold";      //Set to bold or normal

    
$event_background_color   "#DDDDDD";   //Background color of the column
    
$event_background_color2  "#EEEEEE";   //Background color of the 2nd column (event popup)
    
$event_font_color         "#000000";   //The font color
    
$event_font_size          11;          //Font-size in pixels
    
$event_font_style         "normal";    //Set to italic or normal
    
$event_font_weight        "bold";      //Set to bold or normal
    
$event_popup_width        "450";       //Width  of the popup for the events
    
$event_popup_height       "350";       //Height of the popup for the events
    
    
$head_background_color    "#DDDDDD";   //Background color of the column
    
$head_font_color          "green";   //The font color
    
$head_font_size           11;          //Font-size in pixels
    
$head_font_style          "normal";    //Set to italic or normal
    
$head_font_weight         "bold";      //Set to bold or normal
    
    //darussol: CSS OPTIONS FOR WEEK DAYS
    
$days_head_background_color "#DDDDDD";   //Background color of the column
    
$days_head_font_color       "gray";   //The font color
    
$days_head_font_size        11;          //Font-size in pixels
    
$days_head_font_style       "normal";    //Set to italic or normal
    
$days_head_font_weight      "bold";      //Set to bold or normal
    
    
$table_border             0;           //The border of the table
    
$table_cellspacing        2;           //Cellspacing of the table
    
$table_cellpadding        2;           //Cellpadding of the table
    
$table_width              '';          //Table width in pixels or %'s
    
$table_height             '';          //Table height in pixels or %'s
    
    
$head_link_color          "green";    //The color of the link for previous/next month
    
    
$font_family "Verdana";
    
    
/* 17 June 2004 : Check readme.txt for MySQL code for the database table */

  
$events_from_database    true;        //Set to true if you want to retrieve events
    
$database                "makepixel_rotari";  //Name of the database within the event_table
  
$server                   "xxxxx"//Name of the server
  
$username                 "xxxxxx";  //MySQL username
  
$password                 "xxxxxx";  //MySQL password
  
$event_table              "mp_calendario"//Name of the calendar_events
    //
    /////////////////////////////////////////////
    
    /////////////////////////////////////////////
    //Load the language into usable variables
    //

    //darussol: TRANSLATION (18 May 2004)
    //        : Fill in the names of the days/months in variables
    //e-man   : LOAD TRANSLATION FILE INTO VARIABLES (from darussol)(19 May 2004)
    //        : Put the days/months names from language file into a array    

    
$language_file  "calendar." $calendar_language;        //Language file into variable
    
$fd             fopen$language_file"r" );             //Open the language file
    
$fd             fread$fdfilesize$language_file ) ); //Read the opened file
    
$language_array explode"\n" $fd );                    //Put file info into array 

    
$dayname   array_slice($language_array,0,7); //The names of the days

    
$monthname array_slice($language_array,7);   //The rest of the language file are the monthnames
    //
    /////////////////////////////////////////////


    /////////////////////////////////////////////
    //Use the date to build up the calendar. From the Query_string or the current date
    //    
    
if( isset( $_GET['date'] ) )
        list(
$month,$year) = explode("-",$_GET['date']);
    else
    {
        
$month date("m");
        
$year  date("Y");
    }
    
//
    /////////////////////////////////////////////
//echo $month."-".$year."-";
    
$date_string mktime(0,0,0,$month,1,$year); //The date string we need for some info... saves space ^_^
    
//echo $date_string;

    
$day_start date("w",$date_string);  //The number of the 1st day of the week

    /////////////////////////////////////////////
    //Filter the current $_GET['date'] from the QUERY_STRING
    //esta es la linea error
    
$QUERY_STRING preg_replace("&date=".$month."-".$year,"",$_SERVER['QUERY_STRING']);
    
//
    /////////////////////////////////////////////
    

    /////////////////////////////////////////////
    
5.3 no adminte ese comando
Este es parte de script, uso php 5
  #20 (permalink)  
Antiguo 30/12/2011, 01:04
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: ereg_replace Deprecated: Function

No amigo, no todo el script.

Solo la linea con la que tienes problema, muestrala antes de leer el enlace que te di y después.
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #21 (permalink)  
Antiguo 30/12/2011, 01:08
Avatar de jose mario  
Fecha de Ingreso: abril-2007
Mensajes: 165
Antigüedad: 17 años
Puntos: 0
Respuesta: ereg_replace Deprecated: Function

http://www.php.net/manual/en/referen...tern.posix.php
Este fue en enlace que me diste.
*********************
/echo $month."-".$year."-";
$date_string = mktime(0,0,0,$month,1,$year); //The date string we need for some info... saves space ^_^

//echo $date_string;

$day_start = date("w",$date_string); //The number of the 1st day of the week

/////////////////////////////////////////////
//Filter the current $_GET['date'] from the QUERY_STRING
//esta es la linea error
$QUERY_STRING = preg_replace("&date=".$month."-".$year,"",$_SERVER['QUERY_STRING']);
//
/////////////////////////////////////////////

**********************
luego me dijiste que leyera sobre delimitadores en este link
http://www.php.net/manual/es/regexp....delimiters.php
  #22 (permalink)  
Antiguo 30/12/2011, 01:09
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: ereg_replace Deprecated: Function

¿Y donde están los delimitadores de la expresión?
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #23 (permalink)  
Antiguo 30/12/2011, 01:14
Avatar de jose mario  
Fecha de Ingreso: abril-2007
Mensajes: 165
Antigüedad: 17 años
Puntos: 0
Respuesta: ereg_replace Deprecated: Function

Cita:
Iniciado por pateketrueke Ver Mensaje
¿Y donde están los delimitadores de la expresión?
eso es lo que no entiendo si quiere te mando el script a tu correo?
  #24 (permalink)  
Antiguo 30/12/2011, 01:16
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: ereg_replace Deprecated: Function

No no, yo no voy a hacer tu trabajo.

Se nota a leguas que no has leído los enlaces que te mando, son bastante claros con respecto a los delimitadores.

Incluso hay bastantes ejemplos, si no quieres resolver tus problemas allá tu.

Lee esto también:
http://www.forosdelweb.com/f18/aport...s-pcre-646110/
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #25 (permalink)  
Antiguo 30/12/2011, 01:31
Avatar de jose mario  
Fecha de Ingreso: abril-2007
Mensajes: 165
Antigüedad: 17 años
Puntos: 0
Respuesta: ereg_replace Deprecated: Function

lee lo que me enviste segun eso la linea quedar asi:
$QUERY_STRING = preg_replace("&date=$month-$year,"","$_SERVER['QUERY_STRING']");
***
preg_replace(patron, reemplazo, contexto)
***
pero un me da error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/www
  #26 (permalink)  
Antiguo 30/12/2011, 01:34
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: ereg_replace Deprecated: Function

Por favor presta atención a las diferencias.
Código PHP:
$QUERY_STRING preg_replace("/&date=$month-$year/"""$_SERVER['QUERY_STRING']); 
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:05.