simpel-gastenboek-txt-opslaan

Gesponsorde koppelingen

PHP script bestanden

  1. simpel-gastenboek-txt-opslaan

« Lees de omschrijving en reacties

<<<<<-----gastenboek.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
<html>
<head>
<title>GASTENBOEK</title>
</head>
<body bgcolor="#3f5bb5">

<p align="right"> </p>
<center>
<h1>Gastenboek</h1>
<p>
<?php
if($submit)
{

 if (($name=="")||($email=="")||($mes==""))
 {
                      echo "</center><h2>ERROR</h2>";
                        echo "De volgende gegevens ontbreken:<br>";
    if ($name=="")  echo "<font color=red>Je naam </font><br>";
    if ($email=="") echo "<font color=red>Je e-mailadres </font><br>";
    if ($mes=="")   echo "<font color=red>Je bericht </font><br>";
                    echo "Klik <a onClick=javascript:history.back()>HIER</a> om terug te gaan<center><p>";


 }

 else
 {
        $mes = ereg_replace("\n","<BR>",$mes);
    $date = date("l dS of F Y h:i:s A");
    $new_message = "$name(+)$email(+)$date(+)$mes\r\n";
    $file=join(" ",file("gastenboek.txt"));
        $fp=fopen("gastenboek.txt","w");
        fputs($fp,$new_message);
        fputs($fp, $file);
        fclose($fp);
        mail( "[email protected]", "Bericht in Gastenboek ",$new_message, "From: afzender <[email protected]>" );
 }
}

else
{
?>


<form action = "<?php echo($PHP_SELF); ?>" method=post>
<table class='back2' width=90%>
<tr>
<td class='back1'>Naam</td>
<td class='back2'><input type=text size=40 name="name"></td>
</tr>
<tr>
<td class='back1'>E-mail</td>
<td class='back2'><input type=text size=40 name="email"></td>
</tr>
<tr>
<td class='back1'>Bericht</td>
<td class='back2'><textarea ROWS=5 COLS=80 WRAP=virtual name="mes"></textarea></td>
</tr>
<tr>
<td class='back2'></td>
<td class='back2'><input type=submit size=40 name="submit" value="Plaats bericht"></td>
</tr>
</table>
</form>


<?php
}

$fo = fopen('gastenboek.txt',"r");
echo "<table class='back2' width=90%>";
while (!feof ($fo))

{
       $bericht = fgets($fo, 4096);
        $split = explode("(+)",$bericht);
        $sender_name   = $split[0];
        $sender_email  = $split[1];
        $date          = $split[2];
        $message       = $split[3];

        echo ("<tr><td class='back1'><i>Afzender</i><td class='back2'><a class='a1' href=mailto:$sender_email>$sender_name</a></td></tr>");
        echo ("<tr><td class='back1'><i>Datum </i><td class='back2'>$date</tr></td>");
        echo ("<tr><td valign=top class='back1'><i>Bericht</i><td class='back3'>$message</td></tr>");
        echo ("<tr><td>");
}

echo "</table>";
fclose($fo);
?>



<a href="gastenboek.php">terug naar index</a>
<?php
$file
= "gastenboek.txt";  
?>



</body>
</html>


<<<<<-----delmes.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
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body background="textr210.jpg">
<center>
<h1>Verwijder berichten</h1>
</center>
<p>
<?php
if($submit)
{


 $fo = fopen('gastenboek.txt',"r");
 while (!feof ($fo))

{
       $bericht = fgets($fo, 4096);
        $split = explode("(+)",$bericht);
        $sender_name   = $split[0];
        $sender_email  = $split[1];
        $date          = $split[2];
        $validate      = "$sender_name$sender_email$date";
        
        if ($validate!=$check)
        {

            $total = "$total$bericht";
        }

        else
        {
            echo "MESSAGE DELETED:<BR>";
            echo "AFZENDER:$sender_name<BR>";
            echo "E-MAIL:$sender_email<BR>";
            echo "DATE:$date<P>";
        }

}

$fp=fopen("gastenboek.txt","w");
fwrite($fp,$total);
fclose($fp);
}

else
{

}


$fo = fopen('gastenboek.txt',"r");
echo "<center><form action = $PHP_SELF method=post>";
echo "<table class='back2' width=90%>";
while (!feof ($fo))
{
      
        $bericht = fgets($fo, 4096);
        $split = explode("(+)",$bericht);
        $sender_name   = $split[0];
        $sender_email  = $split[1];
        $date          = $split[2];
        $validate      = "$sender_name$sender_email$date";

        echo ("<tr><td class='back2'><input type = radio name = 'check' value=\"$validate\">
                   <td class='back2'>$sender_name</td>
                   <td class='back2'>$sender_email</td>
                   <td class='back2'>$date</td></tr>"
);
}

echo "<tr><td class='back2'></td>
          <td class='back2'><center><input type=submit size=40 name=\"submit\" value=\"Verwijder\">
          <td class='back2'></td>
          <td class='back2'></td>"
;
echo "</table></form>";
fclose($fo);


?>


Edit:

Mod edit
Code tags aan het script toegevoegd, ivm verhoogde leesbaarheid code

 
 

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.