dbradbury Posted January 26, 2010 Share Posted January 26, 2010 <?php include("connect.php"); $player = $_GET['player']; $getplayers = mysql_query("SELECT * FROM phpbb_posts WHERE forum_id='5' ORDER BY post_subject ASC"); $countplayers = mysql_num_rows($getplayers); ?> <table width="85%" height="auto" border="0"> <tr> <td width="345px" style="vertical-align:top" align="right"> <?php if($countplayers==0) { echo "No Players Yet!"; } else { $displayplayers = $getplayers; while($row = mysql_fetch_assoc($displayplayers)) { echo '<a href=meettheplayers.php?player='.$row['post_id'].'>'.$row['post_subject'].'</a><br>'; } } ?> </td> <td width="10px"></td> <td width="345px" style="vertical-align:top" class="scrollable"> <?php if(isset($_GET['player'])) { $profile = mysql_query("SELECT * FROM phpbb_posts WHERE post_id='$player'"); $profilecount = mysql_num_rows($profile); if($profilecount==0) { echo ("This player doesnt have a profile yet"); } else { $showprofile = $profile; $playername = mysql_query("SELECT * FROM phpbb_posts WHERE post_id='$player'"); while($row1 = mysql_fetch_assoc($showprofile)) { while($row2 = mysql_fetch_assoc($playername)) { echo nl2br(''.$row2['post_subject']."'s Profile:<br><br>".$row1['post_text']); } } } } else { echo "Please select a player to see their profile"; } ?> </td> <td> <?php if(isset($_GET['player'])) { $idpic = mysql_query("SELECT * FROM phpbb_attachments WHERE post_msg_id='$player'"); $countid = mysql_num_rows($idpic); if($countid==1) { print '<img src=http://blah.blah.host56.com/files/'.$idpic['physical_filename'].'.'.$idpic['extension'].'>'; } else { echo 'No image yet'; } } ?> </td> </tr> </table> can anyone see a problem with this code? i know that i keep going in and out of the php tags Quote Link to comment Share on other sites More sharing options...
teamatomic Posted January 26, 2010 Share Posted January 26, 2010 What makes you feel there is something wrong? HTH Teamatomic Quote Link to comment Share on other sites More sharing options...
dbradbury Posted January 26, 2010 Author Share Posted January 26, 2010 well when i publish it to mysite i get this: Bad Image and the image wont show... which is from this bit: <?php if(isset($_GET['player'])) { $idpic = mysql_query("SELECT * FROM phpbb_attachments WHERE post_msg_id='$player'"); $countid = mysql_num_rows($idpic); if($countid==1) { print '<img src=http://blah.blah.host56.com/files/'.$idpic['physical_filename'].'.'.$idpic['extension'].'>'; } else { echo 'No image yet'; } } ?> Quote Link to comment Share on other sites More sharing options...
daneth1712 Posted January 26, 2010 Share Posted January 26, 2010 after <img src= you need to open it with " and end it with the same <img src="http://blah.blah.host56.com/files/'.$idpic['physical_filename'].'.'.$idpic['extension'].'"> think about how it should look when it displays in html... <img src="http://www.example.com/somefilename.jpg"/> Quote Link to comment Share on other sites More sharing options...
dbradbury Posted January 26, 2010 Author Share Posted January 26, 2010 nope, no change.. i noticed in my forum directory that the images that i uploaded aren't stored as images... Image extensions i have a feeling that phpbb do something to the uploads?? Quote Link to comment Share on other sites More sharing options...
daneth1712 Posted January 26, 2010 Share Posted January 26, 2010 when the page is pulled after the query is run, I assume you have a page with a thumbnail with a red 'x' in it? if so, can you view the page source and print here how the image link is being pulled? Quote Link to comment Share on other sites More sharing options...
dbradbury Posted January 26, 2010 Author Share Posted January 26, 2010 no, i get this... http://tinypic.com/m/8x7rbm/4 <-- its an image of what i get lol Quote Link to comment Share on other sites More sharing options...
daneth1712 Posted January 26, 2010 Share Posted January 26, 2010 can you just swap the above code you gave with the following and advise on the result. <?php if(isset($_GET['player'])) { $idpic = mysql_query("SELECT * FROM phpbb_attachments WHERE post_msg_id='$player'"); $countid = mysql_num_rows($idpic); if($countid==1) { while($countid = mysql_fetch_array($idpic)){ $filename=$countid['physical_filename']; $extension=$countid['extension']; } echo "$filename"; echo "<br>"; echo "$extension"; } else { echo 'No image yet'; } } ?> Quote Link to comment Share on other sites More sharing options...
dbradbury Posted January 26, 2010 Author Share Posted January 26, 2010 the only different is now it is this: http://tinypic.com/4duhu0qr Quote Link to comment Share on other sites More sharing options...
daneth1712 Posted January 26, 2010 Share Posted January 26, 2010 Do you know what teh filename for this image is suppossed to be? Do you have a file called 2_a200c92db4cfa347f0316f1b09ed46bb.jpg in your 'files' folder? What should this be? Because that is what you are pulling from your database. Looks like an md5 hash to me Quote Link to comment Share on other sites More sharing options...
dbradbury Posted January 27, 2010 Author Share Posted January 27, 2010 well thats the thing. i upload it something like 'image.jpg' but then after its uploaded ill look in the files folder and it will be called '2_njjs783ehtneegu8g4n' or something like that.. there is no extension.. thats why i think the file.php file in the download folder has something to do with it, i just cant figure it out! Quote Link to comment Share on other sites More sharing options...
teamatomic Posted January 27, 2010 Share Posted January 27, 2010 Is there a choice somewhere you are uploading that you can upload the image as a binary file? Also, images are store as BLOB in mySQL databases and that hash is probably the md5sum if the content of the BLOB. Its also a remote possibility that somehow your BLOB is a tiny-blob and so the file is trunicated. Remote but possible, maybe? HTH Teamatomic Quote Link to comment Share on other sites More sharing options...
dbradbury Posted January 27, 2010 Author Share Posted January 27, 2010 nope there is not an option of uploading it in binary.. its just like this attach part lol attach_id/ post_msg_id/ topic_id/ in_message/ poster_id/ is_orphan/ physical_filename/ real_filename/ download_count/ attach_comment/ extension/ mimetype/ filesize/ filetime/ thumbnail 2/ 16/ 14/ 0/ 2/ 0/ 2_a200c92db4cfa347f0316f1b09ed46bb/ DSCF2377edit.jpg/ 4/ [bLOB - 0 B]/ jpg/ image/jpeg /402735/ 1260925523/ 0 dunno if that will help in the slightest its my the mysql.. for the image... not sure what you mean about his blob thingy... lol Quote Link to comment Share on other sites More sharing options...
dbradbury Posted January 27, 2010 Author Share Posted January 27, 2010 this was in the file.php file that is in the download folder... // Fetching filename here to prevent sniffing of filename $sql = 'SELECT attach_id, is_orphan, in_message, post_msg_id, extension, physical_filename, real_filename, mimetype, filetime FROM ' . ATTACHMENTS_TABLE . " WHERE attach_id = $download_id"; $result = $db->sql_query_limit($sql, 1); $attachment = $db->sql_fetchrow($result); $db->sql_freeresult($result); if (!$attachment) { trigger_error('ERROR_NO_ATTACHMENT'); } $attachment['physical_filename'] = utf8_basename($attachment['physical_filename']); $display_cat = $extensions[$attachment['extension']]['display_cat']; if (($display_cat == ATTACHMENT_CATEGORY_IMAGE || $display_cat == ATTACHMENT_CATEGORY_THUMB) && !$user->optionget('viewimg')) { $display_cat = ATTACHMENT_CATEGORY_NONE; } if ($display_cat == ATTACHMENT_CATEGORY_FLASH && !$user->optionget('viewflash')) { $display_cat = ATTACHMENT_CATEGORY_NONE; } if ($thumbnail) { $attachment['physical_filename'] = 'thumb_' . $attachment['physical_filename']; } else if (($display_cat == ATTACHMENT_CATEGORY_NONE/* || $display_cat == ATTACHMENT_CATEGORY_IMAGE*/) && !$attachment['is_orphan']) { // Update download count $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET download_count = download_count + 1 WHERE attach_id = ' . $attachment['attach_id']; $db->sql_query($sql); } if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && ((strpos(strtolower($user->browser), 'msie') !== false) && (strpos(strtolower($user->browser), 'msie 8.0') === false))) { wrap_img_in_html(append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'id=' . $attachment['attach_id']), $attachment['real_filename']); file_gc(); } else { // Determine the 'presenting'-method if ($download_mode == PHYSICAL_LINK) { // This presenting method should no longer be used if (!@is_dir($phpbb_root_path . $config['upload_path'])) { trigger_error($user->lang['PHYSICAL_DOWNLOAD_NOT_POSSIBLE']); } redirect($phpbb_root_path . $config['upload_path'] . '/' . $attachment['physical_filename']); file_gc(); } else { send_file_to_browser($attachment, $config['upload_path'], $display_cat); file_gc(); } } looks like its fairly important to what need... any thoughts? Quote Link to comment Share on other sites More sharing options...
teamatomic Posted January 27, 2010 Share Posted January 27, 2010 Not a clue. Glad its not my problem HTH Teamatomic Quote Link to comment Share on other sites More sharing options...
dbradbury Posted January 27, 2010 Author Share Posted January 27, 2010 this might help someone... echo '<img src="./forum/download/file.php?id=4&t=1&sid=a38a4c13422bc1df132a3c21d8ee7e33" /></a>'; i looked at the source for my forum on a particle post, and this displays the picture, so i put it into my code and published it, and it worked, only thing is it shows that one pic for them all, obv so now i have to somehow get it to show the correct pic, and i looked in my phpmyadmin on my attachments, and cant understand where the id=4 and t=1 and sid=a38a4c13422bc1df132a3c21d8ee7e33 came from.. well i think id is the attach id and the t is a thumbnail, but the sid? has that been md5'ed from something? lol here a pic of that image in my phpmyadmin Quote Link to comment Share on other sites More sharing options...
dbradbury Posted January 27, 2010 Author Share Posted January 27, 2010 okay ignore the extra </a> on the end lol Quote Link to comment Share on other sites More sharing options...
dbradbury Posted January 27, 2010 Author Share Posted January 27, 2010 OMG!! SOMEHOW I DID IT!! Lol!! no idea how!! but ill post my code for that part, so it can be referenced... if needed lol im gob smacked lol <?php if(isset($_GET['player'])) { $idpic = mysql_query("SELECT * FROM phpbb_attachments WHERE post_msg_id='$player'"); $countid = mysql_num_rows($idpic); if($countid==0) { echo 'No image yet'; } else { while($row = mysql_fetch_assoc($idpic)) { if ($row['physical_filename'] != '') { print '<img src="./forum/download/file.php?id='.$row['attach_id'].'&t='.$row['thumbnail'].'&sid=a38a4c13422bc1df132a3c21d8ee7e33" />'; } } } } ?> Quote Link to comment Share on other sites More sharing options...
dbradbury Posted January 27, 2010 Author Share Posted January 27, 2010 okay update... i can see the pictures but others cant :s my friends used IE to look at them, and got a red X... chrome did this multimedia thingy... Quote Link to comment Share on other sites More sharing options...
dbradbury Posted January 28, 2010 Author Share Posted January 28, 2010 its to do with the sid.. the session id..? how do i make one of those, as the one that was there, was set to my ip address for the forum, for tht day, or login.. if that makes sense at all... now a day later, the images are seen :s Quote Link to comment Share on other sites More sharing options...
dbradbury Posted January 28, 2010 Author Share Posted January 28, 2010 can anyone think of anything? Quote Link to comment Share on other sites More sharing options...
dbradbury Posted January 29, 2010 Author Share Posted January 29, 2010 could someone anyone? please help me? or even attempt to write some sort of code that would display an image attached to a forum post on a website?... thanks Quote Link to comment Share on other sites More sharing options...
dbradbury Posted January 29, 2010 Author Share Posted January 29, 2010 !!!!!!!!!!!!!!! this may help loads!! im not sure why tho but yeah, this i found in functions_upload.php in the forum/includes folders i think... // Remove every extension from filename (to not let the mime bug being exposed) if (strpos($this->realname, '.') !== false) { $this->realname = substr($this->realname, 0, strpos($this->realname, '.')); } so if i took this out, would it help? Quote Link to comment Share on other sites More sharing options...
dbradbury Posted February 3, 2010 Author Share Posted February 3, 2010 http://www.wellho.net/mouth/937_Display-an-image-from-a-MySQL-database-in-a-web-page-via-PHP.html what is this.. would this help me, as i tried this and it didnt work, do i need to replace certain criteria items in the search areas?? Quote Link to comment Share on other sites More sharing options...
dbradbury Posted February 3, 2010 Author Share Posted February 3, 2010 ugh! c'mon... anyone please i beg!! lol Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.