Warning: Undefined variable $admin

The error is telling that when you say:

if($admin == '1'){

PHP has no idea what you are talking about. There is no $admin so it cannot ever equal 1.

As Rick Hellewell mentioned in the comments, you might actually want is_admin() which is a function that returns a boolean (true or false).

It is quite likely the code you actually want would be like this:

// If ur an admin, you have access to the following page
if( is_user_admin() ){
// When going ...[snip]...

Edit: I originally suggested is_admin() which I was reminded checks the page is loaded in the admin area. I should have said is_user_admin()