The second link is not altogether secure...
Code like this:
PHP:
$name = $_POST['user'];
$q_user = mysql_query("SELECT * FROM USERS WHERE login='$name'");
is susceptible to attacks such as SQL injection. The input is trusted completely, which is a bad idea.
Also, it appears the passwords in the database are not encrypted, so any hacker, or database administrator can view all the passwords as plain text.
If you use this at all, don't put anything important in it!!
Just for learning purposes perhaps, until you realise all the security vulnerabilities.