示例#1
0
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="robots" content="noindex, nofollow">

        <title>' . $LANG['uunsubscr_metatitle'] . '</title>
        <link href="//fonts.googleapis.com/css?family=Raleway:100,200,300,400,500,600,700,800,900" rel="stylesheet" />
        <link href="' . MISCDIR . '/verify.css" media="all" rel="stylesheet" />

      </head>

  <body>
      <section class="msg">';
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        if (isset($_POST['token']) && isset($_POST['email']) && \site\utils::check_csrf($_POST['token'], 'sendunsubscr_csrf')) {
            try {
                $type = \user\main::unsubscribe(array('email' => $_POST['email']));
                if ($type == 1) {
                    echo '<div class="success">' . sprintf($LANG['uunsubscr_reqsent'], $_POST['email']) . '</div>';
                } else {
                    echo '<div class="success">' . $LANG['uunsubscr_ok'] . '</div>';
                }
            } catch (Exception $e) {
                echo '<div class="error">' . $e->getMessage() . '</div>';
            }
        }
    }
    $csrf = $_SESSION['sendunsubscr_csrf'] = \site\utils::str_random(10);
    echo '<h2 style="color: #000;">' . $LANG['uunsubscr_title'] . '</h2>
      ' . sprintf($LANG['uunsubscr_body'], '<span id="seconds">5</span>') . ' <br /><br />
      <form method="POST" action="#" autocomplete="off">
      <input type="email" name="email" value="' . (isset($_GET['email']) ? htmlspecialchars($_GET['email']) : '') . '" required />