-
Notifications
You must be signed in to change notification settings - Fork 0
/
New Message.php
74 lines (67 loc) · 1.93 KB
/
New Message.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
<?php
include "connect.php";
if(isset($_POST['btn-login']))
{
$Sub=$_POST['Sub'];
$Message=$_POST['Message'];
date_default_timezone_set('Asia/Calcutta');
$datetime = date("Y-m-d h:i:sa");
$Sendername = implode(mysqli_fetch_assoc(mysqli_query($mysqli,"select ID from admin where Ausername='admin' and Apassword='admin'")));
if ($mysqli->query("INSERT into inbox(Sendername,datetime,Sub,Message) values ('$Sendername','$datetime','$Sub','$Message')") === TRUE)
{
if(empty($_FILES["image"]["tmp_name"]))
{
}
else{
$check = getimagesize($_FILES["image"]["tmp_name"]);
if($check !== false){
$image = $_FILES['image']['tmp_name'];
$imgContent = addslashes(file_get_contents($image));
$mysqli->query("UPDATE inbox set Photo='$imgContent' where Message='$Message'");
}
}
$err = "<b>Your Message Has Been Sent.</b></br>";
}
else
{
$err = "<b>Your Message Has Not Sent.</b></br>";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php
//Turn off
error_reporting(0);
include "Head.php";
?>
</head>
<body>
<?php
//Turn off
error_reporting(0);
include "AHeader.php";
?>
<br/>
<div class="container">
<div class="row">
<div class="contact2-caption clearfix">
<div class="contact2-heading text-center">
<h2>Compose New Message</h2>
</div>
<center><font size="3"><?php echo @$err;?></font></center>
<div class="col-md-6 col-md-offset-1 contact2-form">
<form class="form" action="" method="post" enctype="multipart/form-data">
<input type="text" placeholder="Subject" name="Sub" required>
<textarea placeholder="Message" name="Message" required></textarea>
<input type="file" placeholder="Photo" name="image">
<input class="submit-btn" type="submit" value="SEND" name="btn-login">
</form>
</div>
</div>
</div>
</div>
</section><!-- end of contact section -->
</body>
</html>