<?php
include "../components/functions.php";
?>


<!DOCTYPE>
<html>
<head>

    <?php

    echo css_include();
    echo script_include();
    ?>
</head>

<body>
<div class="container" id="login_container">
    <div class="flex-container">
        <form class="border" id="form_border">
            <div class="form-group py-4">
                <span class="login_title py-3" style="font-family:'B Titr'">ورود</span>
            </div>
            <div class="form-group">
                <label for="mobile">تلفن همراه</label>
                <input type="text" class="form-control rounded-pill" id="mobile" aria-describedby="mobileErr"
                       placeholder="۰۹۱۲-------" maxlength="11">
                <small id="mobileErr" style="color: red"></small>

            </div>
            <div class="form-group">
                <label for="exampleInputPassword1">رمز عبور</label>
                <input type="password" class="form-control rounded-pill" id="exampleInputPassword1"
                       aria-describedby="passErr">
                <small id="passErr" style="color:red"></small>
            </div>
            <div class="form-group">
                <a href="#">رمز عبورم را فراموش کرده‌ام</a>
            </div>
            <!--            <button type="submit" class="btn btn-primary rounded-pill pb-2" style="position: absolute;left: 50px;background-color: #f1b439;border-color: #f1b439">ورود</button>-->
            <!--            <button onclick="location.href='#';" type="button"  style="" class="btn btn-primary rounded-pill" >ثبت نام</button>-->
            <div class="row">
                <button type="submit"
                        class="btn btn-primary rounded-pill pb-2 col-5 default_btn" id="submitButton">ورود
                </button>
                <div class="col-2"></div>
                <button onclick="f()"
                        type="button" class="btn btn-primary rounded-pill col-5 default_btn" id="button">ثبت نام
                </button>
            </div>

        </form>
    </div>
</div>

</body>
<script>
    function f(e) {
        var v = document.getElementById("mobile").value;
        {
            if (v.length != 0) {
                var flag=0;
                if(v.length!=11){
                    flag=1;
                }
                if(v[0]!="0"){
                    flag=1;
                }
                if (flag) {
                    document.getElementById('mobileErr').innerHTML = 'شماره موبایل فاقد اعتبار است';
                    return false;
                } else {
                    location.replace("register.php?mobile=" + v);
                }
            } else {
                location.replace("register.php");
            }
        }


    }
</script>
</html>