Files
2025-12-24 19:19:01 +03:00

44 lines
1.1 KiB
PHP

<?php
class Password {
public string $name;
public array $params;
public $content = "";
public function __construct($params = array())
{
$this->params = $params;
}
public function set_content($content)
{
$this->content = $content;
}
public function set_name($name)
{
$this->name = $name;
}
public function render_edit()
{
global $b;
$input_dom = new DOM("input");
$input_dom->setAttribute("type", "password");
$input_dom->setAttribute("name", $this->name);
$input_dom->setAttribute("placeholder", "Оставьте пустым чтобы не вносить изменения");
$input_dom->setAttribute("value", $b->get_view($this->content));
$input_dom->view();
}
public function render_value()
{
return "";
}
public function render_db_value($old_value)
{
if($this->content == "ЗАШИФРОВАНО") return $old_value;
return password_hash($this->content, PASSWORD_DEFAULT);
}
}