digi-news
' .$title. '

'; } function foot() { echo '


Configuration | List News | Add News | Logout

digi-news 1.0 © 2001 digi-FX

'; } function auth() { global $user, $pass, $digiNews; if (($user != $digiNews['user']) || ($pass != $digiNews['pass'])) { login('Invalid Login or Password'); exit; } setcookie('user', $user); setcookie('pass', $pass); menu(); } function login($msg = '') { head('Authorization Required'); if ($msg != '') { echo '' .$msg. '

'; } echo 'You must login to access the control panel. Please provide your login name and password below. NOTE: Cookies must be enabled to use this control panel.

Login Name:
Password:
'; foot(); } function menu() { head('Main Menu'); echo 'If this is your first visit to the control panel, please choose configuration; otherwise, please choose from the following options:'; foot(); exit; } function config() { global $save, $cancel, $newlogin, $newpass, $template, $toffset, $tformat, $digiNews; if ($save) { $digiNews['user'] = $newlogin; if ($newpass != '**********') { $digiNews['pass'] = $newpass; } $digiNews['template'] = $template; $digiNews['toffset'] = $toffset; $digiNews['tformat'] = $tformat; writenews(); menu(); } else if ($cancel) { menu(); } else { head('Configuration'); echo 'You can change any of the following properties. It\'s recommended that you don\'t edit news.dat directly.
  • Login and Password
  • To change your login name and password, fill them in below; otherwise, leave the following alone.

    Login Name:
    Password:


  • Template Path
  • This is the absolute path to the template.htm file. This is the template that formats news entries.

    Template Path:


  • Timezone Offset
  • This lets you specify the timezone offset from your server\'s timezone. All times will be affected by this change.

    Timezone Offset:


  • Time Format
  • This sets the format of the timestamp e.g. mm/dd/yy. For a list of possible values visit http://www.php.net/manual/en/function.date.php.

    Timezone Format:

    '; foot(); } } function view() { global $news; head('All News'); echo ''; foreach ($news as $entry) { $data = explode('||', $entry); echo ""; } echo '
    Subject (ID):Author:Author E-mail:Body:
    $data[4] ($data[0])$data[2]$data[3]$data[5]
    '; foot(); } function edit() { global $id, $save, $confirm_delete, $delete, $cancel, $news_author, $news_authoremail, $news_subject, $news_body, $news, $digiNewsTime; if (!$id) { die('No News ID was Specified'); } if ($save) { $news_subject = trim($news_subject); $news_author = trim($news_author); $news_authoremail = trim($news_authoremail); $news_body = trim($news_body); $news_body = str_replace("\n", '
    ', $news_body); for ($i = 0; $i < count($news); $i++) { if(ereg("^$id\|\|", $news[$i])) { $data = explode('||', $news[$i]); $data[1] = $digiNewsTime; $data[2] = $news_author; $data[3] = $news_authoremail; $data[4] = $news_subject; $data[5] = $news_body; $news[$i] = join('||', $data); break; } } writenews(); menu(); } else if ($delete) { if(!$confirm_delete == 1) { die('You didn\'t confirm the delete.'); } foreach ($news as $entry) { if(!ereg("^$id\|\|", $entry)) { $nnews[] = $entry; } } $news = $nnews; writenews(); menu(); } else if ($cancel) { menu(); } else { foreach ($news as $entry) { if(ereg("^$id\|\|", $entry)) { $data = explode('||', $entry); break; } } if (!$data) { die("News ID $id was not found"); } $data[5] = str_replace('
    ', "\n", $data[5]); head('Edit News'); echo 'You can edit any of the following properties for News ID ' .$id. ':
    Author:
    Author E-mail:
    Subject:
    Body:

    Check to Confirm Delete

    '; foot(); } } function add() { global $save, $cancel, $news_author, $news_authoremail, $news_subject, $news_body, $news, $digiNewsTime; if ($save) { $data[0] = 0; foreach ($news as $entry) { ereg("^([0-9]+)\|\|", $entry, $j); $j[0] = str_replace('||', '', $j[0]); if ($j[0] > $data[0]) { $data[0] = $j[0]; } } $news_subject = trim($news_subject); $news_author = trim($news_author); $news_authoremail = trim($news_authoremail); $news_body = trim($news_body); $news_body = str_replace("\n", '
    ', $news_body); $data[0]++; $data[1] = $digiNewsTime; $data[2] = $news_author; $data[3] = $news_authoremail; $data[4] = $news_subject; $data[5] = $news_body; array_unshift($news, join('||', $data)); writenews(); menu(); } else if ($cancel) { menu(); } else { head('Add News'); echo '
    Author:
    Author E-mail:
    Subject:
    Body:

    '; foot(); } } function logout() { setcookie('user', ''); setcookie('pass', ''); head('Logged Out'); echo 'You are now logged out of the control panel. Click here to login again.'; foot(); exit; } ?>