小编use*_*650的帖子

将 SessionHandlerInterface 与 MySQL 数据库一起使用...请告知

我按照http://www.php.net/manual/en/class.sessionhandlerinterface.php制作了以下代码

和

http://www.wikihow.com/Create-a-Secure-Session-Managment-System-in-PHP-and-MySQL

这里我使用 MySQL 数据库来存储和检索会话变量。这段代码工作正常。但是,如果您能够指出错误并分享您对此代码的看法,那就太好了。

class MySessionHandler implements SessionHandlerInterface
{

    public function open($savePath, $sessionName)
    { 

   $host = 'localhost';
   $user = '******';
   $pass = '******';
   $name = '*******';
   $mysqli = new mysqli($host, $user, $pass, $name);
   $this->db = $mysqli;
   return true;

    }

    public function close()
    {
        return true;
    }

    public function read($id)
    {
        if(!isset($this->read_stmt)) {
      $this->read_stmt = $this->db->prepare("SELECT data FROM sessions WHERE id = ? LIMIT 1");
   }
   $this->read_stmt->bind_param('s', $id);
   $this->read_stmt->execute();
   $this->read_stmt->store_result();
   $this->read_stmt->bind_result($data);
   $this->read_stmt->fetch();
   $key = $this->getkey($id);
   $data = $this->decrypt($data, …
Run Code Online (Sandbox Code Playgroud)

php security

4
推荐指数
1
解决办法
2529
查看次数

冰连接状态,已完成与已连接

有人可以澄清iceConnectionstate:completed与iceConnectionstate:connected之间的区别。

当我使用 webrtc 连接到浏览器时,我能够使用数据通道交换数据,但由于某种原因,浏览器上的 iceConnectionstate 使报价扩孔完成,其中接受报价的浏览器更改为连接。

知道这是否正常吗?

webrtc

4
推荐指数
2
解决办法
4138
查看次数

标签 统计

php ×1

security ×1

webrtc ×1