Пример #1
0
<?php

require "/var/www/html/classes/_autoloader.php";
use Telecube\Config;
use Telecube\Db;
$Config = new Config();
$Db = new Db();
$x = 0;
while ($x <= 10) {
    try {
        $dbPDO = new PDO('mysql:dbname=' . $Config->get("db_name") . ';host=' . $Config->get("db_host") . ';port=' . $Config->get("db_port"), $Config->get("db_user"), $Config->get("db_pass"));
        break;
    } catch (PDOException $ex) {
        //exit( 'Connection failed: ' . $ex->getMessage() );
        echo 'Connection failed: ' . $ex->getMessage();
        $x++;
        sleep(3);
    }
}
$dbPDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$q = "select * from preferences where name LIKE 'fw_%';";
$data = array();
$res = $Db->pdo_query($q, $data, $dbPDO);
#Flush all existing chains
$addrule = `sudo /sbin/iptables --flush`;
#Allow traffic on loopback
$addrule = `sudo /sbin/iptables -A INPUT -i lo -j ACCEPT`;
$addrule = `sudo /sbin/iptables -A OUTPUT -o lo -j ACCEPT`;
# allow established connections
$addrule = `sudo /sbin/iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT`;
#Allow traffic on localhost
Пример #2
0
<?php

require "classes/_autoloader.php";
use Telecube\Config;
$Config = new Config();
session_name($Config->get("session_name"));
session_start();
session_unset();
session_destroy();
header("Location: /");