-
Notifications
You must be signed in to change notification settings - Fork 0
/
hostgen.php
92 lines (66 loc) · 1.28 KB
/
hostgen.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
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
<?php
if(isset($_GET['mode']))
{
switch($_GET['mode'])
{
case 'showHost':
showHost($_GET);
break;
default:
showForm();
break;
}
}
else
{
showForm();
}
function showHost($data)
{
if(isset($data['host']))
{
$host = $data['host'];
$template = <<< TEMP
## $host ##
<VirtualHost *:80>
ServerName $host
ServerAlias www.$host
DocumentRoot "C:/xampp/htdocs/$host"
SetEnv APPLICATION_ENV "development"
ErrorLog "logs/$host-error.log"
CustomLog "logs/$host-access.log" combined
<Directory "C:/xampp/htdocs/$host">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
TEMP;
echo "<pre>";
echo '<a href="/">nochmal</a><br />';
echo htmlentities($template, ENT_QUOTES);
echo "127.0.0.1 $host";
echo "<br />";
echo "127.0.0.1 www.$host";
echo "</pre>";
}
else
{
return false;
}
}
function showForm()
{
$action = $_SERVER['PHP_SELF'];
$form = <<< FORMT
<form action="$action" method="get">
<input type="text" name="host" id="host" />
<input type="hidden" name="mode" value="showHost" />
<input type="submit" class="submit" value="erstellen" />
</form>
<form
FORMT;
echo $form;
}
?>