<?php
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);

$mysql_user	= 'mysql_user';
$mysql_pass	= 'mysql_password';

$db = new PDO('mysql:host=127.0.0.1;dbname=certalertbot;charset=utf8mb4', $mysql_user, $mysql_pass);

$stmt = $db->prepare("SELECT id, chatid, type, value FROM rules");
$stmt->execute();
$rules = $stmt->fetchAll(PDO::FETCH_ASSOC);

foreach ($rules as $rule) {
	$toadd = array();
	$id = $rule["id"];
	$toadd["id"] = $id;
	$toadd["value"] = array("t" => $rule["type"], "v" => $rule["value"], "c" => $rule["chatid"]);
	$toadd = json_encode($toadd, JSON_NUMERIC_CHECK);
	$redis->rPush('toadd', $toadd);
}	
