errors since i removed register_globals_on

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    errors since i removed register_globals_on

    i have this error in class.upload.php

    Deprecated: Function ereg() is deprecated in /home/sexywap/public_html/web/class.upload.php on line 1690

    Deprecated: Function ereg_replace() is deprecated in /home/sexywap/public_html/web/class.upload.php on line 1856

    Code:
    if ($this->uploaded) {
                    $this->log .= '- ' . _("file name OK") . '<br />';
    1690  >>>>>>>              ereg('\.([^\.]*$)', $this->file_src_name, $extension);    <<<<<<<<
                    if (is_array($extension)) {
                        $this->file_src_name_ext      = strtolower($extension[1]);
                        $this->file_src_name_body     = substr($this->file_src_name, 0, ((strlen($this->file_src_name) - strlen($this->file_src_name_ext)))-1);
    and
    Code:
    if ($this->file_safe_name) { // formats the name
                    $this->file_dst_name_body = str_replace(array(' ', '-'), array('_','_'), $this->file_dst_name_body) ;
     1856 >>>>>>               $this->file_dst_name_body = ereg_replace('[^A-Za-z0-9_]', '', $this->file_dst_name_body) ;
                    $this->log .= '- ' . _("file name safe format") . '<br />';
    never come across an error like that before .
    Wapchat4u


    Topsites4u

    #2
    depricated means it is no longer in use, generally functions become depricated 1 or 2 main releases of PHP before they are removed. Shows how old your yourscript is lol. ereg and eregi have been replaced with preg_match for a while

    ereg('\.([^\.]*$)', $this->file_src_name, $extension);

    becomes

    preg_match('/\.([^\.]*$)/', $this->file_src_name, $extension);

    note however the array returned by the function may be different so print_r the extensions array when u first use it and check that [1] is still the file extension string (it should be but u never know)

    you could however use a more basic code for file extension from a filename such as

    $ext = substr(strrpos($filename,".")+1)

    which is just as good and takes less resources. I wouldnt rely on file extensions though, for added security its always better to use mimetypes with a whitelist as mimetypes are more accurate.

    for your second code you could use a preg_replace (google it)

    Comment


      #3
      lol yeah it is kinda old script cheers anyway but i just downloaded a newer version of it to save me messing around .and its fine now .
      Wapchat4u


      Topsites4u

      Comment


        #4
        yup server is runing under 5.3.1 not 5.2.. any more since last weekend when it was down for a lil wile.

        look at this ...

        PHP: Deprecated features in PHP 5.3.x - Manual
        Want something coded email me at sales@webnwaphost.com for a prices.




        Comment


          #5
          na so far so good .
          Wapchat4u


          Topsites4u

          Comment

          Working...
          X