beginners-nieuws-systeempje

Gesponsorde koppelingen

PHP script bestanden

  1. beginners-nieuws-systeempje

« Lees de omschrijving en reacties

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
MYSQL DB
//
CREATE TABLE `nieuws` (
  `Titel` varchar(50) collate latin1_general_ci NOT NULL,
  `Auteur` varchar(20) collate latin1_general_ci NOT NULL,
  `Bericht` varchar(160) collate latin1_general_ci NOT NULL
) ENGINE=MyISAM ;
//

Index.php
___________
<?php
    require_once('connect.php');
    $sql = "
        SELECT Titel, Auteur, Bericht
        FROM nieuws
        ORDER BY Auteur ASC, Bericht ASC
        "
;
    if (!$res = mysql_query ($sql)) {
        echo '<pre>';
        echo htmlentities ($sql);
        trigger_error (mysql_error ());
        echo '</pre>';
    }

    else {
        while ($row = mysql_fetch_assoc ($res)) {
        echo '<hr>';
            echo '<p><i>Titel: </i>' . $row['Titel'] . '</p>';
            echo '<p><i>Auteur: </i>' . $row['Auteur'] . '</p>';
            echo '<p><i>Bericht:</i><b> ' . $row['Bericht'] . '</b></p>';
        }
    }

?>



Post.php
___________
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
<?php
    ini_set ('display_errors', 1);
    error_reporting (E_ALL);
    require_once('connect.php');
?>

<form action="" method="post">
<table width=410" border="0" align="center" cellspacing="0" cellpadding="0">
<tr>
<td height="5"><img src="images/spacer.gif" width="1" height="1"></td>
</tr>
<tr>
<td height="5" bgcolor="CCCCCC">
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="4">&nbsp;</td>
<td>Nieuwsysteem V1</td>
<td width="4">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" valign="top" bgcolor="E7EBEF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="4">&nbsp;</td>
<td width="120" align="left">Titel</td>
<td width="274" align="right"><input type="text" name="Titel" size="30"></td>
<td width="12">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" valign="top" bgcolor="E7EBEF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="4">&nbsp;</td>
<td width="120" align="left">Auteur</td>
<td width="274" align="right"><input type="text" name="Auteur" size="30"></td>
<td width="12">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" valign="top" bgcolor="E7EBEF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="4">&nbsp;</td>
<td width="120" align="left">Bericht</td>
<td width="274" align="right">
<form method="POST" action="--WEBBOT-SELF--">
    <!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
    <p><textarea rows="5" name="Bericht" cols="20"><br></textarea></p>
</form>
Er staat standaar &lt;BR&gt; laat dat staan !</td>
<td width="12">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="5"><img src="images/spacer.gif" width="1" height="1"></td>
</tr>
<tr>
<td height="30" align="left" bgcolor="#E7EBEF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="4">&nbsp;</td>
<td width="197" align="left">&nbsp;</td>
<input type="hidden" value="1" name="afhandeling">
<td width="197" align="right"><input type="submit" value="Voeg toe" name="submit"></td>
<td width="12">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
<div style="position: absolute; width: 373px; height: 66px; z-index: 1; left: 316px; top: 301px; border-style: dashed" id="laag1">
&nbsp; Copyright 2007 Kevin Riemers,<br>
&nbsp;Script Made By Kevin Riemers</div>

<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $sql_query = "
        INSERT INTO nieuws
            SET
                Titel = '"
.mysql_real_escape_string ($_POST['Titel'])."',
                Auteur = '"
.mysql_real_escape_string ($_POST['Auteur'])."',
                Bericht = '"
.mysql_real_escape_string ($_POST['Bericht'])."'";
    if (!$result = mysql_query($sql_query)) {
        echo '<pre>';
        echo htmlentities (str_replace ("\t", '', $sql_query));
        trigger_error (mysql_errno () . ': ' . mysql_error ());
        echo '</pre>';
    }
}

?>



Connect.php
______________
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
<?php
// Database gegevens.
$db_host = 'localhost';         // Server
$db_user = 'Databse username';         // Gebruikersnaam
$db_pass = 'Databse Wachtwoord';         // Wachtwoord
$db_name = 'Databse naam ';         // Database
  
mysql_connect($db_host, $db_user, $db_pass) or die('Er kon geen verbinding met de server worden gemaakt.');
mysql_select_db($db_name) or die('Ik kon de juiste database niet vinden.');
?>

 
 

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.