Bestandsgroote in bytes krijgen
Alvast bedankt!
filesize().
Ja, zie Bedankt!
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
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
<?php
include 'header.php';
// Start main page!
//////////////////////////////////////////////////
$checkcode = 'Radio';
$filename = 'areq.txt';
if($_SERVER['REQUEST_METHOD']=="POST") {
if ( isset($_POST['code'])
&& trim($_POST['code']) === $checkcode ) {
if(filesize($filename) === "0"){
echo 'Jah maar het bestand was leeg?!';
}else{
$data = "areq.txt";
$file = fopen($data, "w");
fputs($file, "");
echo 'Gedaan!';
}
} else {
echo 'verkeerde wachtwoord!';
}
} else{
echo '<form action="aleegdezooi.php" method="post"><table><tr><td><label for="user">code:</label></td><td><input type="password" name="code"></td><td><input type="submit" value="submit"></td></tr></table></form>';
}
///////////////////////////////////////////////////
//End Main page!
include 'footer.php';
?>
include 'header.php';
// Start main page!
//////////////////////////////////////////////////
$checkcode = 'Radio';
$filename = 'areq.txt';
if($_SERVER['REQUEST_METHOD']=="POST") {
if ( isset($_POST['code'])
&& trim($_POST['code']) === $checkcode ) {
if(filesize($filename) === "0"){
echo 'Jah maar het bestand was leeg?!';
}else{
$data = "areq.txt";
$file = fopen($data, "w");
fputs($file, "");
echo 'Gedaan!';
}
} else {
echo 'verkeerde wachtwoord!';
}
} else{
echo '<form action="aleegdezooi.php" method="post"><table><tr><td><label for="user">code:</label></td><td><input type="password" name="code"></td><td><input type="submit" value="submit"></td></tr></table></form>';
}
///////////////////////////////////////////////////
//End Main page!
include 'footer.php';
?>
Maar als het bestand leeg is wordt de error 'jah maar het bestand is leeg' niet weergegeven!
Of misschien beter:
Zouden allebei moeten werken
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
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
<?php
include 'header.php';
// Start main page!
//////////////////////////////////////////////////
$checkcode = 'Radio';
$filename = 'areq.txt';
if($_SERVER['REQUEST_METHOD']=="POST") {
if ( isset($_POST['code'])
&& trim($_POST['code']) === $checkcode ) {
if(!filesize($filename)){
echo 'Jah maar het bestand was leeg?!';
}else{
$data = "areq.txt";
$file = fopen($data, "w");
fputs($file, "");
echo 'Gedaan!';
}
} else {
echo 'verkeerde wachtwoord!';
}
} else{
echo '<form action="aleegdezooi.php" method="post"><table><tr><td><label for="user">code:</label></td><td><input type="password" name="code"></td><td><input type="submit" value="submit"></td></tr></table></form>';
}
///////////////////////////////////////////////////
//End Main page!
include 'footer.php';
?>
include 'header.php';
// Start main page!
//////////////////////////////////////////////////
$checkcode = 'Radio';
$filename = 'areq.txt';
if($_SERVER['REQUEST_METHOD']=="POST") {
if ( isset($_POST['code'])
&& trim($_POST['code']) === $checkcode ) {
if(!filesize($filename)){
echo 'Jah maar het bestand was leeg?!';
}else{
$data = "areq.txt";
$file = fopen($data, "w");
fputs($file, "");
echo 'Gedaan!';
}
} else {
echo 'verkeerde wachtwoord!';
}
} else{
echo '<form action="aleegdezooi.php" method="post"><table><tr><td><label for="user">code:</label></td><td><input type="password" name="code"></td><td><input type="submit" value="submit"></td></tr></table></form>';
}
///////////////////////////////////////////////////
//End Main page!
include 'footer.php';
?>
maar nu krijg ik de error 'Verkeerde wachtwoord!'
Wat is er nu weer aan de hand?
if ( isset($_POST['code']) && trim($_POST['code']) === $checkcode ) {
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
include 'header.php';
$checkcode = 'Radio';
$filename = 'areq.txt';
if($_SERVER['REQUEST_METHOD']=="POST"){
if( isset($_POST['code']) && (trim($_POST['code'])===$checkcode) ){
if(!filesize($filename)){
echo 'Jah maar het bestand was leeg?!';
}else{
$data = "areq.txt";
$file = fopen($data, "w");
fputs($file, "");
echo 'Gedaan!';
}
}else{
echo 'verkeerde wachtwoord!';
}
}else{
echo '<form action="'.basename(__FILE__).'" method="POST"><table><tr><td><label for="user">code:</label></td><td><input type="password" name="code"></td><td><input type="submit" value="submit"></td></tr></table></form>';
}
include 'footer.php';
?>
include 'header.php';
$checkcode = 'Radio';
$filename = 'areq.txt';
if($_SERVER['REQUEST_METHOD']=="POST"){
if( isset($_POST['code']) && (trim($_POST['code'])===$checkcode) ){
if(!filesize($filename)){
echo 'Jah maar het bestand was leeg?!';
}else{
$data = "areq.txt";
$file = fopen($data, "w");
fputs($file, "");
echo 'Gedaan!';
}
}else{
echo 'verkeerde wachtwoord!';
}
}else{
echo '<form action="'.basename(__FILE__).'" method="POST"><table><tr><td><label for="user">code:</label></td><td><input type="password" name="code"></td><td><input type="submit" value="submit"></td></tr></table></form>';
}
include 'footer.php';
?>
Het werkt weer, bedankt allemaal!