-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
executable file
·93 lines (83 loc) · 2.56 KB
/
index.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
93
<?php
if($sphinx->check_connection()){
include_once 'app/'. $sphinx->default();
}else{
//include_once 'app/'. $sphinx->default();
if (isset($_POST['submit'])) {
$written="<?php
include 'sphinx.php';";
$written.='
$dbhost="'.$_POST['host'].'";
$dbuser="'.$_POST['username'].'";
$dbpass="'.$_POST['password'].'";
$db="'.$_POST['database'].'";';
$written.='
$config = array(
"connect" => array($dbhost,$dbuser,$dbpass,$db),
"header" => "/",
"footer" => "/",
"default_file" => "/",
"file_include" => true
);
$sphinx = new sphinx($config);
$sphinx->file();
';
//$sphinx->create_table();
$file='system/config.php';
// Check the existence of file
if(file_exists($file)){
// Open the file for reading
$handle = fopen($file, "w") or die("ERROR: Cannot open the file.");
fwrite($handle, $written);
/* Some code to be executed */
// Closing the file handle
fclose($handle);
} else{
echo "ERROR: File does not exist.";
}
redirect($_SERVER['REQUEST_URI'],'refresh');
//header('Location: '.$_SERVER['REQUEST_URI']);
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Setup</title>
</head>
<body>
<div class="text-center" style="padding:50px 0">
<div class="logo">Wellcome To Sphinx</div>
<!-- Main Form -->
<div class="login-form-1">
<form id="login-form" class="text-left" method="post" action="#">
<div class="login-form-main-message"></div>
<div class="main-login-form">
<div class="login-group">
<div class="form-group">
<label for="" class="sr-only">host</label>
<input type="text" class="form-control" id="host" name="host" placeholder="Host Name" value="localhost">
</div>
<div class="form-group">
<label for="" class="sr-only">user</label>
<input type="text" class="form-control" id="username" name="username" placeholder="Username" value="root">
</div>
<div class="form-group">
<label for="" class="sr-only">Password</label>
<input type="password" class="form-control" id="password" name="password" placeholder="Password">
</div>
<div class="form-group">
<label for="" class="sr-only">database</label>
<input type="text" class="form-control" id="database" name="database" placeholder="Database name">
</div>
<div class="form-group">
</div>
</div>
<button type="submit" name="submit" class="login-button"><i class="fa fa-chevron-right"></i></button>
</div>
</form>
</div>
<!-- end:Main Form -->
</div>
</body>
</html>
<?php } ?>