If statement not recognizing something that's 'true'

I just don’t know what is happening. The “linked.txt” file contains a single ‘1’ in the file. When I load the page (with the cookie, of course) the only thing that appears is the welcome line and 'DBX Gaming account: '. It won’t show the account_num.txt content (which is also a single ‘1’ in the file).

<?php $userpath = "users/" . $_COOKIE["username"]; $linked = file_get_contents($userpath . "/linked.txt"); $account_num = file_get_contents($userpath . "/account_num.txt"); echo '

Welcome, ' . $username . "!

"; echo 'DBX Gaming account: '; if ($linked == '1') { echo $account_num; } ?>


For debugging porpose, try to echo $linked, and also echo $userpath - problem is likely with wrong path stored in cookie.

Hmm. For some reason it is now working.

I replaced the cookie in the $userpath with $username (which I didn’t declare in the code above, but had it on the php file). It’s working fine now. Thanks.

Sponsor our Newsletter | Privacy Policy | Terms of Service