-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchange-bg.php
121 lines (100 loc) · 2.8 KB
/
change-bg.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-size: 1rem;
background-color: white;
}
.cont {
background-color: white;
max-width: 300px;
max-height: 350px;
margin: 15px;
padding: 20px;
border: 1px solid #252525;
}
.sp {
height: 10px;
}
.color {
font-size: 1.1rem;
outline: none;
border: none;
border-bottom: 1px solid black;
color: rgb(25, 25, 25);
;
}
.btn {
padding: 8px 20px 8px 20px;
border: none;
outline: none;
font-size: 1.1rem;
background-color: #252525;
color: white;
transition: 0.3s;
}
.btn:hover {
padding: 9px 21px 9px 21px;
font-size: 1rem;
background-color: white;
color: #252525;
border: 2px solid #252525;
border-radius: 10px 10px;
}
span{
color: red;
}
</style>
</head>
<body>
<!--code by sohel-->
<?php
$namecolor = array("green", "red", "yellow", "black", "pink", "orange","blue");
$arysize = sizeof($namecolor) - 1;
$ret = false;
$span = "";
if (isset($_POST["submit"])) {
if (isset($_POST["box"])) {
$box = $_POST["box"];
} else {
$box = "off";
}
if (empty($_POST["color"])) {
$span = "please Enter any color name";
} else {
$color = $_POST["color"];
if ($box == "off") {
for ($i = 0; $i <= $arysize; $i++) {
if ($color == $namecolor[$i]) {
echo "<style> body{ background-color: $namecolor[$i]; } </style>";
$ret = true;
}
}
if ($ret != true) {
$span = "Color Name Not Found in Array list";
}
} else {
echo "<style> body{ background-color: $color; } </style>";
}
}
}
?>
<center>
<div class="cont">
<form action="loper.php" method="POST">
<input type="text" name="color" class="color" placeholder="enter your color name">
<br>
<div class="sp"></div>
if use custom color :
<input type="checkbox" class="box" name="box">
<div class="sp"></div>
<br>
<input type="submit" name="submit" class="btn" value="set bg">
</form>
<br>
<span><?php echo "$span"; ?></span>
</div>
</center>
</body>
</html>