-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcdnize.php
51 lines (39 loc) · 1.36 KB
/
cdnize.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?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.
*/
include 'dbconnection.php';
include 'inc/restcontroller/restcontroller.php';
echo "includes";
echo $_CONTROLLERURI;
$restcont = new restController($_CONTROLLERURI);
echo "restcont";
$query = mysql_query("SELECT INET_NTOA(ip_address) as ip FROM request_router")
or die('mysql error' . mysql_error());
$rrouters = array();
while($row = mysql_fetch_array($query)) {
$rrouters[] = $row['ip'];
}
$query = mysql_query("SELECT INET_NTOA(prefix) as prefix, INET_NTOA(mask) as mask, "
. "INET_NTOA(ip_address) as seip FROM `routing` "
. "JOIN streaming_engine ON streaming_engine.streaming_engine_id = routing.streaming_engine_id") or die('mysql error' . mysql_error());
$routes = array();
while($row = mysql_fetch_array($query)) {
$routes[] = array(
'prefix' => $row['prefix'],
'mask' => $row['mask'],
'seip' => $row['seip']
);
}
foreach($rrouters as $rr) {
$restcont->postRequestRouter($rr, $_GET['switchid']);
}
echo "posts";
foreach($routes as $rr) {
$restcont->postCDNRoute($rr['prefix'], $rr['mask'], $rr['seip'], $_GET['switchid']);
}
echo "posts";
?>
<h3>Request router and routes loaded to switch</h3>