Repository navigation
Expand file tree
/
Copy pathDHCP-change-A.php
More file actions
95 lines (72 loc) · 2.92 KB
/
Copy pathDHCP-change-A.php
File metadata and controls
95 lines (72 loc) · 2.92 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
echo "<html>";
echo "<head>";
echo "<title>AutoNet\\ DCHP Scope Generator change for A</title>";
echo "</head>";
echo "<body bgcolor=#009999 lang=EN-US style='tab-interval:.5in'>";
echo "<P fontsize=15 align=center>";
echo " AutoNet\\ DCHP Scope change for A </p>";
echo "<br>";
$host="127.0.0.1";
$user="root";
$password="rezasql";
# Connect to MySQL server
$conn = mysql_connect($host,$user,$password)
or die(mysql_error());
# Select the database
mysql_select_db("", $conn)
or die(mysql_error());
# Send SQL query
$sql="select bld_newname,new_name, left(new_name,1) as flr, lo , right(lo,1) as my_id";
$sql=$sql." from ftr where ";
$sql=$sql."bld_newname not in ('A11','E2') and bld_newname like 'A%' order by 1";
// echo "<BR> $sql<BR>";
$result = mysql_query($sql)
or die(mysql_error());
while ($row=mysql_fetch_assoc($result)) {
$bld=$row['bld_newname'];
$flr=$row['flr'];
$new_name=$row['new_name'];
$lo=$row['lo'];
$supernet=substr($lo,0,7);
//$my_id=$row['my_id'];
//10.111.99.1
$my_id=substr($lo,10,2);
// echo "<BR> SubStr is " . substr($bld,0,1) . "!<BR>";
// echo "<BR> SuperNet is $supernet!<BR>";
// echo "<BR> MY ID is $my_id!<BR>";
if (substr($bld,0,1)=='A') $type='HOSTEL';
if (substr($bld,0,1)=='B') $type='VILLAGE';
if (substr($bld,0,1)=='C') $type='ACADEMICS';
if (substr($bld,0,1)=='E') $type='LABS';
/* Fixing Wireless Controller Domains */
if (substr($bld,0,2)=='A1') $wlc='a.wlc1.ap..ac.ae';
if (substr($bld,0,2)=='A2') $wlc='a.wlc1.ap..ac.ae';
if (substr($bld,0,2)=='A3') $wlc='a.wlc1.ap..ac.ae';
if (substr($bld,0,2)=='A4') $wlc='a.wlc1.ap..ac.ae';
if (substr($bld,0,2)=='A5') $wlc='a.wlc2.ap..ac.ae';
if (substr($bld,0,2)=='A6') $wlc='a.wlc2.ap..ac.ae';
if (substr($bld,0,2)=='A7') $wlc='a.wlc2.ap..ac.ae';
if (substr($bld,0,2)=='A8') $wlc='a.wlc2.ap..ac.ae';
if (substr($bld,0,2)=='A9') $wlc='a.wlc3.ap..ac.ae';
if (substr($bld,0,2)=='A10') $wlc='a.wlc3.ap..ac.ae';
if (substr($bld,0,2)=='A11') $wlc='a.wlc3.ap..ac.ae';
if (substr($bld,0,1)=='B') $wlc='b.wlc1.ap..ac.ae';
if (substr($bld,0,2)=='C1') $wlc='c.wlc1.ap..ac.ae';
if (substr($bld,0,2)=='C5') $wlc='c.wlc2.ap..ac.ae';
if (substr($bld,0,2)=='C4') $wlc='c.wlc3.ap..ac.ae';
if (substr($bld,0,2)=='C6') $wlc='c.wlc3.ap..ac.ae';
if (substr($bld,0,2)=='E2') $wlc='e.wlc1.ap..ac.ae';
if (substr($bld,0,2)=='E3') $wlc='e.wlc2.ap..ac.ae';
if (substr($bld,0,2)=='E4') $wlc='e.wlc1.ap..ac.ae';
if (substr($bld,0,2)=='E5') $wlc='e.wlc2.ap..ac.ae';
if (substr($bld,0,2)=='E6') $wlc='e.wlc1.ap..ac.ae';
if (substr($bld,0,2)=='E7') $wlc='e.wlc2.ap..ac.ae';
// echo "<BR><font color=green size=10> Working on Building $bld FTR $new_name , Floor: $flr</font><BR>";
// echo "<BR>";
// echo "<BR><B> Wireless AP POOL </B><BR>";
echo "<BR>";
echo "Dhcp Server 10.90.192.100 Scope ".$supernet.$my_id."1.0 set optionvalue 15 STRING $wlc";
echo "<BR>";
}// While
?>