I'm trying to solve one HTML input bar so I can remember the MTA server username and password Login is available here: http://ru1n.eu/index.php?/topic/3-rel-login-panel/ and I found some javascript for remembering and i do not know how to make a login to incorporate it
<script type="text/javascript">
if ($('#remember').attr('checked'))
{
var email = $('#email').attr("value");
var password = $('#password').attr("value");
// set cookies to expire in 14 days
$.cookie('email', email, { expires: 14 });
$.cookie('password', password, { expires: 14 });
$.cookie('remember', true, { expires: 14 });
}
else
{
// reset cookies
$.cookie('email', null);
$.cookie('password', null);
$.cookie('remember', null);
}
var remember = $.cookie('remember');
if (remember == 'true')
{
var email = $.cookie('email');
var password = $.cookie('password');
// autofill the fields
$('#email').attr("value", email);
$('#password').attr("value", password);
}
</script>
You have two blocks of code in the same place that should be running in different places. The second block, that checks for cookies and fills the html form - that should be done when the page is finished loading. It looks like you are using jquery, so that might look like this:
The other block that sets the cookies should be run when the user submits the form. For example in some function: