simpel-nieuwsysteem-v-101

Gesponsorde koppelingen

PHP script bestanden

  1. simpel-nieuwsysteem-v-101

« Lees de omschrijving en reacties

CSS:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
/*Default setup*/
body {
 font-family:         arial, helvetica, sans-serif;  
 font-size:         11px;
 color:             000000;
 padding:             10px 10px 10px 10px;
 marig-left:        1px;
}
td {
 font-family:         arial, helvetica, sans-serif;  
 font-size:         11px;
 color:             777777;
}
td.sender {
 color: #000000;
}
div.container {
 border-bottom: 1px solid #69c;
 border-top: 1px solid #69c;
 vertical-align: middle;
}
div.content {
 border-bottom: 1px solid #69c;
}
p {
 font-family:         arial, helvetica, sans-serif;
 font-size:             11px;
 color:              3D3D3D;
 margin-left:         2px;
}
p.footer {
text-align:            center;
}
/*Link setup*/
a:link {
 color:                #3D3D3D;
 font-family:         arial, helvetica, sans-serif;  
 font-size:         11px;
 text-decoration:    none;
 border:            none;
}
a:visited {
 color:             666666;
 font-family:         arial, helvetica, sans-serif;
 font-size:         11px;
 text-decoration:    none
}

a:active {
 color:             03BBFF;  
 font-family:         arial, helvetica, sans-serif;  
 font-size:         11px;
 text-decoration:     none
}

A:hover {
text-decoration: none;
color: #3399FF;
}

/*Fieldset.../*/
fieldset {
 border:            1px solid #222222;
 border-width:        thin;
 width:                250px;
 height:            auto;
 -moz-border-radius:4px;
 -moz-box-sizing:     border-box;
}
legend {
 border:            1px solid #69c;
 -moz-border-radius:4px;
 -moz-box-sizing:    border-box;
}
textarea {
 border:            1px solid #222222;
}

/*Form setup*/
input {
 border:            1px solid #222222;
}
select {
 border:            1px solid #69c;
 -moz-border-radius:4px;
 -moz-box-sizing:    border-box;
}
/*List setup*/
ul {
list-style:    none;
}
li {
float: right;
border-right: solid 1px #A75300;
padding-right: 8px;
margin-right: 8px;
}
/*Images*/
img {
 border: none;
}
/*Text*/
h1 {
 color: #787878;
}
.header {
 font-size: 18px;
 border-bottom: 1px solid #69c;
 color: #777777;
}
.text {
 color: #006699;
}
.headertext {
 color: #006699;
 font-size: 12px;
}
/*End CSS*/


De file zelf:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
<title>Nieuws-Systeem</title>
<link href="css/css.css" rel="stylesheet" type="text/css" />
<?php
include('config/data.php');
$index = "index.php";
$footer = "Hier uw footer";
echo "<div align='center' class='container'><br>
<span class='headertext'>[</span> <span class='header'>NIEUWS<span class='headertext'>-</span>SYTEEM</span><span class='headertext'> ]</span><br><br>"
;
//Berichten weergeven + tellen
$result = mysql_query("SELECT * FROM messages ORDER BY id DESC");
$count = mysql_num_rows($result);
// als 0 berichten is.
if($count == 0){
    echo "<div align='center'>";
    echo "<table width='500' border='0' cellspacing='5'>";;
echo "<tr>";
    echo "<td align='left' width='75'>&nbsp;</td>";
    echo "<td align='center' width='350' class='text'>No messages yet!<br><hr color='#222222' width='350px' size='1'></td>";
    echo "<td width='75'>&nbsp;</td>";    
echo "</tr>";
echo "</table>";
//als 1 of meer is!
} elseif($count >= 1)
    {

    while($row = mysql_fetch_array($result))
{

echo "<div align='center'>";
    echo "<table width='500' border='0' cellspacing='5'>";;
echo "<tr>";
    echo "<td align='left' width='75'>&nbsp;</td>";
echo "<td align='left' width='350' class='sender'>" . $row['sender'] . "</td>";
    echo "<td width='75'>#". $row['id'] ."</td>";
echo "</tr>";
echo "<tr>";
    echo "<td align='left' width='75'>&nbsp;</td>";
    echo "<td align='left' width='350'>" . $row['date'] . "<br>" . $row['time'] . "</td>";
    echo "<td width='75'>&nbsp;</td>";
echo "</tr>";
echo "<tr>";
    echo "<td align='left' width='75'>&nbsp;</td>";
    echo "<td align='left' width='350' class='text'>" . $row['content'] . "<br></td>";
    echo "<td width='75'>&nbsp;</td>";    
echo "</tr>";
echo "<tr>
<td align='left' width='75'>&nbsp;</td>
<td align='center' width='350'>
<span class='text'>[</span>
    <a href='$index?action=delete&id="
.$row['id']."'> Delete</a>
<span class='text'>]</span><br><hr color='#222222' width='350px' size='1'></td>
<td width='75'>&nbsp;</td>
<tr>"
;
echo "</table>";
    }
}

//textarea for message
echo "<center>";
echo "<form action='' method='post'>";
    echo "<table width='500' border='0' cellspacing='5'>";
echo "<tr>";
    echo "<td align='left' width='75'>&nbsp;</td>";
    echo "<td align='center' width='350'><textarea name='text' cols='35' rows='5'></textarea>";
    echo "<br><input type='submit' name='submit' value='Submit' />";
    echo "&nbsp;&nbsp;&nbsp;&nbsp;<input name='reset' type='button' value='Reset' /></td>";
    echo "<td width='75'>&nbsp;</td>";    
echo "</tr>";
    echo "</table>";
echo "</form>";
echo "</div>";
echo "</center>";
//Copyright (footer)
echo "<center>
<div align='center'>$footer<br><br></div>
</div>
</center>"
;
//Als er op submit is gedrukt.
if(isset($_POST['submit']))
    {

    mysql_query("INSERT INTO messages (content, sender, date, time) VALUES ('". mysql_real_escape_string ( $_POST['text'] ) . "', 'HIER UW DEFAULT SENDER', NOW(), NOW())");
echo "<meta http-equiv=refresh content=0;URL=".$_SERVER['PHP_SELF'].">";
}

//Delete function
if($_GET['action'] == 'delete') {
    if (is_numeric($_GET["id"])) {
        $sql = "DELETE FROM messages WHERE id = " . $_GET['id'];
        $res = mysql_query($sql);
echo "<meta http-equiv=refresh content=0;URL=$index>";
    }
}

?>
>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.