-
Notifications
You must be signed in to change notification settings - Fork 0
/
Home.php
326 lines (297 loc) · 9.37 KB
/
Home.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
<!DOCTYPE html>
<html>
<head>
<style>
#container{
height: 1000px;
width: 1200px;
margin: auto;
margin-top: 10px;
}
.menu{
background:url(MenuBackground.jpg);
height: 130px;
}
.menu div{
width:900px;
overflow:hidden;
margin:auto;
position:relative;
}
.menu #nm{
width: 200px;
margin-left: 200px;
text-align: center;
color: green;
float: left;
}
.menu #nm a{
color: green;
text-decoration: none;
}
#lpart{
background-color: yellowgreen;
height: 170px;
width: 250px;
float: left;
}
#mpart{
height: 950px;
width: 700px;
float: left;
}
#rpart{
background-color: yellowgreen;
height: 170px;
width: 250px;
float: left;
}
.menu #pages{
list-style: none;
position: relative;
margin-top: 80px;
color: white;
left: 130px;
}
.menu #pages li{
display: inline;
margin: 5px;
padding: 15px;
}
.menu #pages a{
color: white;
text-decoration: none;
text-shadow:3px 3px 1px black;
}
.menu #pages li a:hover , .menu #pages li#select a{
color: yellow;
}
body{
background-image: url("BodyBackgroundImage.jpg");
background-attachment: fixed;
}
#PicSection{
background-image: url("PicSection.jpg");
height:370px;
}
#PicSection p{
color: white;
text-align:left;
padding-left: 127px;
padding-top: 13px;
margin: 0px;
font-size:25px;
text-shadow:2px 1px 1px black;
}
#PicSection h2{
color: white;
text-align:left;
padding-left: 127px;
padding-top: 13px;
margin: 0px;
font-size: 30px;
text-shadow:2px 1px 1px black;
}
</style>
</head>
<?php session_start();?>
<body>
<div id="container">
<div class="menu">
<div style="height: 15px"></div>
<div id="nm"> <a href="Home.php"> <h1> Go Green <br> <h3 style="color: white"> Save Trees Plant Trees </h3> </h1> </a> </div>
<ol id="pages">
<h3>
<li id="select"> <a href="Home.php"> Home </a></li>
<li> <a href="Plants.php"> Plants </a> </li>
<li> <a href="LoginPage.php"> SignUp </a> </li>
<li> <a href="Contact.php"> Contact </a> </li>
</h3>
</ol>
</div>
<div id="PicSection">
<p> <br> You Don’t Know What You’ve Got <br> ‘Till It’s Gone.</p>
<h2> <br> Plant A Tree. <br> Grow A Tree. <br> <span style="color: yellow;font-size: 34px;"> Save The Future. </span> </h2>
</div>
<br>
<div id="lpart">
<center style="margin-top: 5px;color: white;text-shadow:2px 1px 1px black;"> Login: </center>
<div style="height: 170px;width: 215px;margin-left: 10px;margin-top: 10px">
<form method="post" action="<?php $_PHP_SELF ?>">
Email<br><input type="email" name="Login_Email" id="Login_Email"><span id="span_email"></span><br>
Password<br><input type="password" name="Login_Password" id="Login_Password"><span id="span_password"></span><br><br>
<input type="submit" name="Subs" value="Login" onclick="return login_validate()">
<a href="LoginPage.php"><input type="button" name="" value="Sign Up"></a>
</form>
</div>
</div>
<div id="mpart">
<div style="float: left;width: 625px;height: 950px;margin-left: 35px;">
<h1 align="center"> "One touch of nature makes the whole world kin." </h1>
<h3 align="center"> ― William Shakespeare </h3>
<h1 align="center"> "The care of the Earth is our most ancient and most worthy, and after all, our most pleasing responsibility." </h1>
<h3 align="center"> ― Wendell Berry </h3>
<h1 align="center"> "A nation that destroys its soils destroys itself. Forests are the lungs of our land, purifying the air and giving fresh strength to our people." </h1>
<h3 align="center"> ― Franklin D. Roosevelt </h3>
<h1 align="center"> "Someone's sitting in the shade today because someone planted a tree a long time ago." </h1>
<h3 align="center"> ― Warren Buffett </h3> <br>
<p>
<h3>Our resources finite,Our need for those resources infinite.
<br>Plantating the trees and nurturing them is one of the most important constituents and criteria that should be made a priority.
<br></h3>
</p>
</div>
</div>
<div id="rpart">
<center style="margin-top: 5px;color: white;text-shadow:2px 1px 1px black;"> Subscribe: </center>
<div style="height: 170px;width: 220px;margin-left: 18px;margin-top: 10px">
<form method="post" action="<?php $_PHP_SELF ?>">
Your Name<br> <input type="text" name="Subscibe_Name" id="Subscibe_Name"><span id="span_subs_nm"></span><br>
Your Email<br><input type="email" name="Subscribe_Email" id="Subscribe_Email"><span id="span_subs_mail"></span><br>
<input type="checkbox" name="pri_policy" id="pri_policy">I accept privacy policy <span id="span_subs_policy"></span><br>
<input type="submit" name="Subs" value="Subscribe" onclick="return subscribe_validate()">
</form>
</div>
</div>
</div>
<script>
function login_validate()
{
var mail=document.getElementById('Login_Email');
var pass=document.getElementById('Login_Password');
if(mail.value.trim()==="")
{
var span_email=document.getElementById('span_email');
span_email.innerHTML="Enter";
span_email.style.color="red";
mail.focus();
return false;
}
if(pass.value.trim()==="")
{
var span_password=document.getElementById("span_password");
span_password.innerHTML="Enter";
span_password.style.color="red";
pass.focus();
return false;
}
}
function subscribe_validate()
{
var subs_mail=document.getElementById('Subscribe_Email');
var subs_policy=document.getElementById('pri_policy');
if(subs_mail.value.trim()==="")
{
var span_subs_mail=document.getElementById("span_subs_mail");
span_subs_mail.innerHTML="Enter";
span_subs_mail.style.color="red";
subs_mail.focus();
return false;
}
else
{
var regu=/^\w+([\._]?\w+)*@\w+([\._]?\w+)*(\.\w{2,3})+$/;
if(regu.test(subs_mail.value))
{
var span_subs_mail=document.getElementById('span_subs_mail');
span_subs_mail.innerHTML="Valid";
span_subs_mail.style.color="white";
}
else
{
var span_subs_mail=document.getElementById('span_subs_mail');
span_subs_mail.innerHTML="InValid";
span_subs_mail.style.color="red";
subs_mail.focus();
return false;
}
}
if(subs_policy.checked===false)
{
var span_subs_policy=document.getElementById('span_subs_policy');
span_subs_policy.innerHTML="Select";
span_subs_policy.style.color="red";
return false;
}
}
</script>
</body>
</html>
<?php
$servername="localhost";
$username="root";
$password="animeshroot@123";
$DBName="Plantation";
$conn=new mysqli($servername, $username , $password, $DBName);
if($conn->connect_error)
{
die("Connection Failed: ".$conn->connect_error);
}
if (isset($_POST['Login_Email']))
{
$ma_il = $_POST['Login_Email'];
$pa_ss = $_POST['Login_Password'];
$temp=0;
}
if(!empty($ma_il))
{
if (!empty($pa_ss)) {
# code...
$temp=1;
}
}
else
$temp=0;
if($temp==1)
{
$sql="SELECT * FROM User_Info WHERE User_Email='$ma_il' AND User_Password='$pa_ss'";
$result=$conn->query($sql);
if ($result -> num_rows > 0)
{
$_SESSION['LOGIN']=1;
echo '<script>';
echo 'alert("Logged In!!")';
echo '</script>';
}
else
{
echo '<script>';
echo 'alert("Not the user!!")';
echo '</script>';
}
}
elseif ($temp==0) {
# code...
#echo "empty";
}
$conn->close();
?>
<?php
$servername="localhost";
$username="root";
$password="animeshroot@123";
$DBName="Plantation";
$conn=new mysqli($servername, $username , $password, $DBName);
if($conn->connect_error)
{
die("Connection Failed: ".$conn->connect_error);
}
if (isset($_POST['Subscribe_Email']))
{
$su_name = $_POST['Subscibe_Name'];
$su_mail = $_POST['Subscribe_Email'];
$sql="INSERT INTO User_Subscribe (Subs_Name,Subs_Email) VALUES ('$su_name','$su_mail')";
$result=$conn->query($sql);
if ($result === TRUE)
{
echo '<script>';
echo 'alert("Thank You For Following Newsletter!!")';
echo '</script>';
}
else
{
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
$conn->close();
?>