Jump to content

Recommended Posts

Okay, essentially I am trying to:

 

Take usernames from a mysql database & echo certain variables contained in their profiles. I have got this part pretty much sorted, now; what I need to figure out is how to not echo a user that has a certain word in their profile. For example:

 

The username VincentWhite will not display if their included file says Default Name.

 

This might seem confusing, so heres the code that I'm using, it might be easier to figure out whats wrong with the code than listening to me give a bad explanation.

 

			$check echo '/home/alport/public_html/'.$row['Username'].'/text/name.txt';
		if ($check == 'Default Name');

{}else{

echo '';
exit;

}
		echo '<h2>';
		include '/home/alport/public_html/'.$row['Username'].'/text/name.txt';}}
		echo '</h2>';
		if ($_POST['Username'] = $row['Username']){echo '';}
		echo '';

Link to comment
https://forums.phpfreaks.com/topic/150378-solved-using-php-to-echo-mysql-rows/
Share on other sites

You could use strpos

 

$profileTXT = file_get_contents('/home/alport/public_html/'.$row['Username'].'/text/name.txt');

if(!strpos($profileTXT, 'Default User'))
{
   echo 'Display profile here';
}
else
{
    echo 'do someting else, Default User present in file';
}

Never Mind, I fixed it using:

if ($profileTXT == "Default Name")
{
   echo 'Epic Fail';
}
else
{
    echo '<h2>';
		include '/home/alport/public_html/'.$row['Username'].'/text/name.txt';}}
		echo '</h2>';
		if ($_POST['Username'] = $row['Username']){echo '';}
		echo '';
}


 

But, does anyone know if filegetcontents can be disabled on certain servers? This is really bugging me now.

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.