<?php
if (!defined('webid')) {
    exit();
}
if (isset($_SESSION['username']) and isset($_SESSION['password'])) {
    header("Location: /");
    exit();
}
?>
<style type="text/css">
.val {
    -moz-border-radius: 2px;
    -webkit-border-radius: 2px;
    -khtml-border-radius: 2px;
    border-radius: 2px;
    border: 1px solid #cccccc;
    height: 24px;
    border-top: 1px solid #BCBCBC;
	-moz-box-shadow: 0 0 1px rgba(0,0,0,0.1) inset;
	-webkit-box-shadow: 0 0 1px rgba(0,0,0,0.1) inset;
    -khtml-box-shadow: 0 0 1px rgba(0,0,0,0.1) inset;
    box-shadow: 0 0 1px rgba(0,0,0,0.1) inset;
    padding: 0 5px;
}
.val:focus {
    border: 1px solid #1c62b9;
}
.reg tr td {
    height: 32px;
    border-bottom: 1px solid #dddddd;
}
.value {
    background: #e5e5e5;
    padding: 5px;
}
.reg a {
    color: #1c62b9;
    text-decoration: none;
}
.reg a:hover {
    text-decoration: underline;
}
.imgcap {
    border: 1px solid #808080;
    -moz-box-shadow: 0 0 2px rgba(0,0,0,0.5);
	-webkit-box-shadow: 0 0 2px rgba(0,0,0,0.5);
    -khtml-box-shadow: 0 0 2px rgba(0,0,0,0.5);
    box-shadow: 0 0 2px rgba(0,0,0,0.5);
}
.error {
    font-weight: bold;
    color: #800000;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
    $('.big_btn').click(function(){
        $.post('ajax.php?func=log',{
            logusername : $('#logusername').val(),
            logpassword : $('#logpassword').val(),
            code : $(this).val(),
            savelp: $('#sp:checked').val()
        }, function(data){
            if (data == 1){
                hax({url:'/profile', id:'flax'});
            } else {
                $('.error').html(data);
            }
        });
        return false;
    });
})
</script>
<center><h3 style="color: #1c62b9;">Добро пожаловать на <?=$sitename?></h3></center>
<table class="reg" width="75%" border="0" cellpadding="0" cellspacing="0" align="center">
    <tr>
        <td colspan="2" align="center"><div class="error"></div></td>
    </tr>
    <tr>
        <td width="45%"><b>Email</b></td>
        <td class="value"><input type="text" name="logusername" id="logusername" maxlength="40" size="38" class="val" value="<? echo htmlspecialchars($_COOKIE['login'])?>" /></td>
    </tr>
    <tr>
        <td><b>Пароль</b></td>
        <td class="value"><input type="password" name="logpassword" id="logpassword" maxlength="50" size="38" class="val" value="<? echo htmlspecialchars($_COOKIE['pass'])?>" /></td>
    </tr>
    <tr>
        <td colspan="2" align="center" style="border-bottom: 0;"><h4>Сколько квадратов вы видите?</h4></td>
    </tr>
    <tr>
        <td colspan="2" align="center" style="border: 0; padding: 5px;"><img src="image.php?<?php echo $res; ?>" class="imgcap" /></td>
    </tr>
    <tr>
        <td colspan="2" align="center" style="border: 0;">
            <input class="big_btn" name="code" value="1" type="submit" />
            <input class="big_btn" name="code" value="2" type="submit" />
            <input class="big_btn" name="code" value="3" type="submit" />
            <input class="big_btn" name="code" value="4" type="submit" /><br />
            <input class="big_btn" name="code" value="5" type="submit" />
            <input class="big_btn" name="code" value="6" type="submit" />
            <input class="big_btn" name="code" value="7" type="submit" />
            <input class="big_btn" name="code" value="8" type="submit" />
        </td>
    </tr>
    <tr>
    <?
    if ($_COOKIE['login'] != '') {
        $ch = ' checked="checked"';
    } else {
        $ch = '';
    }
    ?>
        <td colspan="2" align="center" style="border: 0; padding-top: 20px;"><input type="checkbox" id="sp" <?=$ch?> /> <b>Запомнить логин и пароль</b><br /><small>Внимание! Запоминание логина и пароля сделает ваш аккаунт более уязвимым.<br />
Не применяйте этот параметр, если ваш компьютер доступен посторонним.</small></td>
    </tr>
</table>