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
|
<html>
<head>
<title>Üzenőfal!</title>
<style type="text/css">
<!--
.message {
color: #000000;
font-family: Verdana;
font-size: 10px;}
.username {
color: #FF9900
font-family: Verdana;
font-size: 10px;
font-weight: bold}
.date {
color: #707070;
font-family: Verdana;
font-size: 9px;}
.forms {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10 px;
color: #6CA05A;
text-decoration: none;
background-color: #CCCCCC;
border-color: #6CA05A;
border-style: solid;
border: 1px}
.submit {
background-color: #CCCCCC;
border-color: #6CA05A;
color: #2A343C;
font-family: Verdana;
font-size: 10px;
border-style: solid;
border 1 px;}
-->
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="padding: 2px">
<?php
// If submitted
if( $_POST [ 'submit' ]) {
// Verify if the fields were filled.
if(! $_POST [ 'username' ]) {
echo 'HIBA a felhasználóneveddel!' ;
die;
}
if(! $_POST [ 'email' ]) {
echo 'HIBA az e-mail címeddel!' ;
die;
}
if(! $_POST [ 'message' ]) {
echo 'HIBA az üzeneteddel!' ;
die;
}
// Date format
$date = date ( "d/m/y" ); // http://www.php.net/date
// Assign variables of the forms
$username = $_POST [ 'username' ];
$email = $_POST [ 'email' ];
$message = $_POST [ 'message' ];
$ip = $_SERVER [ 'REMOTE_ADDR' ];
// Connect to the database
include( 'connect.php' );
// Insert the info in the shoutbox table.
$query = "INSERT INTO shoutbox (username, email, message, date, ip)
VALUES ('$username','$email','$message','$date','$ip')" ;
mysql_query ( $query );
// close connection
mysql_close ();
// Show message to let them return to the shoutbox
?>
<div align="center">Köszönjük a hozzászólást .<br>
Return to the <a href="shoutbox.php">üzenőfal</a>!
<?php
// If NOT submitted
} else {
// connect to the database
include( 'connect.php' );
$query = "SELECT * FROM shoutbox ORDER BY id DESC LIMIT 10" ;
$result = mysql_query ( $query );
// Create a table
?>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<?
// Run a While loop for the rows
while( $c = mysql_fetch_array ( $result ))
{
?>
<tr>
<td><a href="mailto: <? echo $c [ email ] ?> ">
<? echo $c [ username ] ?> </a> says:
<div align="justify"> <? echo $c [ message ] ?> </div>
</td>
</tr>
<tr><td>on <? echo $c [ date ] ?>
<hr noshade="noshade" size="1" style="border-style: dashed" color="#000000" /></td></tr>
<? } ?>
</table>
<form method="post" action="shoutbox.php">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Felhasználónév :</td>
<td><input type="text" name="username" class="forms"></td>
</tr>
<tr>
<td>Email :</td>
<td><input type="text" name="email" class="forms"></td>
</tr>
<tr>
<td>Üzenet :</td>
<td><input type="text" name="message" class="forms"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Mehet" class="subtmit"></td>
</tr>
</table>
</form>
<?
}
mysql_close ();
?>
</body>
</html>
|