<?php     session_start();  
include 'language/languagefile.php';

if ($set_theme==""){
    $set_theme="day-theme";
}
$tableName = 'onlineconvert_reg'; // 替换为你的表名  

function validateLogin($email, $password, $conn, $tableName) {  
    // 预处理SQL语句，用于查询用户  
    $stmt = $conn->prepare("SELECT * FROM " . $tableName . " WHERE email = ?");  
      
    // 绑定参数  
    $stmt->bind_param("s", $email);  
      
    // 执行查询  
    $stmt->execute();  
      
    // 获取结果  
    $result = $stmt->get_result();  
    $user = $result->fetch_assoc();  
      
    // 检查用户是否存在  
    if ($user) {
        //$hashedPassword = password_hash($user['password'], PASSWORD_DEFAULT); 
        //echo $hashedPassword;
        // 用户存在，验证密码  s
        if ($password==$user['password']) {  
            // 密码验证成功  
            // 在这里可以设置session或进行其他操作  
            // 注意：在生产环境中，不要在这里直接输出登录成功的消息，而是应该进行重定向等操作  
            // 示例：设置session（需要先调用session_start()）  
            session_start();  

            // 注册时间  
            $specifiedTime = $user['signup_date']; 
            
            // 创建DateTime对象表示指定时间  
            $dateTime = new DateTime($specifiedTime);  
            
            // 创建DateTime对象表示当前时间  
            $now = new DateTime();  
            
            if (stripos($user['user_type'], "year") !== false) {  
            // 将指定时间加一年  
            $dateTime->modify('+365 days');  
            $alltime=365;
            }else{
            // 将指定时间加一个月  
            $dateTime->modify('+30 days');  
            $alltime=30;
            }

            // 获取两个DateTime对象的时间戳  
            $nowTimestamp = $now->getTimestamp();  
            $dateTimeTimestamp = $dateTime->getTimestamp();  
            
            // 计算时间戳之间的差异（秒）  
            $differenceInSeconds = $dateTimeTimestamp - $nowTimestamp;  
            
            // 将秒转换为天（注意：这里我们假设一天有86400秒）  
            $differenceInDays = floor($differenceInSeconds / 86400);  
            
            // 如果结果为负数，表示$now晚于$dateTime（即已过期），我们可以取绝对值来获取天数差  
            // 但通常我们会以不同的方式处理这种情况，比如输出“已过期”  
            if ($differenceInDays < 0) {
            $usertime="expired";
                //如果是长期用户
                if ($user['address_country']===''){
                    $givenDateTime = new DateTime($user['signup_date']);
                    $currentDateTime = new DateTime();
                    $interval = $currentDateTime->diff($givenDateTime);
                    if ($currentDateTime < $givenDateTime) {
                        $interval = $givenDateTime->diff($currentDateTime);
                    }
                    $daysDifference = $interval->days;
                    $result = $daysDifference / $alltime;
                    $differenceInDays=round($alltime-$result);
                    $usertime="valid";
                }
            } else {  
                $usertime="valid";
            }

            //有效内是valid, expired是过期
            if ($usertime=="valid"){
                $_SESSION['user_name'] = $user['username']; // 或者使用用户ID，如果表中有的话  
                $_SESSION['user_email'] = $email; // 或者使用用户ID，如果表中有的话  
                $_SESSION['user_type'] = strtolower($user['user_type']); // 或者使用用户ID，如果表中有的话  
                $_SESSION['user_day'] = $differenceInDays; // 还有多少天
                $_SESSION['user_allday'] = $alltime; // 总计分30天和365天
                $_SESSION['signup_date'] = $specifiedTime; // 注册时间
                $_SESSION['user_address'] = $user['address'];

                switch (true) {
                    case stripos($_SESSION['user_type'], "basic") !== false:
                        $user_maxfile="100";
                        $my_max_convert=5;
                        break;
                    case stripos($_SESSION['user_type'], "pro") !== false:
                        $user_maxfile="300";
                        $my_max_convert=20;
                        break;
                    case stripos($_SESSION['user_type'], "enterprise") !== false:
                        $user_maxfile="600";
                        $my_max_convert=50;
                        break;
                    case stripos($_SESSION['user_type'], "premium") !== false:
                        $user_maxfile="1000";
                        $my_max_convert=100;
                        break;
                }
                $_SESSION['user_maxfile'] = $user_maxfile;
                $_SESSION['user_max_convert'] = $my_max_convert;

                if (isset($user['user_logo']) && !empty($user['user_logo'])) {
                   $_SESSION['user_logo'] = "uploads/".$user['user_logo']; // 注册时间
                }else{
                    $_SESSION['user_logo'] = 'images/default-avatar.png'; // 注册时间
                }

                // 新的user_logo值  
                $formattedNow = $now->format('Y-m-d H:i:s');
                $_SESSION['new_date'] = $formattedNow; // 注册时间
                // SQL语句  
                $sql = "UPDATE onlineconvert_reg SET last_login = ? WHERE username = ? AND email = ?";
                
                // 准备语句  
                $stmt = $conn->prepare($sql);  
    
                // 绑定参数  
                $stmt->bind_param("sss", $formattedNow, $user['username'], $email);  
                
                // 执行语句  
                $stmt->execute();


                // 用户和密码验证成功，并且使用在有效内。
                return "valid";
            }else{
                // 用户和密码验证成功，但是使用期过期。
                return "expired";
            }
        } else {  
            // 密码验证失败  
            return "pass_error"; // 登录失败  
        }  
    } else {  
        // 用户不存在  
        return "user_error"; // 登录失败  
    }  
      
    // 关闭语句  
    $stmt->close();  
      
    // 注意：通常不需要在这里关闭数据库连接，因为它可能在其他地方被重用  
    $conn->close();  
}

$setshow="";
// 示例用法  
if ($_SERVER["REQUEST_METHOD"] == "POST") {  
    include 'mysql/mysql_link.php';
    // 设置字符集为utf8mb4  
    $conn->set_charset("utf8mb4");  
    $username = $_POST['username'] ?? '';  
    $password = $_POST['password'] ?? '';  

    // 检查CSRF Token  
    if (!isset($_POST['csrf_token']) || $_POST['csrf_token'] !== $_SESSION['csrf_token']) {  
        $setshow="error";
        $infor_title=$forgot_tip;
        $infor_str=$forgot_tipstr;
    }else{
        $getvalid=validateLogin($username, $password, $conn, $tableName);  
        if ($getvalid=='valid'){
            header('Location: '.$wwwurl.'/myaccount');  
            exit;
        }
        switch ($getvalid) {
            case 'valid':
                header('Location: '.$wwwurl.'/myaccount');  
                exit;
                break;
                case 'expired':
                    $setshow="info";
                    $infor_title = $forgot_warning;
                    $infor_str = $forgot_warningstr.", <a href='".$wwwurl."/pricing'>".$register_user."</a>";
                    break;
                    case 'pass_error':
                        $setshow="warning";
                        $infor_title=$forgot_error;
                        $infor_str=$login_pass_error." <a href='".$wwwurl."/forgot'>".$user_forgot."</a>";
                        break;
                        case 'user_error':
                            $setshow="error";
                            $infor_title = $forgot_error;
                            $infor_str = $forgot_errorstr.", <a href='".$wwwurl."/pricing'>".$register_user."</a>";
                            break;
        }
    }
}else{
    // 检查是否已存在CSRF Token，如果不存在则生成一个新的  
    if (!isset($_SESSION['csrf_token'])) {  
        // 使用openssl_random_pseudo_bytes函数生成一个安全的随机字符串  
        $_SESSION['csrf_token'] = bin2hex(openssl_random_pseudo_bytes(32));  
    }  
}
?><!doctype html>
<html lang="<?php echo $c_lang; ?>">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700&display=swap" rel="stylesheet">
    <title><?php echo $user_title;?> - Free Converter</title>
    <script src="./js/jquery-3.2.1.min.js"></script>
    <script>
        var confirm_ok="<?php echo $confirm_ok;?>";
        var cancel_ok="<?php echo $cancel_ok;?>";
    </script>
    <script src="./js/NZ-MsgBox.min.js"></script>
    <script src="./js/NZ-Drag.min.js"></script>
    <link rel="icon" type="image/png" sizes="32x32" href="<?php echo $wwwurl;?>/favicon/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="16x16" href="<?php echo $wwwurl;?>/favicon/favicon-16x16.png">
    <link rel="manifest" href="<?php echo $wwwurl;?>/favicon/site.webmanifest">
    <link rel="mask-icon" href="<?php echo $wwwurl;?>/favicon/safari-pinned-tab.svg" color="#5bbad5">
    <link rel="shortcut icon" href="<?php echo $wwwurl;?>/favicon/favicon.ico">
    <meta name="apple-mobile-web-app-title" content="<?php echo $oc_title;?>">
    <meta name="application-name" content="<?php echo $oc_title;?>">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="msapplication-TileColor" content="#2b5797">
    <meta name="msapplication-config" content="<?php echo $wwwurl;?>/favicon/browserconfig.xml">
    <meta name="theme-color" content="#ffffff">
    <link rel="stylesheet" href="./css/login.css">
</head>
<body class="<?php echo $set_theme;?>">

    <div class="d-lg-flex half">
        <div class="bg order-1 order-md-2"><img style="display:block; margin-bottom:32px;max-width:320px;" src="./img/login.svg" alt="OnlineConvert">
            <h1 class="title2"><?php echo $user_workspace;?></h1>
            <p><?php echo $user_str;?></p>
        </div>
        <div class="contents order-2 order-md-1">

            <div class="container">
                <div class="row align-items-center justify-content-center">
                    <div class="col-md-7">

                        <div class="mb-4" style="text-align: center;">
                        <a class="onlineicon" href="<?php echo $wwwurl;?>">
                        <svg viewBox="0 0 338 75.2" style="height: 55px;width: 247px;" xmlns="http://www.w3.org/2000/svg"><path d="m205.4 43.2c-1.1 3.7-3.8 6.7-8.9 6.7-6.8 0-10.4-5.5-10.4-12.1s3.5-12.2 10.4-12.2c5.2 0 8.2 2.8 8.9 6.8h-1.8c-1.1-3.1-3.1-5.2-7.2-5.2-5.9 0-8.4 5.5-8.4 10.6s2.4 10.4 8.5 10.4c3.8 0 5.8-2 7.1-4.9-.2-.1 1.8-.1 1.8-.1z" fill="#178417"></path><path d="m223.7 41c0 4.8-2.6 8.9-7.7 8.9-4.7 0-7.4-3.7-7.4-8.9 0-4.9 2.7-8.9 7.6-8.9 4.3 0 7.5 3.6 7.5 8.9zm-13.5 0c0 3.9 2.1 7.3 5.8 7.3s5.7-3 5.7-7.3c0-3.9-2-7.3-5.8-7.3s-5.7 3.3-5.7 7.3z" fill="#178417"></path><path d="m227.8 36.8v-4.3h1.7c.1.5.1 2.7.1 3.2.7-1.7 2-3.6 5.6-3.6 3 0 5.7 1.7 5.7 6.5v11h-1.9v-10.9c0-3-1.3-5-4.2-5-3.9 0-5.5 3.4-5.5 7.2v8.6h-1.7z" fill="#178417"></path><path d="m265.4 44c2.3 3.7 5.5 5 8.4 3.3 2.7-1.6 2.8-3.7 2.6-5.3l1.4-.9c.5 2.3.3 5.5-3.3 7.5-4.5 2.6-8.4-.2-10.6-3.8-2.5-4.2-2.5-9 1.7-11.6 4.6-2.7 8.3.3 9.9 3.1.2.3.5.8.7 1.2zm8.6-6.9c-1.7-2.9-4.8-4.2-7.5-2.5-3 1.8-3.1 4.8-1.6 8z" fill="#dc3e15"></path><g fill="#178417"><path d="m281.4 37.1v-4.7h1.7c0 .5.1 1.6.1 3.7 1-2.5 3.2-4.1 5.9-4.2v1.8c-3.5.2-5.9 2.7-5.9 6.7v8.9h-1.8z"></path><path d="m290.8 32.4h3.2v-5.4h1.7v5.4h3.9v1.6h-3.9v11c0 1.9.3 3 2 3 .5 0 1.2 0 1.8-.2v1.5c-.6.2-1.4.3-2 .3-2.1 0-3.4-1.1-3.4-3.7v-11.8h-3.2v-1.6z"></path><path d="m303.5 41.1c0 4.5 2.1 7.2 5.5 7.2 3.2 0 4.3-1.8 4.9-3.2h1.7c-.7 2.1-2.5 4.9-6.7 4.9-5.3 0-7.2-4.5-7.2-8.9 0-4.9 2.4-9 7.4-9 5.3 0 7 4.6 7 7.7v1.4h-12.6zm10.8-1.5c0-3.4-1.9-6.1-5.3-6.1s-5.2 2.4-5.5 6.1z"></path><path d="m320.2 37.1v-4.7h1.7c0 .5.1 1.6.1 3.7 1-2.5 3.2-4.1 5.9-4.2v1.8c-3.5.2-5.9 2.7-5.9 6.7v8.9h-1.7z"></path></g><path d="m211.8 25.5h32l8.5 24.1h2l6.5-17.2h-1.8l-5.7 15.6-8.4-24h-33z" fill="#dc3e15"></path><path d="m287.6 10.6 35.8-8.1c4.3-.9 8.5 1.7 9.5 6.1.9 4.3-1.7 8.5-6.1 9.5l-35.8 8.1c-4.3.9-8.5-1.7-9.5-6.1-.9-4.2 1.8-8.5 6.1-9.5z" fill="#4caf50"></path><path d="m287.8 23.3c-.1-.4 0-.7.2-1s.5-.5.9-.6.7 0 1 .2.5.5.6.9 0 .7-.2 1-.5.5-.9.6-.7 0-1-.2-.5-.5-.6-.9z" fill="#fff"></path><path d="m291 18.3c-.2-.7-.3-1.4-.2-2.1s.3-1.4.6-2c.3-.7.7-1.1 1.3-1.6s1.3-.8 2-.9c.7-.2 1.3-.2 2-.1s1 .3 1.4.5c.2.1.3.2.4.3.2.2.3.3.3.5s.2.3.2.6c0 .2 0 .4-.1.6 0 .1-.1.2-.2.3s-.2.2-.3.3c-.2.1-.3.1-.5.1s-.3-.1-.6-.3c-.3-.3-.7-.4-.9-.6-.3-.1-.7-.1-1.1 0s-.7.3-1 .5c-.3.3-.5.6-.7.9s-.3.7-.3 1.2 0 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6.5-.2.3-.3.5-.3.8s0 .7.1 1.2l1.3 5.6c.1.3 0 .5-.3.7-.2.3-.5.3-.9.5-.4.1-.7.1-.9 0-.3-.1-.4-.3-.4-.5l-2-9.2c-.1-.3 0-.4.2-.6s.5-.3.9-.4c.3-.1.7-.1.9 0s.3.3.4.5l.3 1c.1-.6.3-1.1.7-1.6.3-.5.8-.8 1.4-.9.8-.2 1.5-.2 2 .1s1 .7 1.4 1.3c.3-.7.6-1.3 1-1.8.5-.6 1.1-.9 2-1 .5-.1.9-.2 1.4-.1s.9.2 1.4.4c.5.3.8.6 1.1.9.3.4.6.9.7 1.4l1.5 6.6c.1.3.1.4 0 .6s-.3.3-.8.5c-.5.1-.8.2-1 .1-.3-.1-.3-.3-.4-.6z" fill="#fff"></path><path d="m180.1 39.1h-7.8c-.4 0-.8-.3-.8-.8 0-.4.3-.8.8-.8h7.8c.4 0 .8.3.8.8-.1.4-.4.8-.8.8z" fill="#898989" opacity=".62"></path><path d="m55.6 14.6c3.7 8.6-.2 18.6-8.8 22.3l-1.4.6-12.8-29.7c-.3-.8 0-1.7.8-2 8.6-3.8 18.5.2 22.2 8.8z" fill="#dc3e15"></path><path d="m22.1 45.9c3.4-8.7 13.3-13 22-9.5l1.5.6-12 30c-.3.8-1.2 1.2-2 .9-8.7-3.4-13-13.3-9.5-22z" fill="#4675ba"></path><path d="m22.9 27.2c8.6-3.7 18.6.2 22.3 8.8l.6 1.4-29.7 12.9c-.8.3-1.7 0-2.1-.8-3.6-8.6.3-18.6 8.9-22.3z" fill="#399c52"></path><path d="m36.7 14c8.7 3.4 13 13.3 9.5 22l-.6 1.5-30-12c-.8-.3-1.2-1.2-.9-2 3.5-8.7 13.3-13 22-9.5z" fill="#ecb21b"></path><path d="m93.5 36.1c.9 0 1.4.3 1.6.8.1.3.1.7 0 1-.2.7-.7 1.1-1.6 1.1h-10.6v12.3c0 .5-.1.8-.4 1.1s-.7.4-1.3.4-1-.1-1.3-.4c-.2-.3-.3-.6-.3-1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9-.5 1.1s-.8.3-1.3.3h-11.9v9.5h11.5c.6 0 1.1.1 1.4.3s.4.6.4 1.2c0 .5-.1.9-.4 1.1s-.7.3-1.4.3h-11.5z" fill="#178417"></path></svg>
                     </a>
                            <a class="onlineicon-dark" href="<?php echo $wwwurl;?>">
                            <img src="./img/gray-dark.svg">
                            </a>
                            <a class="onlineicon-day" href="<?php echo $wwwurl;?>">
                            <img src="./img/gray.svg">
                            </a>
                            <h3><?php echo $user_title;?></h3>
                        </div>
                        <form method="post" id="loginForm">
                            <div class="form-group first">
                                <label class="username" for="username"><?php echo $user_ee;?></label>
                                <svg class="icon" style="width: 1em;height: 1em;vertical-align: middle;fill: #4CAF50;overflow: hidden;position: absolute;top: 33px;left: 22px;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6590"><path d="M874.666667 181.333333H149.333333c-40.533333 0-74.666667 34.133333-74.666666 74.666667v512c0 40.533333 34.133333 74.666667 74.666666 74.666667h725.333334c40.533333 0 74.666667-34.133333 74.666666-74.666667V256c0-40.533333-34.133333-74.666667-74.666666-74.666667z m-725.333334 64h725.333334c6.4 0 10.666667 4.266667 10.666666 10.666667v25.6L512 516.266667l-373.333333-234.666667V256c0-6.4 4.266667-10.666667 10.666666-10.666667z m725.333334 533.333334H149.333333c-6.4 0-10.666667-4.266667-10.666666-10.666667V356.266667l356.266666 224c4.266667 4.266667 10.666667 4.266667 17.066667 4.266666s12.8-2.133333 17.066667-4.266666l356.266666-224V768c0 6.4-4.266667 10.666667-10.666666 10.666667z" p-id="6591"></path></svg>
                                <input type="text" class="form-control" name="username" id="username">
                            </div>
                            <div class="emailE"><span id="emailError" class="error"></span></div>
                            <div class="form-group last">
                                <a href="forgot" class="forgot"><?php echo $user_forgot;?></a>
                                <label class="password" for="password" style="margin-top: -34px;"><?php echo $user_password;?></label>
                                <svg class="icon" style="width: 1em;height: 1em;vertical-align: middle;fill: #4CAF50;overflow: hidden;position: absolute;top: 33px;left: 22px;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5730"><path d="M288 384v-74.666667c0-123.722667 100.266667-224 224-224s224 100.224 224 224v74.666667h10.677333C811.445333 384 864 436.597333 864 501.333333v320c0 64.821333-52.469333 117.333333-117.322667 117.333334H277.333333C212.554667 938.666667 160 886.069333 160 821.333333V501.333333c0-64.821333 52.469333-117.333333 117.322667-117.333333H288z m64 0h320v-74.666667c0-88.426667-71.605333-160-160-160-88.384 0-160 71.626667-160 160v74.666667zM224 501.333333v320c0 29.397333 23.914667 53.333333 53.322667 53.333334H746.666667A53.269333 53.269333 0 0 0 800 821.333333V501.333333c0-29.397333-23.914667-53.333333-53.322667-53.333333H277.333333A53.269333 53.269333 0 0 0 224 501.333333z" p-id="5731"></path></svg>
                                <input type="password" class="form-control" name="password" id="password">
                            </div>
                            <div class="passwordE"><span id="passwordError" class="error" style="margin-top: -14px;"></span></div>
                            <input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($_SESSION['csrf_token']); ?>">
                            <input type="submit" value="<?php echo $user_login;?>" class="btn btn-block btn-primary">
                            <div class="social-login">
                                <span class="google d-flex justify-content-center align-items-center">
                                    <span class="icon-google mr-3"></span><?php echo $user_notaccount;?> <a href="pricing"><?php echo $user_sign;?></a>
                                </span>
                            </div>
                            <a class="playstore-button" href="<?php echo $wwwurl;?>">
                            <svg fill="currentColor" class="iconhome" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6758" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M636.416 116.224c108.544 108.544 217.088 217.088 325.12 326.144 17.92 17.92 25.6 41.984 25.6 67.584 0.512 128 1.024 256 1.024 384 0 51.2-41.472 92.672-92.672 94.208-30.72 0.512-61.44-0.512-92.672-0.512-7.68-8.192-7.168-18.432-7.168-28.16 0-49.664-0.512-99.84 0-149.504 2.048-82.432 0-164.864 1.024-247.296 0-17.408-9.728-28.672-20.992-39.424-86.016-79.36-163.328-167.424-247.808-248.32-7.68-7.168-15.872-14.336-21.504-24.064-3.584-8.704 2.048-14.848 7.168-19.968 35.328-35.84 71.168-71.68 107.008-107.008 4.608-4.096 9.216-8.192 15.872-7.68z" fill="#5D85F1" p-id="6759"></path><path d="M636.416 116.224c-43.008 44.032-86.016 88.064-129.024 131.584-3.072 10.24-11.776 15.872-18.432 23.04-91.648 92.16-183.296 183.296-274.944 275.456-54.784 54.272-109.056 109.056-163.328 162.816-6.656 6.656-12.288 16.384-24.064 15.872 0-74.752-0.512-149.504 0-224.256 0.512-23.552 10.752-44.544 28.16-61.952 127.488-128.512 254.976-257.024 382.976-385.024 38.912-38.912 96.768-38.4 136.704 0.512 20.992 19.968 41.472 41.472 61.952 61.952z" fill="#CA5539" p-id="6760"></path><path d="M802.304 802.816c0 61.44 0.512 122.88 0.512 184.32-158.208 0.512-316.416 0.512-474.624 0.512-38.912 0-78.336-0.512-117.76-0.512-6.144-5.632-7.168-13.312-7.168-20.992-0.512-47.616-0.512-95.232 0-142.848 0-7.68 1.024-15.36 6.144-21.504 10.24-7.168 22.016-6.144 33.28-6.144h526.336c11.776 0 24.064-1.536 33.28 7.168z" fill="#62A64A" p-id="6761"></path><path d="M211.456 802.816c0 61.44-0.512 122.88-0.512 184.32-31.232 0-62.976 1.536-94.208 0.512-49.152-1.536-90.112-43.008-90.624-92.672-0.512-56.832 0.512-113.664 0.512-170.496 54.784-54.272 109.568-109.056 164.864-163.328l18.432-16.896c9.216 8.192 8.192 19.456 8.192 30.208 0.512 66.56 0.512 133.12 0 200.192 0 9.728 0.512 19.968-6.656 28.16z" fill="#EAC139" p-id="6762"></path></svg>
  <span class="texts">
    <span class="text-1"><?php echo $main_title;?></span>
    <span class="text-2">Free Converter</span>
  </span>
</a>
                        </form>
                    </div>
                </div>
                <div style=" position: absolute; bottom: 20px; font-size: 12px; ">© <?php echo date('Y');?> Free-Converter.com, <?php echo $copyall;?>. </div>
            </div>
        </div>
    </div>
    <script>
        $(function() {
            'use strict';
            $.NZ_MsgBox.tooltip({
                tiptarget: $(".playstore-button"),
                content: "<?php echo $main_title;?><div style='font-size:12px;margin-top: 4px;'><?php echo $main_title_str;?></span>",
                location: "right"
            });
            $.NZ_MsgBox.tooltip({
                tiptarget: $(".forgot"),
                content: "<?php echo $forgot_title;?>",
                location: "top"
            });
            <?php if($setshow!==""){ ?>
                $.NZ_MsgBox.tipsbar({ title: "<?php echo $infor_title;?>", content: "<?php echo $infor_str;?>", type: "<?php echo $setshow;?>", location: "top", showtime: 4000 });
            <?php } ?>
            $('.form-control').on('input', function() {
                var $field = $(this).closest('.form-group');
                if (this.value) {
                    $field.addClass('field--not-empty');
                } else {
                    $field.removeClass('field--not-empty');
                }
            });

            $('#loginForm').on('submit', function(event) {  
        event.preventDefault();
  

        $('#emailError').text('');  
        $('#passwordError').text('');  

        var email = $('#username').val();  
        var password = $('#password').val();  
  
        var isValid = true;  
  

        if (email.trim() === '') {  
            $('.emailE').show();
            $('#emailError').text('<?php echo $reset_email;?>');  
            $('#username').focus();
            return false;
            isValid = false;  
        }  
  
        var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;  
        if (!emailPattern.test(email)) {  
            $('.emailE').show();
            $('#username').focus();
            $('#emailError').text('<?php echo $reset_emailstr;?>');  
            return false;
            isValid = false;  
        }  
        $('.emailE').hide();
        if (password.trim() === '') {  
            $('.passwordE').show();
            $('#passwordError').text('<?php echo $login_pass_required;?>');  
            $('#password').focus();
            return false;
            isValid = false;  
        }  
        $('.emailE').hide();
        $('.passwordE').hide();
        if (isValid) {  
            this.submit();  
        }  
    });  

        });
    </script>
</body>

</html>