PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Bob Breznak   Plain Text File News Manager   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: The Example File
Class: Plain Text File News Manager
Manage news articles stored on plain text files
Author: By
Last change:
Date: 20 years ago
Size: 716 bytes
 

Contents

Class file image Download
<?PHP
   
require_once('newsedit.php');
   
   
$test = new NewsEdit('test.txt');
   
    if(
$_GET['delete'])
    {
       
$test->delete_post($_GET['delete']);
    }
    else if(
$_GET['edit'])
    {
       
$edit_arr='55/55/55|Edit Test|This is to see if the edit test works!|Bob';
       
$test->edit_post($edit_arr,$_GET['edit']);
    }
    else if(
$_GET['x'])
    {
       
$arr=$test->sel_entry($_GET['x']);
        echo
"Date: " . $arr[0] . " User: " . $arr[3] . "Subject: " . $arr[1] . "Text: " . $arr[2];
    }
    else
    {
       
$arr=$test->show_post(4);
        foreach (
$arr as $value)
        {
           
$dsp_arr=explode('|',$value);
            echo
"Date: " . $dsp_arr[0] . " User: " . $dsp_arr[3] . "Subject: " . $dsp_arr[1] . "Text: " . $dsp_arr[2] . "<br>";
        }
    }
   
?>