As far as I know, I can get the UID of the currently logged in user with the following code:

global $user;
echo $user->uid;

However, when I put the above code in the basic page, I always get the UID of the author of the node.

Please help me to resolve this issue.