Jump to content

What am i doing wrong?


dbradbury

Recommended Posts

<?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

Link to comment
Share on other sites

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';
		}
	}		
?>

Link to comment
Share on other sites

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';			
	}		
	}

?>

Link to comment
Share on other sites

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! :(

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

 

2uqfb5t.jpg

Link to comment
Share on other sites

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" />';
				}
			}
		}
	}		
?>	

Link to comment
Share on other sites

!!!!!!!!!!!!!!! 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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.