How do prevent other users from seeing certain views in a user profile? I have setup a View which showscertain information to a user, when he/she is logged in provided that logged in user is referenced in the content type containing that information.

The View shows this information user the name of the uid from the url. 

The website is such that the logged in user can view the profile of other users, this makes the logged in user have access to the information of the user whose profile is viewing which shouldn't be the case. Please tell me  how do I prevent this?
This is honestly, a question that I have faced many times. 
You have 2 options. 

Use a path like /my_posts and then using UID argument with "logged in user" as the failback argument.
This is a common wa. Modules like Flag comes with default Views that uses "logged" in user as the failback argument so it doesn't need to mess with php.

However, the ideal solution would be, 

A. Add the UID argument as necessary (user reference, author, etc).

B. Set When the filter value is NOT available to Provide default value and then to User ID From URL.



C. Check Specify validation criteria. and choose "php code".

&lt;?php
global $user;
if ($user-&gt;uid == $argument &amp;&amp; is_numeric($argument) &amp;&amp; $argument &gt;0 ){
  return TRUE;
}
?&gt;


D. 'Action to take if filter value does not validate'  => Display "Access Denied"


Good luck!