Generating SQL for smilies witowt stress

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

    Generating SQL for smilies witowt stress

    I was working on d version 3.0 of my script and i had to make sql for about 200 gifs n jpgs bt u didnt really fink i'd do it one by one did u? O.o Okay i used to, anyway wit dis piece of codin u cud generate SQL dependin on ur smilies folder:
    Code:
    <?php
    $han = dir("/");
    while($fnm = $han->read()){
    $file = explode(".",$fnm);
    if(strlen($file[0])>2 && count($file)==2){
    echo "INSERT INTO `ibwf_smilies` (`id`,`scode`,`imgsrc`,`hidden`)\n";
    echo "VALUES (NULL,'-".$file[0]."-', 'smilies/".$fnm."','0');\n";
    }
    }
    ?>
    ofcuz u can modify it easily. And oh make sure u rename ur files cuz d code for a haha.gif file would be -haha- and d code for a haha_01.gif wud be -haha_01- . To c d sql, view just view d source code of d display. It'l be ther. If u found dis useful, hola atchur boi. :-)

    #2
    oh, put dat file in ur smiles folder and run it.

    Comment


      #3
      you might want to conect to db aswell
      or in most peoples cases:
      include("../web/config.php");
      include("../web/core.php");

      Comment


        #4
        nah u dnt need database. It just generates the sql query for files in the smilies folder. You just copy d sql code and paste in phpmyadmin.

        Comment


          #5
          i didnt read your post properly lol*
          but u might aswell have it directly insert straight into db

          Comment


            #6
            this is pobably the most usful piece of coding ive seen on this whole forum since ive been here, simple, easy, something i wouldnt had fort of. lol.

            Comment


              #7
              Thanks. Oh btw, found a "bug". Add this 2 d code

              change
              if( strlen($file[0])>2 && count($file)==2 ){

              TO
              if( strlen($file[0])>2 && count($file)==2 && $file[2]!="php"){

              REASON?
              So it doest pick up ur index.php file as well.

              Comment


                #8
                yeah nice script btw

                Comment


                  #9
                  what o you mean by run it. how? sorry newbie

                  Comment


                    #10
                    am not getin the sql script oh
                    http://myfacepals.com
                    MYFACEPALS SOCIAL NETWORKsigpic

                    Comment


                      #11
                      Originally posted by makvanpor2000 View Post
                      am not getin the sql script oh
                      can you read ???
                      It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt.
                      ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ !
                      ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.
                      キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

                      Comment

                      Working...
                      X