Help Deprecated : Function eregi() in upload

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

    Help Deprecated : Function eregi() in upload

    Anyone cn help me in my problem...My uploader can upload Successfully but with

    Deprecated : Function eregi() is deprecated in / home/dreamwap/ public_html/wap/files/upload.php on line 104

    Added after 2 minutes:

    Here s the code of upload.php:

    PHP Code:
    <?php
    include("../inc/func.inc.php");
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-cache, must-revalidate");
    header("Pragma: no-cache");
    echo 
    "<?xml version=\"1.0\"?>\n";
    echo 
    "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">\n";
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <?php
      
    if(!db()){
      echo 
    "<head>";
      echo 
    "<title>DreamWAP Uploader</title>";
      include(
    "../inc/css.inc.php");
      echo 
    "</head>";
      echo 
    "<body>";
      echo 
    getdberror();
      echo 
    "</body>";
      echo 
    "</html>";
      exit();
      }

      
    $show $_GET["show"];
      
    $hits $_GET["hits"];
      
    $page $_GET["page"];
      
    $who $_GET["who"];
      
    $uid getuid_hits($hits);
      
    $uip getip();
      
    $ubr $_SERVER['HTTP_USER_AGENT'];
      
    cleardata();
      
    addvisitor();

      if(
    isipbanned($uip,$ubr)){
      if(!
    isshield(getuid_hits($hits))){
      echo 
    "<head>";
      echo 
    "<title>DreamWAP Uploader</title>";
      include(
    "../inc/css.inc.php");
      echo 
    "</head>";
      echo 
    "<body>";
      echo 
    getipbanned($uip$ubr);
      echo 
    "</body>";
      echo 
    "</html>";
      exit();
      }
      }

      if((
    $show != "") && ($show != "terms")){
      
    $uid getuid_hits($hits);
      if((
    islogged($hits)==false)||($uid==0)){
      echo 
    "<head>";
      echo 
    "<title>DreamWAP Uploader</title>";
      include(
    "../inc/css.inc.php");
      echo 
    "</head>";
      echo 
    "<body>";
      echo 
    getsesexplog();
      echo 
    "</body>";
      echo 
    "</html>";
      exit();
      }
      }

      if((
    isbanned($uid))&&($uid != '0')){
      echo 
    "<head>";
      echo 
    "<title>DreamWAP Uploader</title>";
      include(
    "../inc/css.inc.php");
      echo 
    "</head>";
      echo 
    "<body>";
      echo 
    getbanned($uid);
      echo 
    "</body>";
      echo 
    "</html>";
      exit();
      }
    $tid $_GET["tid"];
    $post $_GET["post"];
    $plusses $_POST["plusses"];
    $info $_POST["info"];


            if(
    $show=="")
            {

      
    addonline(getuid_hits($hits),"Upload Files","");

                  echo 
    "<head>";
      echo 
    "<title>DreamWAP Uploader</title>";
      include(
    "../inc/css.inc.php");
     echo 
    "</head>";
     echo 
    "<body>";
     echo 
    "<div class=\"box_cen\" align=\"center\">";
    echo 
    "<b>Download Uploader</b></div>";
     echo 
    "<div class=\"box_sub\" align=\"center\">";

     echo 
    "Max File Size Limit To Upload Is 5MB!</div>";
     echo 
    "<div class=\"box_cen\" align=\"center\">";
     echo 
    "<div class=\"box_sub\" align=\"center\">";
     
    $superdat $_FILES['superdat']['tmp_name'];
     
    $superdat_name $_FILES['superdat']['name'];
     
    $superdat_size $_FILES['superdat']['size'];


    if (
    $upload="upload"&&$superdat_name){

    if (!
    eregi("\.(gif|jar|jad|jpeg|jpg|sis|sisx|png|zip|rar|thm|mp3|wav|amr|3gp|mp4|avi|mid|midi)$",$superdat_name)){
     print 
    "<b>Unsupported File Extention!</b>";
    }else{

      
    $superdat_name preg_replace('/[^a-zA-Z0-9\.\$\%\'\`\-\@\{\}\~\!\#\(\)\&\_\^]/','',str_replace(array(' ','%20','.php'),array('_','_',''),$superdat_name));

     if(
    strlen($superdat_name)>53){ print "<b>File Name Is Too Long!</b>";
    }else{
    $superdatt round($superdat_size/1024,1);
    if (
    round($superdatt)>504 {
    print 
    "<b>File Over Upload Limit!!!</b>";
    }else{
    if (empty(
    $superdat)) {
    print 
    "<b>No File Selected!!!</b>";
    }else{

    $ext getext($superdat_name);
     
    if(
    file_exists("$ext/$superdat_name"))
             {
             echo 
    "File With That Name Already Exists";
             }else{
     
    $ext getext($superdat_name);
    copy("$superdat""$ext/$superdat_name") or
    die(
    "Couldn't copy file.");

    $ext getext($superdat_name);

          if(
    $ext=="mp3" or $ext=="wav" or $ext=="amr" or $ext=="Mp3" or $ext=="Wav" or $ext=="Amr" or $ext=="MP3" or $ext=="WAV" or $ext=="AMR" or $ext=="midi" or $ext=="mid" or $ext=="Mid" or $ext=="Midi") {
          
    $type 0;
          }

          if (
    $ext=="avi" or $ext=="3gp" or $ext=="mp4" or $ext=="Avi" or $ext=="3GP" or $ext=="Mp4" or $ext=="AVI" or $ext=="3Gp" or $ext=="MP4") {
          
    $type 1;
          }

          if (
    $ext=="jpg" or $ext=="gif" or $ext=="png" or $ext=="jpeg" or $ext=="bmp" or $ext=="Jpg" or $ext=="Gif" or $ext=="Png" or $ext=="Jpeg" or $ext=="Bmp" or $ext=="JPG" or $ext=="GIF" or $ext=="PNG" or $ext=="JPEG" or $ext=="BMP") {
          
    $type 2;
          }

          if (
    $ext=="zip" or $ext=="rar" or $ext=="Zip" or $ext=="Rar" or $ext=="ZIP" or $ext=="RAR")
       {
          
    $type 3;
          }

          if (
    $ext=="jar" or $ext=="jad" or $ext=="Jar" or $ext=="Jad" or $ext=="JAR" or $ext=="JAD") {
          
    $type 4;
          }

          if (
    $ext=="sisx" or $ext=="sis" or $ext=="Sisx" or $ext=="Sis" or $ext=="SISX" or $ext=="SIS")
       {
          
    $type 5;
          }

          if (
    $ext=="thm" or $ext=="nth" or $ext=="Thm" or $ext=="Nth" or $ext=="THM" or $ext=="NTH")
       {
          
    $type 6;
          }

     
    $datetime();

     
    $super round($superdat_size/1024,1);
     
    $fsize round($super);

     
    $text "&&$superdat_name&&$fsize KB&&$date&&$REMOTE_ADDR&&";
     if(
    "$text"!="$check[1]"){
     
    $mysql=mysql_query("INSERT INTO mx_uploads SET id='', uid='".$uid."', filename='".$superdat_name."', filesize='".$fsize." KB', date='".$date."', uip='".getip()."', browser='".$_SERVER["HTTP_USER_AGENT"]."', type='".$type."', plusses='".$plusses."', info='".$info."'");
    echo 
    mysql_error();
     }
            
    $plusses mysql_fetch_array(mysql_query("SELECT upload FROM mx_users WHERE id='".$uid."'"));
            
    $ups $plusses[0]+1;
            
    mysql_query("UPDATE mx_users SET upload='".$ups."' WHERE id='".$uid."'");
    echo 
    "<b>$superdat_name</b><br/>Has Successfully Been Uploaded!";
    }
    }
    }
    }
    }
    }

    ?>
    <?php
     
    echo "<FORM align=\"center\" ACTION=\"upload.php?hits=$hits\" METHOD=\"POST\" ENCTYPE=\"multipart/form-data\">";
     echo 
    "<b>Select File To Upload</b><br/>";
     echo 
    "<input align=\"center\" type=\"file\" name=\"superdat\" size=\"8\"><br/>";
      echo 
    "File Info<br/><input type=\"info\" name=\"info\" size=\"18\" value=\"No Info\"><br/>";
        echo 
    "Download Cost<br/><select name=\"plusses\">
        <option value=\"0\">Free</option>
        <option value=\"10\">10 Plusses</option>
        <option value=\"30\">30 Plusses</option>
        <option value=\"50\">50 Plusses</option>
        <option value=\"100\">100 Plusses</option>
        </select><br/>"
    ;
     echo 
    "<input type=\"submit\" value=\"Upload!\"/></small></div></div>";
     echo 
    "<div class=\"box_sub\" align=\"center\">";

     echo 
    "<b><u>Excepted File Extentions:</u></b><br/>";
     echo 
    ".jpg, .jpeg, .gif, .png, .bmp, .sis<br/>.sisx, .jar, .jad, .rar, .zip, .thm,<br/>.nth, .mp3, .wav, .amr, .mid,<br/>.midi,.3gp, .avi, .mp4</div>";
    ?>
    </FORM>

    <?php
    echo "<div class=\"box_cen\" align=\"center\">";
    echo 
    "<form action=\"../index.php?hits=$hits\" method=\"get\">";
    echo 
    "<select name=\"show\">";
    echo 
    "<option value=\"forum\">Forum</option>";
    echo 
    "<option value=\"book\">Bookmark</option>";
    echo 
    "<option value=\"cpanel\">Cpanel</option>";
    echo 
    "<option value=\"stats\">Stats</option>";
    echo 
    "<option value=\"info\">FaQ/Info</option>";
    echo 
    "<option value=\"chat\">ChitChat</option>";
    echo 
    "<option value=\"clmenu\">Club</option>";
    echo 
    "<option value=\"aonline\">Online (".getnumonline().")</option>";
    echo 
    "<option value=\"bank\">Bank Menu</option>";
    echo 
    "<option value=\"funm\">Fun Games</option>";
    echo 
    "<option value=\"logout\">Log Out</option>";
    echo 
    "</select>";
    echo 
    "<input type=\"hidden\" name=\"hits\" value=\"$hits\"/>";
    echo 
    "<input type=\"submit\" value=\"[GO]\"/>";
    echo 
    "</form>";
    echo 
    "</div>";
      
    $umsg getunreadpm(getuid_hits($hits));
      if(
    $umsg>0)
      {
      
    $pm "<a href=\"../inbox.php?show=openfol&amp;view=urd&amp;hits=$hits&amp;reply=1\">$umsg Inbox(s)</a>";
      }else{
      
    $pm "<a href=\"../inbox.php?show=main&amp;hits=$hits\">Inbox</a>";
      }
    echo 
    "<div class=\"footer\" align=\"center\">";
    echo 
    "<a href=\"../index.php?show=main&amp;hits=$hits\">Home</a> | $pm | <a href=\"index.php?show=term&amp;hits=$hits\">T &amp; C</a>";
    echo 
    "</div>";
    echo 
    "</body>";
     } 
    ?>
     </html>
    Last edited by kruzada; 09.01.12, 15:13.

    #2
    replace it with preg_match or downgrade your php version to 5.2.x
    Advertise your mobile site for FREE with AdTwirl

    Comment


      #3
      ahm,ok..you mean, it change (!eregi( to (preg_match("\.(gif|jar|jad|jpeg|jpg|sis|sisx|png| zip|rar|thm|mp3|wav|amr|3gp|mp4|avi|mid|midi)$",$s uperdat_name))??

      Ill try,s0rry,i am newbie in c0ding,,i d0nt kn0w how to downgrade my script..tnx for help budz..
      Last edited by kruzada; 10.01.12, 07:16.

      Comment


        #4
        same error.. Deprecated function in preg_match()... =<

        Comment


          #5
          Originally posted by kruzada View Post
          same error.. Deprecated function in preg_match()... =<
          lol, preg_match is not deprecated, You'll need a lil bit of knowledge in regex(regular expressions) to make it work..
          I need some facebook likes, can you please help me
          http://facebook.com/softwarefreakin
          I noticed social media is really powerful
          Well DONE is better than well SAID

          Comment


            #6
            hum,,cn u give a sample code using preg_match?tnx badz

            Comment


              #7
              Originally posted by kruzada View Post
              hum,,cn u give a sample code using preg_match?tnx badz
              PHP Code:
              if (!preg_match('/\.(gif|jar|jad|jpeg|jpg|sis|sisx|png|zip|rar|thm|mp3|wav|amr|3gp|mp4|avi|mid|midi)$/i',$superdat_name)) 
              Advertise your mobile site for FREE with AdTwirl

              Comment


                #8
                ahm,ok..ill try..tnx for helping me badz...

                Added after 34 minutes:

                ahm..its works fine budz..thank you ..GumSlone
                Last edited by kruzada; 10.01.12, 17:01.

                Comment


                  #9
                  preg_match is also accurate than eregi,any time You try using a function and you see deprecated,try searching on php.net for the updated version of that function :D

                  Comment


                    #10
                    ok..tnx razbee for the info..

                    Comment


                      #11
                      Pls. Help me again, to this code:

                      function OS($user_agent){
                      $exp = explode(" ", $user_agent);
                      $oses = array (
                      'Windows 3.11' => 'Win16',
                      'Windows 95' => '(Windows 95)|(Win95)|(Windows_95)',
                      'Windows 98' => '(Windows 9|(Win9',
                      'Windows 2000' => '(Windows NT 5.0)|(Windows 2000)',
                      'Windows XP' => '(Windows NT 5.1)|(Windows XP)',
                      'Windows Vista' => '(Windows NT 6.0)|(Windows Vista)',
                      'Windows 7' => '(Windows NT 6.1)|(Windows 7)',
                      'Windows 2003' => '(Windows NT 5.2)',
                      'Windows NT 4.0' => '(Windows NT 4.0)|(WinNT4.0)|(WinNT)|(Windows NT)',
                      'Windows ME' => 'Windows ME',
                      'Open BSD'=>'OpenBSD',
                      'Sun OS'=>'SunOS',
                      'Linux'=>'(Linux)|(X11)',
                      'Macintosh'=>'(Mac_PowerPC)|(Macintosh)',
                      'QNX'=>'QNX',
                      'BeOS'=>'BeOS',
                      'OS/2'=>'OS/2',
                      'Palm OS'=>'Palm OS',
                      'Search Bot'=>'(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Sl urp/cat)|(msnbot)|(ia_archiver)',
                      'J2ME-Opera Mini'=>'Opera Mini',
                      'SonyE'=>'J2ME-MIDP',
                      'Symbian OS'=>'Symbian OS',
                      'SymbianOS 6.1'=>'SymbianOS/6.1',
                      'SymbianOS 7.0'=>'SymbianOS/7.0',
                      'SymbianOS 8.0'=>'SymbianOS/8.0',
                      'SymbianOS 9.1'=>'SymbianOS/9.1',
                      'SymbianOS 9.2'=>'SymbianOS/9.2',
                      'SymbianOS 9.4'=>'SymbianOS/9.4',
                      'Mac OS (iPhone)'=>'iPhone',
                      'Windows CE' => 'Windows CE'
                      );

                      foreach($oses as $os=>$pattern){
                      if (eregi($pattern, $user_agent))
                      return $os;
                      }
                      return 'Unknown';
                      }

                      Itz result error to profile,
                      Deprecated : Function eregi() is deprecated in

                      hope y0u can help badz..i dont kn0w how to use der the preg_match

                      Comment


                        #12
                        First, you have to add delimiters to your patterns:
                        PHP Code:
                        preg_match('/pattern/''string'); 
                        ... instead:
                        PHP Code:
                        ereg('pattern''string'); 
                        eregi() is case-insensetive and in preg_match() it is done with modifier i:
                        PHP Code:
                        preg_match('/pattern/i''string'); 
                        More about this: Switching From ereg to preg (PHP Cookbook)

                        Possible pattern modifiers: PHP: Possible modifiers in regex patterns - Manual

                        Regular expressions: Using Regular Expressions with PHP

                        See also: http://coding-talk.com/f19/holes-in-...filters-10258/
                        ----
                        But for this no need for that, in_array will do the job: http://php.net/manual/en/function.in-array.php
                        Last edited by arnage; 12.01.12, 19:43.
                        <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

                        Comment


                          #13
                          U can do it like this :
                          Code:
                            //First get the platform?
                          
                          $u_agent = $_SERVER['HTTP_USER_AGENT'];
                              $platform = 'Unknown';
                              if (preg_match('/linux/i', $u_agent)) {
                                  $platform = 'linux';
                              }
                              elseif (preg_match('/macintosh|mac os x/i', $u_agent)) {
                                  $platform = 'mac';
                              }
                              elseif (preg_match('/windows|win32/i', $u_agent)) {
                                  $platform = 'windows';
                              }
                          The simplest way to do this is the switch statement,the above example is just to guide U......

                          Source : PHP: get_browser - Manual

                          Comment


                            #14
                            hum,,thank arnage and razzbee..ill try ur suggesti0ns,and ill p0st there if it is w0rking...

                            Comment


                              #15
                              you can also use # or ~ in instead of / in case wherein you use it in url which shows extra /
                              PHP Code:
                              preg_match('#pattern#i''string'); 
                              PHP Code:
                              preg_match('~pattern~i''string'); 

                              Comment

                              Working...
                              X