nieuwsscript
aanmaken.php
Code (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
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
<?php
##################################################
## Nieuwsscript geschreven door Arjan Schuurman ##
## ArCome.nl - www.arcome.nl ##
##################################################
//checken of map "alle" bestaat
//Zo nee, maak dan de map aan
if (!is_dir("alle")) {
mkdir("alle", 0777);
}
//checken of nieuwsteller bestaat
//Zo nee, maak dan de teller aan met stand 0
if (!file_exists("nieuwsteller.txt")) {
$file = fopen("nieuwsteller.txt", "w");
fwrite($file, "0");
fclose($file);
}
//Counter openen
$file = fopen("nieuwsteller.txt", "r");
$num = fgets($file, 4096);
fclose($file);
$ornum = $num + 1;
//Nummer + 1
$num = $num + 1;
if ($_POST['submit']) {
//Maak map aan afhankelijk van het id dat gegeven wordt (id = $num)
mkdir("alle/".$num, 0777);
//Maak bestand aan met als inhoud de titel
$file = fopen("alle/".$num."/titel.txt", "w");
fwrite($file, stripslashes($_POST['titel']));
fclose($file);
//Maak bestand aan met als inhoud de tekst
$file = fopen("alle/".$num."/inhoud.txt", "w");
fwrite($file, stripslashes($_POST['inhoud']));
fclose($file);
//Maak bestand aan met als inhoud de datum
$file = fopen("alle/".$num."/datum.txt", "w");
fwrite($file, date("d.m.Y"));
fclose($file);
//CHMODDEN
chmod("alle/".$num."/titel.txt", 0777);
chmod("alle/".$num."/inhoud.txt", 0777);
chmod("alle/".$num."/datum.txt", 0777);
//Als laatste de Teller updaten
$file = fopen("nieuwsteller.txt", "w");
fwrite($file, $ornum);
fclose($file);
echo "Toegevoegd!";
} else {
echo "<form method=\"post\" action=\"#\">";
echo "<b>Titel:</b><br>";
echo "<input name=\"titel\" type=\"text\"><br><br>";
echo "<b>Inhoud:</b><br>";
echo "<textarea style=\"width: 400px; height: 200px;\" name=\"inhoud\"></textarea><br><br>";
echo "<input type=\"submit\" name=\"submit\" value=\"Toevoegen!\">";
echo "</form>";
}
?>
##################################################
## Nieuwsscript geschreven door Arjan Schuurman ##
## ArCome.nl - www.arcome.nl ##
##################################################
//checken of map "alle" bestaat
//Zo nee, maak dan de map aan
if (!is_dir("alle")) {
mkdir("alle", 0777);
}
//checken of nieuwsteller bestaat
//Zo nee, maak dan de teller aan met stand 0
if (!file_exists("nieuwsteller.txt")) {
$file = fopen("nieuwsteller.txt", "w");
fwrite($file, "0");
fclose($file);
}
//Counter openen
$file = fopen("nieuwsteller.txt", "r");
$num = fgets($file, 4096);
fclose($file);
$ornum = $num + 1;
//Nummer + 1
$num = $num + 1;
if ($_POST['submit']) {
//Maak map aan afhankelijk van het id dat gegeven wordt (id = $num)
mkdir("alle/".$num, 0777);
//Maak bestand aan met als inhoud de titel
$file = fopen("alle/".$num."/titel.txt", "w");
fwrite($file, stripslashes($_POST['titel']));
fclose($file);
//Maak bestand aan met als inhoud de tekst
$file = fopen("alle/".$num."/inhoud.txt", "w");
fwrite($file, stripslashes($_POST['inhoud']));
fclose($file);
//Maak bestand aan met als inhoud de datum
$file = fopen("alle/".$num."/datum.txt", "w");
fwrite($file, date("d.m.Y"));
fclose($file);
//CHMODDEN
chmod("alle/".$num."/titel.txt", 0777);
chmod("alle/".$num."/inhoud.txt", 0777);
chmod("alle/".$num."/datum.txt", 0777);
//Als laatste de Teller updaten
$file = fopen("nieuwsteller.txt", "w");
fwrite($file, $ornum);
fclose($file);
echo "Toegevoegd!";
} else {
echo "<form method=\"post\" action=\"#\">";
echo "<b>Titel:</b><br>";
echo "<input name=\"titel\" type=\"text\"><br><br>";
echo "<b>Inhoud:</b><br>";
echo "<textarea style=\"width: 400px; height: 200px;\" name=\"inhoud\"></textarea><br><br>";
echo "<input type=\"submit\" name=\"submit\" value=\"Toevoegen!\">";
echo "</form>";
}
?>
bewerken.php
Code (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
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
<?php
##################################################
## Nieuwsscript geschreven door Arjan Schuurman ##
## ArCome.nl - www.arcome.nl ##
##################################################
//Kijken naar wat na "?id=" is ingevuld
$id = $_GET['id'];
if (is_dir("alle/".$id)) {
if ($_POST['submit']) {
//Werk bestand bij met als inhoud de titel
$file = fopen("alle/".$id."/titel.txt", "w");
fwrite($file, stripslashes($_POST['titel']));
fclose($file);
//Werk bestand bij met als inhoud de tekst
$file = fopen("alle/".$id."/inhoud.txt", "w");
fwrite($file, stripslashes($_POST['inhoud']));
fclose($file);
echo "Bijgewerkt!";
} else {
echo "<form method=\"post\" action=\"#\">";
echo "<b>Titel:</b><br>";
echo "<input name=\"titel\" type=\"text\" value=\"";
include("alle/".$id."/titel.txt");
echo "\"><br><br>";
echo "<b>Inhoud:</b><br>";
echo "<textarea style=\"width: 400px; height: 200px;\" name=\"inhoud\">";
include("alle/".$id."/inhoud.txt");
echo "</textarea><br><br>";
echo "<input type=\"submit\" name=\"submit\" value=\"Bijwerken!\">";
echo "</form>";
}
}
?>
##################################################
## Nieuwsscript geschreven door Arjan Schuurman ##
## ArCome.nl - www.arcome.nl ##
##################################################
//Kijken naar wat na "?id=" is ingevuld
$id = $_GET['id'];
if (is_dir("alle/".$id)) {
if ($_POST['submit']) {
//Werk bestand bij met als inhoud de titel
$file = fopen("alle/".$id."/titel.txt", "w");
fwrite($file, stripslashes($_POST['titel']));
fclose($file);
//Werk bestand bij met als inhoud de tekst
$file = fopen("alle/".$id."/inhoud.txt", "w");
fwrite($file, stripslashes($_POST['inhoud']));
fclose($file);
echo "Bijgewerkt!";
} else {
echo "<form method=\"post\" action=\"#\">";
echo "<b>Titel:</b><br>";
echo "<input name=\"titel\" type=\"text\" value=\"";
include("alle/".$id."/titel.txt");
echo "\"><br><br>";
echo "<b>Inhoud:</b><br>";
echo "<textarea style=\"width: 400px; height: 200px;\" name=\"inhoud\">";
include("alle/".$id."/inhoud.txt");
echo "</textarea><br><br>";
echo "<input type=\"submit\" name=\"submit\" value=\"Bijwerken!\">";
echo "</form>";
}
}
?>
alleberichten.php
Code (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
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
<?php
##################################################
## Nieuwsscript geschreven door Arjan Schuurman ##
## ArCome.nl - www.arcome.nl ##
##################################################
$file = fopen("nieuwsteller.txt", "r");
$counter = fgets($file, 4096);
fclose($file);
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr valign=\"top\"><td width=\"200\"><b>Titel</b></td><td><b>Geplaatst op</b></td></tr>";
for ($i = $counter; $i > 0; $i--)
{
//Kijken of map waar het bericht instaat bestaat...
if (is_dir("alle/".$i)) {
echo "<tr><td><b><a href=\"bekijken.php?id=".$i."\">";
include("alle/".$i."/titel.txt");
echo "</a></b></td><td>";
include("alle/".$i."/datum.txt");
echo "</td></tr>";
}
}
echo "</table>";
?>
##################################################
## Nieuwsscript geschreven door Arjan Schuurman ##
## ArCome.nl - www.arcome.nl ##
##################################################
$file = fopen("nieuwsteller.txt", "r");
$counter = fgets($file, 4096);
fclose($file);
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr valign=\"top\"><td width=\"200\"><b>Titel</b></td><td><b>Geplaatst op</b></td></tr>";
for ($i = $counter; $i > 0; $i--)
{
//Kijken of map waar het bericht instaat bestaat...
if (is_dir("alle/".$i)) {
echo "<tr><td><b><a href=\"bekijken.php?id=".$i."\">";
include("alle/".$i."/titel.txt");
echo "</a></b></td><td>";
include("alle/".$i."/datum.txt");
echo "</td></tr>";
}
}
echo "</table>";
?>
bekijken.php
Code (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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
##################################################
## Nieuwsscript geschreven door Arjan Schuurman ##
## ArCome.nl - www.arcome.nl ##
##################################################
//Kijken naar wat er na "?id=" is in gevuld
$id = $_GET['id'];
//Kijken of nieuwsbericht wel bestaat
if (!is_dir("alle/".$id)) {
echo "Dit nieuwsbericht bestaat niet, mogelijk heeft u een verkeerd ID ingevuld.";
} else {
echo "<h3>";
include("alle/".$id."/titel.txt");
echo "</h3>";
echo "<b>Geschreven op:</b> ";
include("alle/".$id."/datum.txt");
echo "<br><fieldset style=\"width: 500px;\">";
include("alle/".$id."/inhoud.txt");
echo "</fieldset>";
}
echo "<br><br><a href=\"alleberichten.php\">Ga naar alle berichten</a><br><a href=\"bewerken.php?id=".$id."\">Bewerken</a>";
?>
##################################################
## Nieuwsscript geschreven door Arjan Schuurman ##
## ArCome.nl - www.arcome.nl ##
##################################################
//Kijken naar wat er na "?id=" is in gevuld
$id = $_GET['id'];
//Kijken of nieuwsbericht wel bestaat
if (!is_dir("alle/".$id)) {
echo "Dit nieuwsbericht bestaat niet, mogelijk heeft u een verkeerd ID ingevuld.";
} else {
echo "<h3>";
include("alle/".$id."/titel.txt");
echo "</h3>";
echo "<b>Geschreven op:</b> ";
include("alle/".$id."/datum.txt");
echo "<br><fieldset style=\"width: 500px;\">";
include("alle/".$id."/inhoud.txt");
echo "</fieldset>";
}
echo "<br><br><a href=\"alleberichten.php\">Ga naar alle berichten</a><br><a href=\"bewerken.php?id=".$id."\">Bewerken</a>";
?>