-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathindex.php
More file actions
58 lines (53 loc) · 1.61 KB
/
index.php
File metadata and controls
58 lines (53 loc) · 1.61 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
<?php
$error = "";
$result = "";
if (isset($_GET['submit'])) {
if (isset($_GET['needle']) && isset($_GET['haystack']) && isset($_GET['replacement'])) {
$result = preg_replace('/' . $_GET['needle'], $_GET['replacement'], $_GET['haystack']);
}
}
?>
<html>
<head>
<title></title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
</head>
<body>
<section>
<div class="card mt-5" style="width: 48rem; margin: auto;">
<div class="card-body">
<h1>PRO Replacer</h1>
<?php if ($error != ''): ?>
<div class="alert alert-danger" role="alert">
<?php echo $error; ?>
</div>
<?php endif; ?>
<form method="GET">
<div class="form-group">
<label for="needle">Needle</label>
<input type="text" name="needle" class="form-control" id="needle">
</div>
<div class="form-group">
<label for="replacement">Replacement</label>
<input type="text" name="replacement" class="form-control" id="replacement">
</div>
<div class="form-group">
<label for="haystack">Haystack</label>
<textarea name="haystack" class="form-control" id="haystack"></textarea>
</div>
<input type="submit" class="btn btn-primary" name="submit" value="Replace" />
</form>
<?php if ($result != ''): ?>
<div class="card mt-3">
<div class="card-body">
<h3>Result</h3>
<hr />
<p><?php echo $result; ?></p>
</div>
</div>
<?php endif; ?>
</div>
</div>
</section>
</body>
</html>