please check my user session login system and tell me what can be done to make it better
Let's start with the SQL injection vulnerability in your code in 

mysql_query("SELECT * FROM users WHERE    username='$login_username' AND password=SHA1('$login_password')") or die("unable to connect to msql server: " . msql_error()) ;


In this piece of code you put the user defined $login_username straight to a SQL query. I see that there's a function called security2 that does something to username but I cannot be sure that it executes mysql_real_escape_string that would prevent SQL injection. If it does not, then a malevolent user might be tempted to enter a user name that may corrupt your database. 

Poor Bobby Tables might cause problems here . 

Rest of the thoughts are (at least at first) in random order

Uou should probably migrate from mysql_ to mysqli_ functions. mysqli is the MySQL Improved Extension for PHP that is supposed to work better and do much more. 

In PHP, it's almost always better to use === than == to test equality. 

You could try to be consistent with the use of ''and "". 

The code would benefit if you would define more functions to partition the logic. Maybe even define some classes.