Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. Depriciated Function in PHP 5.3 - ereg & eregi

Depriciated Function in PHP 5.3 - ereg & eregi

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
phphtmldatabasehelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sangeeta2009
    wrote on last edited by
    #1

    Friends , I have a code which uses Depreciated functions: I have Marked that code BOLD, please help me if you could provide alternative statements to them ... like through PREG.. Please Help.. :sigh: if (ereg("HTTP/[0-9.]+ (([0-9])[0-9]{2})", $answer, $regs)) { $httpcode = $regs[2]; full_httpcode = $regs[1]; if ($httpcode <> 2 && $httpcode <> 3) { $status['state'] = "Unreachable: http $full_httpcode"; $linkstate = "Unreachable"; } } if (ereg("Location: *([^\n\r ]+)", $answer, $regs) && $httpcode == 3 && $full_httpcode != 302) { $status['path'] = $regs[1]; $status['state'] = "Relocation: http $full_httpcode"; fclose($fp); return $status; } if (eregi("Last-Modified: *([a-z0-9,: ]+)", $answer, $regs)) { $status['date'] = $regs[1]; } if (eregi("Content-Type:", $answer)) { $content = $answer; $answer = ''; break; } if (eregi("Content-Type: *([a-z/.-]*)", $content, $regs)) { if ($regs[1] == 'text/html' || $regs[1] == 'text/' || $regs[1] == 'text/plain') { $status['content'] = 'text'; $status['state'] = 'ok'; } else if ($regs[1] == 'application/pdf' && $index_pdf == 1) { $status['content'] = 'pdf'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/msword' || $regs[1] == 'application/vnd.ms-word') && $index_doc == 1) { $status['content'] = 'doc'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/excel' || $regs[1] == 'application/vnd.ms-excel') && $index_xls == 1) { $status['content'] = 'xls'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/mspowerpoint' || $regs[1] == 'application/vnd.ms-powerpoint') && $index_ppt == 1) { $status['content'] = 'ppt'; $status['state'] = 'ok'; } else { $status['state'] = "Not text or html"; } Please HELP me soon ..please REPLY!!! :((

    L C 2 Replies Last reply
    0
    • S sangeeta2009

      Friends , I have a code which uses Depreciated functions: I have Marked that code BOLD, please help me if you could provide alternative statements to them ... like through PREG.. Please Help.. :sigh: if (ereg("HTTP/[0-9.]+ (([0-9])[0-9]{2})", $answer, $regs)) { $httpcode = $regs[2]; full_httpcode = $regs[1]; if ($httpcode <> 2 && $httpcode <> 3) { $status['state'] = "Unreachable: http $full_httpcode"; $linkstate = "Unreachable"; } } if (ereg("Location: *([^\n\r ]+)", $answer, $regs) && $httpcode == 3 && $full_httpcode != 302) { $status['path'] = $regs[1]; $status['state'] = "Relocation: http $full_httpcode"; fclose($fp); return $status; } if (eregi("Last-Modified: *([a-z0-9,: ]+)", $answer, $regs)) { $status['date'] = $regs[1]; } if (eregi("Content-Type:", $answer)) { $content = $answer; $answer = ''; break; } if (eregi("Content-Type: *([a-z/.-]*)", $content, $regs)) { if ($regs[1] == 'text/html' || $regs[1] == 'text/' || $regs[1] == 'text/plain') { $status['content'] = 'text'; $status['state'] = 'ok'; } else if ($regs[1] == 'application/pdf' && $index_pdf == 1) { $status['content'] = 'pdf'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/msword' || $regs[1] == 'application/vnd.ms-word') && $index_doc == 1) { $status['content'] = 'doc'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/excel' || $regs[1] == 'application/vnd.ms-excel') && $index_xls == 1) { $status['content'] = 'xls'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/mspowerpoint' || $regs[1] == 'application/vnd.ms-powerpoint') && $index_ppt == 1) { $status['content'] = 'ppt'; $status['state'] = 'ok'; } else { $status['state'] = "Not text or html"; } Please HELP me soon ..please REPLY!!! :((

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      is Google not working where you are? it gave me many links including this one[^]. :|

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


      Prolific encyclopedia fixture proof-reader browser patron addict?
      We all depend on the beast below.


      S 1 Reply Last reply
      0
      • L Luc Pattyn

        is Google not working where you are? it gave me many links including this one[^]. :|

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        Prolific encyclopedia fixture proof-reader browser patron addict?
        We all depend on the beast below.


        S Offline
        S Offline
        sangeeta2009
        wrote on last edited by
        #3

        Well friend i am googling from 5 days. And i have found many links and studied them too. and these BOLD queries that i have mentioned are not being able to be resolved by me.. Actually i have to look for alternative for these expression!!! Hope u can help....with some solution or with a link which could guide me how to resolve them!! Its a new change by PHP and I can't catch it so soon.. So please help me Or you can do another thing... I am using XAMPP with php 5.3 is there any way to stop displaying those deprecated errors

        L 1 Reply Last reply
        0
        • S sangeeta2009

          Well friend i am googling from 5 days. And i have found many links and studied them too. and these BOLD queries that i have mentioned are not being able to be resolved by me.. Actually i have to look for alternative for these expression!!! Hope u can help....with some solution or with a link which could guide me how to resolve them!! Its a new change by PHP and I can't catch it so soon.. So please help me Or you can do another thing... I am using XAMPP with php 5.3 is there any way to stop displaying those deprecated errors

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          I use XAMPP myself, however I don't want to hide error or warning messsages, I work on my code to avoid them in the first place. From the link I provided it seems the new ereg and the old preg stuff is very similar; so I suggest you study where they differ and fix things in your code. Start with the very first occurence and fix that. From then on, it should be easy. :)

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


          Prolific encyclopedia fixture proof-reader browser patron addict?
          We all depend on the beast below.


          1 Reply Last reply
          0
          • S sangeeta2009

            Friends , I have a code which uses Depreciated functions: I have Marked that code BOLD, please help me if you could provide alternative statements to them ... like through PREG.. Please Help.. :sigh: if (ereg("HTTP/[0-9.]+ (([0-9])[0-9]{2})", $answer, $regs)) { $httpcode = $regs[2]; full_httpcode = $regs[1]; if ($httpcode <> 2 && $httpcode <> 3) { $status['state'] = "Unreachable: http $full_httpcode"; $linkstate = "Unreachable"; } } if (ereg("Location: *([^\n\r ]+)", $answer, $regs) && $httpcode == 3 && $full_httpcode != 302) { $status['path'] = $regs[1]; $status['state'] = "Relocation: http $full_httpcode"; fclose($fp); return $status; } if (eregi("Last-Modified: *([a-z0-9,: ]+)", $answer, $regs)) { $status['date'] = $regs[1]; } if (eregi("Content-Type:", $answer)) { $content = $answer; $answer = ''; break; } if (eregi("Content-Type: *([a-z/.-]*)", $content, $regs)) { if ($regs[1] == 'text/html' || $regs[1] == 'text/' || $regs[1] == 'text/plain') { $status['content'] = 'text'; $status['state'] = 'ok'; } else if ($regs[1] == 'application/pdf' && $index_pdf == 1) { $status['content'] = 'pdf'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/msword' || $regs[1] == 'application/vnd.ms-word') && $index_doc == 1) { $status['content'] = 'doc'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/excel' || $regs[1] == 'application/vnd.ms-excel') && $index_xls == 1) { $status['content'] = 'xls'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/mspowerpoint' || $regs[1] == 'application/vnd.ms-powerpoint') && $index_ppt == 1) { $status['content'] = 'ppt'; $status['state'] = 'ok'; } else { $status['state'] = "Not text or html"; } Please HELP me soon ..please REPLY!!! :((

            C Offline
            C Offline
            cristminix
            wrote on last edited by
            #5

            USE : PERL REGEX , preg_replace,preg_match; HONEY

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups