You could add another url parameter to trigger the cookie setting like:
<ul>
<li class="active"><a href="/en/<?php echo basename($_SERVER['PHP_SELF'])?>?lang=en">ENGLISH</a></li>
<li><a href="/ru/<?php echo basename($_SERVER['PHP_SELF'])?>?lang=ru">РУССКИЙ</a></li>
</ul>
Then add an include to the top of each page that uses the webassist server behavior to set a cookie value when the remember url parameter is present.
In the same include you can add code to redirect to the correct language if the cookie is set. The include file will look something like:
<?php
if ((isset($_GET['lang']) && $_GET['lang'] != "")) {
setcookie("langpref", "".$_GET['lang'] ."", time()+(60*60*24*30), "/", "", 0);
}
?>
<?php
if (isset($_COOKIE['langpref'])) {
if (strpos($_SERVER['PHP_SELF'],$_COOKIE['langpref']) === false) {
header("location: /" . $_COOKIE['langpref'] ."/". basename($_SERVER['PHP_SELF']));
}
}
?>