Que tiene de malo mi codigo:
Código PHP:
<?php
$file_name = "events.txt";
$post_sep = "<###########>";
class writePosts {
function inputPost($hiddenCodeContainer) {
global $file_name, $post_sep;
$self = $_SERVER['PHP_SELF'];
$hiddenCodeContainer = $hiddenCodeContainer;
$fh = fopen($file_name, "r+");
fread($fh, filesize($file_name));
fwrite($fh, $hiddenCodeContainer.$post_sep);
fclose($fh);
echo "<script>window.location = '$self'; </script>";
}
function getPost(){
if (isset ($_POST['hiddenCodeContainer'])) {
$this->inputPost($_POST['hiddenCodeContainer']);
}
}
}
class readPosts{
function readAll(){
global $file_name, $post_sep;
$fh = fopen($file_name, "r");
$all = fread($fh, filesize($file_name));
fclose($fh);
$each = explode($post_sep, $all);
$i = 0;
$counteach = count($each);
while($i < $counteach - 1){
$post_info = explode($info_sep, $each[$i]);
$this->outPost($post_info[0], $post_info[1], $post_info[2]);
$i++;
}
}
function outPost($hiddenCodeContainer){
$hiddenCodeContainer = $hiddenCodeContainer;
echo $hiddenCodeContainer;
}
$write = new writePosts;
$read = new readPosts;
$write->getPost();
?>
Por que localhost me dice:
Parse error: parse error, expecting `T_FUNCTION' in C:\wamp\www\electroluca.php on line 50
La linea 50 es donde dice:
$write = new writePosts;
casi al ultimo