-
Notifications
You must be signed in to change notification settings - Fork 3
/
message.php
121 lines (111 loc) · 3.37 KB
/
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
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
<?php
session_start();
include("header.php");
include("dbconnection.php");
if(isset($_SESSION[loginid]))
{
$sentto = $_SESSION[loginid];
}
else
{
$sentto = $_SESSION[login];
}
$dttim = date("Y-m-d h:i:s");
$result = mysql_query("SELECT * FROM employees");
if(isset($_POST["sendmesage"]))
{
$insdb ="INSERT INTO message(senderid,receiverid,msgtitle,msg,datetime) VALUES
('$sentto','$_POST[senderid]','$_POST[subject]','$_POST[message]','$dttim')";
mysql_query($insdb,$con);
if(mysql_affected_rows() == 1)
{
$msgres ="Message Sent successfully...";
}
}
?>
<div id="templatemo_content">
<div id="templatemo_content_left">
<div class="header_02">Compose Message</div>
<p class="bi_para"><a href="inbox.php"><strong> View Message</strong></a> <?php echo $msgres; ?></p>
<form id="form1" name="form1" method="post" action="">
<table width="500" border="0">
<tr>
<th height="41" scope="col">
<?php
if(isset($_POST["messageid"]))
{
echo "<label for='to2'>Reply to:</label>";
}
else
{
echo "<label for='to2'>TO:</label>";
}
?>
<label for="subject2"></label></th>
<th scope="col" align="left">
<?php
if(isset($_POST["messageid"]))
{
echo $_POST["senderid"];
echo "<input name='senderid' type='hidden' value='$_POST[senderid]' />";
}
else
{
?>
<select name="senderid" id="to">
<option> Select Employee</option>
<?php
while($row = mysql_fetch_array($result))
{
echo "<option value='". $row['loginid'] . "'>" . $row['loginid'] ."</option>";
}
?>
</select>
<?php
}
?>
</th>
</tr>
<tr>
<td><label for="subject3">Subject:</label>
<label for="message2"></label></td>
<td><input name="subject" type="text" id="subject" value="" size="40" /></td>
</tr>
<tr>
<td><label for="message3">Message</label></td>
<td><textarea name="message" id="message" cols="45" rows="5"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="sendmesage" id="sendmesage" value="Send Message" />
<input type="submit" name="cancel" id="cancel" value="Cancel" /></td>
</tr>
</table>
<br>
</form>
<p> </p>
<div class="rc_btn_02"></div>
<div class="margin_bottom_40"></div>
<div class="cleaner"></div>
</div> <!-- end of content left -->
<div id="templatemo_content_right">
<div class="content_right_section">
<?php
if($_SESSION["logintype"] = "Admin")
{
include("adminsidebar.php");
}
else
{
include("empsidebar.php");
}
?>
<div class="margin_bottom_20"></div>
<a href="http://jigsaw.w3.org/css-validator/check/referer"></a>
</div>
</div> <!-- end of content right -->
<div class="cleaner"></div>
</div>
<?php
include("footer.php");
?>