PHP Experts! Help me please :)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xentech
    Confirmed User
    • Jan 2006
    • 1405

    #1

    PHP Experts! Help me please :)

    http://bigtitsvideos.info/dl.php?id=5

    I'm trying to display an image which is stored in a mediumblob table field, any ideas? Here is my code:

    Code:
    <?php
    include "config.php";
    $result = mysql_query("select * from [MASKED] where id = '$id'");
    
    while($r=mysql_fetch_array($result))
    {	
       $content=$r["content"];
       $type=$r["type"];
    
    header("Content-type: $type");
    echo ($content);
    }
    
    mysql_close($connection);
    ?>
  • JayS
    Confirmed User
    • Oct 2007
    • 138

    #2
    Originally posted by xentech
    I'm trying to display an image which is stored in a mediumblob table field, any ideas? Here is my code:
    Don't store it in a DB Would be helpfull if you can mention where the error is...

    Comment

    • xentech
      Confirmed User
      • Jan 2006
      • 1405

      #3
      Originally posted by JayS
      Don't store it in a DB Would be helpfull if you can mention where the error is...
      http://bigtitsvideos.info/dl.php?id=5

      Go to that url, for me it just shows "http://bigtitsvideos.info/dl.php?id=5" instead of an image... And I thought storing it in a DB would be easier but apparently not, I just can't see how its not working. Perhaps it is to do with my PHP settings?

      Comment

      • xentech
        Confirmed User
        • Jan 2006
        • 1405

        #4
        Ignore everything I just said, I am a fucking idiot. Thanks anyway

        Comment

        • JayS
          Confirmed User
          • Oct 2007
          • 138

          #5
          Originally posted by xentech
          Ignore everything I just said, I am a fucking idiot. Thanks anyway
          Some old debug code in your config.php?

          Comment

          • xentech
            Confirmed User
            • Jan 2006
            • 1405

            #6
            Originally posted by JayS
            Some old debug code in your config.php?
            Nah I had

            Code:
            $content=$r["content"];
            instead of

            Code:
            $content=$r["image"];
            That is the worst part about programming, some problems can just marvel you for ages and you can't figure out what they are. Then they turn out to be the most simple things you have missed.

            Comment

            • mike-al
              Confirmed User
              • Aug 2007
              • 691

              #7
              Not sure what book you have that is teaching you, but please burn it ASAP
              Delete this account, i am done here

              Comment

              • Serge Litehead
                Confirmed User
                • Dec 2002
                • 5190

                #8
                Originally posted by JayS
                Don't store it in a DB
                stored image in DB could also mean simply stored reference to it which is useful some times.

                Comment

                • xentech
                  Confirmed User
                  • Jan 2006
                  • 1405

                  #9
                  Originally posted by mike-al
                  Not sure what book you have that is teaching you, but please burn it ASAP
                  I just ripped some code from some random tutorial, never worked with images in SQL before. Why, is it insecure?

                  Comment

                  • JayS
                    Confirmed User
                    • Oct 2007
                    • 138

                    #10
                    Originally posted by xentech
                    I just ripped some code from some random tutorial, never worked with images in SQL before. Why, is it insecure?
                    You may check out en.wikipedia.org/wiki/SQL_injection and I highly recommend that you better not use every piece of code that you can find on the web unless you have checked it

                    Comment

                    Working...