First PHP login system
At a quick look:


Your code is vulnerable to SQL Injection: assume the user wants to hurt you, so always parse superglobals $_GET and $_POST

https://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php
To check if variable have values:

// good practice
if (isset($userName, $userPass))
// bad practice
if ($userName &amp;&amp; $userPass )

More important:


  Don't reinvent the wheel unless you plan on learning more about wheels.


A simple search on google for PHP login system will give you a limitless number of examples from where you can learn how to build a proper system: 


http://www.phpeasystep.com/workshopview.php?id=6