Automatic login after registration, moved from mysql_* to mysqli