<?php
$query = 'select * from `wd_pz_settings` where `code`="sitename" || `code`="sitelogo"';
$rs = $GLOBALS['db']->Query($query);
$GLOBALS['dbrequests']++;
if(!$rs->EOF) {
    foreach($rs as $row) $pzoneSettings[$row['code']] = $row;
}
$_SESSION['sitename'] = $siteName = !empty($pzoneSettings['sitename']['svalue'])?$pzoneSettings['sitename']['svalue']:MT_SITETITLE;
$siteLogo = !empty($pzoneSettings['sitelogo']['svalue'])?$pzoneSettings['sitelogo']['svalue']
            :(($logo=$GLOBALS['Auth']->getSetting('Aff_style_logo_url')) != '' ? $logo : $this->a_this->getImage('web_logo.gif'));
define('FINAL_SITELOGO',$siteLogo);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta content="Marketools Inc." name="Copyright" />
<title><?php echo $_SESSION['sitename']; ?></title>
<link type="text/css" rel="stylesheet" media="all" href="../templates/affiliate/default/css/login.css" />
<!--[if lt IE 7]>
<style type="text/css">img, div{ behavior: url(../templates/affiliate/default/css/iepngfix.htc);}</style>
<![endif]-->
</head>

<body id="login">
    <div id="wrappertop"></div>
        <div id="wrapper">
                <div id="content">
                    <div id="header">
                        <h1><a href="index.php"><img src="<?php echo QUnit_UI_TemplatePage::getImage('login_logo.gif'); ?>" title="<?php echo PROG_NAME,POSTGLOBAL_VERSION;?>" alt="<?php echo PROG_NAME,POSTGLOBAL_VERSION;?>"></a></h1>
                    </div>
                    <form style="clear:both;" name="loginform" method="post" action="index.php">
                    <fieldset class="form">
<?php
    if(!empty($this->a_this->errorMessages) && is_array($this->a_this->errorMessages)) {
        echo '<p class="error">'.join('<br />',$this->a_this->errorMessages).'</p>';
    }
?>
                        <p>
                            <label for="user_name"><?php echo L_G_USERNAME2; ?>：</label>
                            <input name="username" id="user_name" type="text" value="<?php echo $_REQUEST['username']?>" />
                        </p>
                        <p>
                            <label for="user_password"><?php echo L_G_PASSWORD; ?>：</label>
                            <input name="rpassword" id="user_password" type="password" />
                        </p>

<?php if($this->a_Auth->getSetting('Aff_allow_choose_lang') == 1) { ?>
  <p>
    <label for="user_lang"><?php echo L_G_LANGUAGE; ?>：</label>
      <select id="user_lang" name=lang>
<?php
      $selectedLang = $_POST['lang'];
      if($selectedLang == '')
        $selectedLang = $this->a_Auth->getSetting('Aff_default_lang');

      while($data=$this->a_list_data->getNextRecord()) { ?>
        <option value="<?php echo $data?>" <?php echo ($selectedLang == $data ? 'selected' : '')?>><?php echo $data?></option>
<?php    } ?>
      </select>
  </p>
<?php } else { ?>
    <input type=hidden name=lang value="<?php echo $this->a_Auth->getSetting('Aff_default_lang')?>">
<?php } ?>

                        <button type="submit" class="positive" name="Submit">
                            <img src="<?php echo QUnit_UI_TemplatePage::getImage('key.png'); ?>" alt="Announcement"/><?php echo L_G_LOGIN; ?></button>
                            <ul id="forgottenpassword">
                            <li class="boldtext">|</li>
                            <li><a href="forgot_password.php"><?php echo L_G_FORGOTPASSWORD; ?></a></li>
                        </ul>
                    </fieldset>
                      <input type="hidden" name="commited" value="yes">
                      <input type="hidden" name="md" value="QCore_Login">
                      <input type="hidden" name="query_string" value='<?php echo ($_SERVER["QUERY_STRING"] != '') ? $_SERVER["QUERY_STRING"] : ''?>'>
                      <input type="hidden" name="accountid" value='default1'>
                      <input type="hidden" name=action value=<?php echo $_POST['action']?>>
                    </form>
                </div>
            </div>

        <div id="wrapperbottom_branding"><div id="wrapperbottom_branding_text">
            By <a href="http://www.marketools.cn" target="_blank">Marketools</a>.
            Copyright &copy 2007-<?php echo date('Y'); ?>, <a href="../">Home Page!</a>
        </div></div>

    </body>
</html>
