public function getHtml()
 {
     $auth = new PayqrModuleAuth();
     $auth->authenticate();
     $html = "<div id='auth_form'>    \n                    <form method='post'>\n                        <div>Вход в систему</div>\n                        <div><label>Логин: <input type='text' name='username'/></label></div>\n                        <div><label>Пароль: <input type='password' name='password'/></label></div>\n                        <div><input type='submit' value='Отправить'/></div>\n                    </form>\n                </div>";
     return $html;
 }
 public function getLogUrl()
 {
     $url = "";
     $auth = new PayqrModuleAuth();
     if ($user = $auth->getUser()) {
         $url = PayqrModule::getBaseUrl() . "/log.php?user_id={$user->user_id}&key={$this->log_key}";
     }
     return $url;
 }
 public function getHtml()
 {
     $auth = new PayqrModuleAuth();
     if (isset($_POST["exit"])) {
         $auth->logOut();
     }
     $user = $auth->getUser();
     if ($user) {
         $button = new PayqrButtonPage($user);
         if (isset($_POST["PayqrSettings"])) {
             $button->save($_POST["PayqrSettings"]);
         }
         $html = $button->getHtml();
         return $html;
     }
 }
 public function register($post)
 {
     if ($post["password"] != $post["password_repeat"]) {
         return "Пароли не совпадают";
     }
     $db = PayqrModuleDb::getInstance();
     $user = $db->select("select * from " . PayqrModuleDb::getUserTable() . " where username = ?", array($post["username"]), array("s"));
     if ($user) {
         return "Пользователь с таким именем уже существует";
     }
     $auth = new PayqrModuleAuth();
     $password = $auth->encodePassword($post["password"]);
     $id = $db->insert(PayqrModuleDb::getUserTable(), array("username" => $post["username"], "password" => $password), array("%s", "%s"));
     $auth = new PayqrModuleAuth($id);
     PayqrModule::redirect("auth");
 }
Example #5
0
 private function setOptions()
 {
     $db = PayqrModuleDb::getInstance();
     $auth = new PayqrModuleAuth();
     $user = $auth->getUser();
     if ($user) {
         $query = "select settings from " . PayqrModuleDb::getUserTable() . " where user_id={$user->user_id}";
     } else {
         $query = "select settings from " . PayqrModuleDb::getUserTable() . " limit 1";
     }
     $result = $db->query($query);
     if ($settings = json_decode($result->settings)) {
         foreach ($settings as $item) {
             $this->options[$item->key] = $item->value;
         }
     }
 }
Example #6
0
 public function show()
 {
     //вызываем функционал библиотеки PayQR
     require_once __DIR__ . '/../../../payqr/PayqrConfig.php';
     $auth = new PayqrModuleAuth(1);
     $user = $auth->getUser();
     if ($user) {
         $html = '<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>';
         if (is_file(__DIR__ . '/js/button.js')) {
             $html .= file_get_contents(__DIR__ . '/js/button.js');
         }
         if (is_file(__DIR__ . '/css/buttonstyle.css')) {
             $html .= file_get_contents(__DIR__ . '/css/buttonstyle.css');
         }
         $button = new PayqrButtonPage($user);
         if (isset($_POST["PayqrSettings"])) {
             $button->save($_POST["PayqrSettings"]);
         }
         $html .= $button->getHtml();
         echo $html;
     }
 }
Example #7
0
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require_once __DIR__ . '/../../PayqrConfig.php';
$auth = new PayqrModuleAuth();
$auth->authenticate();
?>

<div id="form">    
    <form method="post">
        <div>Вход в систему</div>
        <div><label>Логин: <input type="text" name="username"/></label></div>
        <div><label>Пароль: <input type="password" name="password"/></label></div>
        <div><input type="submit" value="Отправить"/></div>
    </form>
</div>

<style>
    #form
    {
        margin: 20% 50%;
        width: 200px;
        height: 200px;
    }
    #form div
    {
        margin: 10px 20px;
Example #8
0
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require_once __DIR__ . '/../../PayqrConfig.php';
$auth = new PayqrModuleAuth();
if (isset($_POST["exit"])) {
    $auth->logOut();
}
$user = $auth->getUser();
if ($user) {
    $button = new PayqrButtonPage($user);
    if (isset($_POST["PayqrSettings"])) {
        $button->save($_POST["PayqrSettings"]);
    }
    $html = $button->getHtml();
    echo $html;
}
?>

<style>
    .row
    {
        margin: 5px 0;
    }
    label
    {
        font-weight: bold;