6 |
kaklik |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/************************************************************************/
|
|
|
4 |
/* G-Shout : Gravitasi Shoutbox */
|
|
|
5 |
/* ============================================ */
|
|
|
6 |
/* */
|
|
|
7 |
/* Copyright (c) 2005 by Yohanes Pradono */
|
|
|
8 |
/* http://gravitasi.com */
|
|
|
9 |
/* */
|
|
|
10 |
/* This program is free software. You can redistribute it and/or modify */
|
|
|
11 |
/* it under the terms of the GNU General Public License as published by */
|
|
|
12 |
/* the Free Software Foundation; either version 2 of the License. */
|
|
|
13 |
/* */
|
|
|
14 |
/************************************************************************/
|
|
|
15 |
|
|
|
16 |
$version_now = "1.3.1";
|
|
|
17 |
|
|
|
18 |
if (!isset($_GET['step'])){
|
|
|
19 |
header("Location: install.php?step=1");
|
|
|
20 |
}
|
|
|
21 |
|
|
|
22 |
function timer_start() {
|
|
|
23 |
global $timestart;
|
|
|
24 |
$mtime = microtime();
|
|
|
25 |
$mtime = explode(" ",$mtime);
|
|
|
26 |
$mtime = $mtime[1] + $mtime[0];
|
|
|
27 |
$timestart = $mtime;
|
|
|
28 |
return true;
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
function timer_stop($display=0,$precision=3) { //if called like timer_stop(1), will echo $timetotal
|
|
|
32 |
global $timestart,$timeend;
|
|
|
33 |
$mtime = microtime();
|
|
|
34 |
$mtime = explode(" ",$mtime);
|
|
|
35 |
$mtime = $mtime[1] + $mtime[0];
|
|
|
36 |
$timeend = $mtime;
|
|
|
37 |
$timetotal = $timeend-$timestart;
|
|
|
38 |
if ($display)
|
|
|
39 |
echo number_format($timetotal,$precision);
|
|
|
40 |
return $timetotal;
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
//starting to count the page generation time
|
|
|
44 |
timer_start();
|
|
|
45 |
|
|
|
46 |
if ($_POST['action'] == "updatepath"){
|
|
|
47 |
|
|
|
48 |
$fp = fopen("config.php","r");
|
|
|
49 |
while (!feof($fp)){
|
|
|
50 |
$data = fgets($fp, filesize("config.php"));
|
|
|
51 |
if (substr($data,0,9) == '$datafile') {
|
|
|
52 |
$output[] = '$datafile = "'.$_POST['new_datafile']."\";\n";
|
|
|
53 |
} else if (substr($data,0,8) == '$logfile') {
|
|
|
54 |
$output[] = '$logfile = "'.$_POST['new_logfile']."\";\n";
|
|
|
55 |
} else {//nothing happened :)
|
|
|
56 |
$output[] = $data;
|
|
|
57 |
}
|
|
|
58 |
}//end while
|
|
|
59 |
fclose($fp);
|
|
|
60 |
$fp = fopen("config.php","w");
|
|
|
61 |
if($fp){
|
|
|
62 |
foreach ($output as $data){
|
|
|
63 |
fwrite ($fp, $data);
|
|
|
64 |
}
|
|
|
65 |
} else {
|
|
|
66 |
$error = _ERROR_WRITE_CONF;
|
|
|
67 |
}
|
|
|
68 |
header('Location: ?step=2');
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
if ($_POST['action'] == "ins_setpass"){
|
|
|
72 |
|
|
|
73 |
$fp = fopen("config.php","r");
|
|
|
74 |
while (!feof($fp)){
|
|
|
75 |
$data = fgets($fp, filesize("config.php"));
|
|
|
76 |
if (substr($data,0,15) == '$admin_password') {
|
|
|
77 |
$output[] = '$admin_password = "'.$_POST['ins_password']."\";\n";
|
|
|
78 |
} else if (substr($data,0,16) == '$secret_question') {
|
|
|
79 |
$output[] = '$secret_question = "'.$_POST['ins_question']."\";\n";
|
|
|
80 |
} else if (substr($data,0,14) == '$secret_answer') {
|
|
|
81 |
$output[] = '$secret_answer = "'.$_POST['ins_answer']."\";\n";
|
|
|
82 |
} else {//nothing happened :)
|
|
|
83 |
$output[] = $data;
|
|
|
84 |
}
|
|
|
85 |
}//end while
|
|
|
86 |
fclose($fp);
|
|
|
87 |
$fp = fopen("config.php","w");
|
|
|
88 |
if($fp){
|
|
|
89 |
foreach ($output as $data){
|
|
|
90 |
fwrite ($fp, $data);
|
|
|
91 |
}
|
|
|
92 |
} else {
|
|
|
93 |
$error = _ERROR_WRITE_CONF;
|
|
|
94 |
}
|
|
|
95 |
header('Location: ?step=3&updated=1');
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
|
|
|
99 |
if(is_file("config.php")){
|
|
|
100 |
include("config.php");
|
|
|
101 |
}
|
|
|
102 |
|
|
|
103 |
?>
|
|
|
104 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
105 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
|
|
106 |
<head>
|
|
|
107 |
<title>G-Shout INSTALLATION ›
|
|
|
108 |
Step <?=$_GET['step']?></title>
|
|
|
109 |
|
|
|
110 |
|
|
|
111 |
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
|
|
|
112 |
<meta name="MSSmartTagsPreventParsing" content="TRUE" />
|
|
|
113 |
<meta http-equiv="expires" content="-1" />
|
|
|
114 |
<?
|
|
|
115 |
if($SERVER_PROTOCOL == "HTTP/1.0"){
|
|
|
116 |
echo("<meta http-equiv=\"pragma\" content=\"no-cache\" />\n");
|
|
|
117 |
}else{
|
|
|
118 |
echo("<meta http-equiv=\"Cache-Control\" content=\"no-cache, must-revalidate\" />\n");
|
|
|
119 |
}
|
|
|
120 |
?>
|
|
|
121 |
|
|
|
122 |
<meta name="Generator" content="G-Shout <?=$version?>" />
|
|
|
123 |
|
|
|
124 |
|
|
|
125 |
<link rel="stylesheet" type="text/css" href="skins/default.css" />
|
|
|
126 |
|
|
|
127 |
<style type="text/css">
|
|
|
128 |
<!--
|
|
|
129 |
acronym {
|
|
|
130 |
cursor: help;
|
|
|
131 |
}
|
|
|
132 |
label {
|
|
|
133 |
cursor: pointer;
|
|
|
134 |
}
|
|
|
135 |
|
|
|
136 |
.green {
|
|
|
137 |
color: green;
|
|
|
138 |
}
|
|
|
139 |
.red{
|
|
|
140 |
color: red;
|
|
|
141 |
}
|
|
|
142 |
//-->
|
|
|
143 |
</style>
|
|
|
144 |
<script type="text/javascript">
|
|
|
145 |
<!--
|
|
|
146 |
function about(){
|
|
|
147 |
window.open('./about.php', 'About', 'width=310,height=395,location=0,menubar=0,toolbar=0,scrollbars=yes,resizable=0,status=0,screenx=245,screeny=103');
|
|
|
148 |
}
|
|
|
149 |
//-->
|
|
|
150 |
</script>
|
|
|
151 |
</head>
|
|
|
152 |
|
|
|
153 |
<body>
|
|
|
154 |
|
|
|
155 |
<div id="topBar">
|
|
|
156 |
|
|
|
157 |
<table style="width: 100%;" border="0" cellpadding="0" cellspacing="0">
|
|
|
158 |
<tbody>
|
|
|
159 |
|
|
|
160 |
<tr>
|
|
|
161 |
|
|
|
162 |
<td class="helpLinks">
|
|
|
163 |
<div class="helpLinksLeft">
|
|
|
164 |
<a href="javascript:void(0)" onclick="javascript:about()">G-Shout Installation Script</a>
|
|
|
165 |
</div>
|
|
|
166 |
</td>
|
|
|
167 |
</tr>
|
|
|
168 |
|
|
|
169 |
</tbody></table>
|
|
|
170 |
|
|
|
171 |
|
|
|
172 |
</div>
|
|
|
173 |
<div id="header"> </div>
|
|
|
174 |
|
|
|
175 |
<div id='content'>
|
|
|
176 |
<h2>Installation step <?=$_GET['step']?></h2>
|
|
|
177 |
|
|
|
178 |
<!-- langkah - langkah -->
|
|
|
179 |
|
|
|
180 |
<?
|
|
|
181 |
$flag = true;
|
|
|
182 |
if ($_GET['step'] == "1"){
|
|
|
183 |
echo "<div class='default'>Welcome to G-Shout Installation. Please read the README file first and then use this installation script.</div><br />";
|
|
|
184 |
echo "<div align='center'><a href='?step=2'>NEXT >></a></div>";
|
|
|
185 |
}else if ($_GET['step'] == "2"){
|
|
|
186 |
|
|
|
187 |
echo "<br />Checking for required files.............<br /><br />";
|
|
|
188 |
|
|
|
189 |
echo "<br /><br /><div class='default'>############## CONFIG FILE ##########################</div>";
|
|
|
190 |
|
|
|
191 |
|
|
|
192 |
echo "<br />Checking config.php file .......... ";
|
|
|
193 |
if (is_file("config.php")){
|
|
|
194 |
echo "<span class='green'>file exists</span><br />";
|
|
|
195 |
} else {
|
|
|
196 |
echo "<span class='red'>file does not exist. Rename the config_bak.php file to config.php</span><br />";
|
|
|
197 |
//set flag
|
|
|
198 |
$flag = false;
|
|
|
199 |
}
|
|
|
200 |
|
|
|
201 |
echo "<br />Checking config.php permission .......... ";
|
|
|
202 |
if (is_writable("config.php")){
|
|
|
203 |
echo "<span class='green'>writeable</span><br />";
|
|
|
204 |
} else {
|
|
|
205 |
echo "<span class='red'>config.php is not writeable, change its permission to be writeable. (CHMOD 666 config.php, if you are using *NIX OS)</span><br />";
|
|
|
206 |
//set flag
|
|
|
207 |
$flag = false;
|
|
|
208 |
}
|
|
|
209 |
|
|
|
210 |
echo "<br /><br /><div class='default'>############## SECRET DIRECTORY ##########################</div>";
|
|
|
211 |
|
|
|
212 |
echo "<br />Checking secret directory name .......... ";
|
|
|
213 |
if ($secret_dir == "_secret"){
|
|
|
214 |
echo "<span class='red'>secret directory's name is '_secret' which is default name, CHANGE IT!</span><br />";
|
|
|
215 |
//set flag
|
|
|
216 |
$flag = false;
|
|
|
217 |
} else {
|
|
|
218 |
echo "<span class='green'>secret directory's name is not '_secret' but '".$secret_dir."', good.</span><br />";
|
|
|
219 |
}
|
|
|
220 |
|
|
|
221 |
echo "<br />Checking secret directory existences .......... ";
|
|
|
222 |
if (is_dir($secret_dir)){
|
|
|
223 |
echo "<span class='green'>directory '".$secret_dir."' exists</span><br />";
|
|
|
224 |
} else {
|
|
|
225 |
echo "<span class='red'>directory '".$secret_dir."' does not exist</span><br />";
|
|
|
226 |
//set flag
|
|
|
227 |
$flag = false;
|
|
|
228 |
}
|
|
|
229 |
|
|
|
230 |
echo "<br /><br /><div class='default'>############## DATABASE FILE ##########################</div>";
|
|
|
231 |
|
|
|
232 |
echo "<br />Checking database file name .......... ";
|
|
|
233 |
if ($database == "default.dat"){
|
|
|
234 |
echo "<span class='red'>database file's name is '".$database."' which is default name, CHANGE IT!</span><br />";
|
|
|
235 |
//set flag
|
|
|
236 |
$flag = false;
|
|
|
237 |
} else {
|
|
|
238 |
echo "<span class='green'>database file's name is not 'default.dat' but '".$secret_dir."', good.</span><br />";
|
|
|
239 |
}
|
|
|
240 |
|
|
|
241 |
echo "<br />Checking database file existences .......... ";
|
|
|
242 |
if (is_file($datapath)){
|
|
|
243 |
echo "<span class='green'>database file '".$database."' exists</span><br />";
|
|
|
244 |
} else {
|
|
|
245 |
echo "<span class='red'>database file '".$database."' does not exist, make it exists!</span><br />";
|
|
|
246 |
//set flag
|
|
|
247 |
$flag = false;
|
|
|
248 |
}
|
|
|
249 |
|
|
|
250 |
echo "<br />Checking database file permission .......... ";
|
|
|
251 |
if (is_writable($datapath)){
|
|
|
252 |
echo "<span class='green'>database file '".$database."' is writeable</span><br />";
|
|
|
253 |
} else {
|
|
|
254 |
echo "<span class='red'>database file '".$database."' is NOT writeable, change its permission to be writeable. (CHMOD 666 ".$database.", if you are using *NIX OS)</span><br />";
|
|
|
255 |
//set flag
|
|
|
256 |
$flag = false;
|
|
|
257 |
}
|
|
|
258 |
|
|
|
259 |
echo "<br /><br /><div class='default'>############## LOG FILE ##########################</div>";
|
|
|
260 |
|
|
|
261 |
echo "<br />Checking log file name .......... ";
|
|
|
262 |
if ($log == "default.log"){
|
|
|
263 |
echo "<span class='red'>log file's name is '".$log."' which is default name, CHANGE IT!</span><br />";
|
|
|
264 |
//set flag
|
|
|
265 |
$flag = false;
|
|
|
266 |
} else {
|
|
|
267 |
echo "<span class='green'>log file's name is not 'default.log' but '".$log."', good.</span><br />";
|
|
|
268 |
}
|
|
|
269 |
|
|
|
270 |
echo "<br />Checking log file existence .......... ";
|
|
|
271 |
if (is_file($logpath)){
|
|
|
272 |
echo "<span class='green'>log file '".$log."' exists</span><br />";
|
|
|
273 |
} else {
|
|
|
274 |
echo "<span class='red'>log file '".$log."' does not exist, make it exists!</span><br />";
|
|
|
275 |
//set flag
|
|
|
276 |
$flag = false;
|
|
|
277 |
}
|
|
|
278 |
|
|
|
279 |
echo "<br />Checking log file permission .......... ";
|
|
|
280 |
if (is_writable($logpath)){
|
|
|
281 |
echo "<span class='green'>log file '".$log."' is writeable</span><br />";
|
|
|
282 |
} else {
|
|
|
283 |
echo "<span class='red'>log file '".$log."' is not writeable, change its permission to be writeable. (CHMOD 666 ".$log.", if you are using *NIX OS)</span><br />";
|
|
|
284 |
//set flag
|
|
|
285 |
$flag = false;
|
|
|
286 |
}
|
|
|
287 |
|
|
|
288 |
// if all OK
|
|
|
289 |
if ($flag){
|
|
|
290 |
echo "<br /><br /><div class='success' align='center'>Everything is OK. GOOD! Now we can go to next page.</div>";
|
|
|
291 |
echo "<div class='default' align='center'><a href='?step=1'><< PREVIOUS</a> | <a href='?step=3'>NEXT >></a></div>";
|
|
|
292 |
} else {
|
|
|
293 |
echo "<br /><br /><div class='alert' align='center'>There is/are error(s). Please check and fix it first before you can go to next page.</div><br />";
|
|
|
294 |
echo "<div class='default' align='center'><a href='?step=1'><< PREVIOUS</a> | NEXT >></div>";
|
|
|
295 |
}
|
|
|
296 |
|
|
|
297 |
} else if ($_GET['step'] == "3") {
|
|
|
298 |
|
|
|
299 |
echo "
|
|
|
300 |
<br /><br /><div class='alert'>Set your Password used to login.</div><br />
|
|
|
301 |
<form method='post' action='install.php'>
|
|
|
302 |
password:<br />
|
|
|
303 |
<input class='input' type='text' name='ins_password' value='".$admin_password."' size='50' /><br /><br /><br />
|
|
|
304 |
<br /><div class='alert'>Set your Secret Question and Secret Answer. Both used to display your Password if you have forgotten it.</div><br />
|
|
|
305 |
secret question:<br />
|
|
|
306 |
<input class='input' type='text' name='ins_question' value='".$secret_question."' size='50' /><br /><br />
|
|
|
307 |
secret answer:<br />
|
|
|
308 |
<input class='input' type='text' name='ins_answer' value='".$secret_answer."' size='50' /><br />
|
|
|
309 |
<input type='hidden' name='action' value='ins_setpass' />
|
|
|
310 |
<input type='submit' class='submit' value='SUBMIT' />
|
|
|
311 |
</form>
|
|
|
312 |
";
|
|
|
313 |
echo "<br /><br /><br /><div class='default' align='center'><a href='?step=1'><< PREVIOUS</a> | ";
|
|
|
314 |
if ( $_GET['updated'] == "1"){
|
|
|
315 |
echo "<a href='?step=4'>NEXT >></a>";
|
|
|
316 |
} else {
|
|
|
317 |
echo "NEXT >>";
|
|
|
318 |
|
|
|
319 |
}
|
|
|
320 |
|
|
|
321 |
} else {
|
|
|
322 |
|
|
|
323 |
echo "Installation Complete! Now you can login via <a href='admin.php'>Control Panel</a> (password: ".$admin_password.") or see <a href='iframe_demo.php'>Iframe Demo</a><br /><br />DON'T FORGET TO DELETE THIS FILE (install.php)!!!";
|
|
|
324 |
|
|
|
325 |
}
|
|
|
326 |
?>
|
|
|
327 |
|
|
|
328 |
<!-- akhir langkah - langkah -->
|
|
|
329 |
</div>
|
|
|
330 |
|
|
|
331 |
<div class='copyright'>
|
|
|
332 |
<a href='javascript:void(0)' onclick='javascript:about()'>G-Shout Installation Script</a> - Copyright © 2005 - <a href='http://gravitasi.com' target='_blank'>Gravitasi</a>
|
|
|
333 |
<br />
|
|
|
334 |
Page generated in <?=number_format(timer_stop(), 2)?> seconds
|
|
|
335 |
</div>
|
|
|
336 |
|
|
|
337 |
</body>
|
|
|
338 |
</html>
|