Location: PHPKode > scripts > Flash-Ticker > flash-ticker/Ticker/index.php
<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi (hide@address.com)         */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
//
//  FLASH TICKER
//
// module created by HI-Lab
// Copyright (c) 2003 by cooperativa sociale l'Utopia a r.l.
// released under GPL licence
//
// www.hi-lab.net
//
/***************************************************************************/

//
// insert text form
//


if (!eregi("modules.php", $PHP_SELF)) {
        die ("Non puoi accedere a questo file direttamente...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
$pagetitle = "- "._TITLETICKER."";


    global $user, $cookie, $prefix, $dbi, $user_prefix;
    include ("header.php");
    title("<img src='modules/Ticker/tickerflash.jpg' width='193' height='91' alt='logo Ticker Flash by HI-Lab' border='1'>");
    OpenTable();
    echo "<center><font class=\"content\"><b>"._TITLETICKER."</b></font></center><br><br>"
                . "<i>"._INSTRUCTIONTICKER."</i><br>"
        ."<form action=\"./modules.php?mop=modload&name=Ticker&file=index&func=Adminticker\" method=\"post\">";
    echo    "<b>"._FORMTESTO." </b><br> <textarea name=\"formtesto\" ROW=\"10\" COLS=\"40\"></textarea><br><br>\n"
        ."<b>"._LINKASSOCIATO." </b><br>"."<input type=\"text\" name=\"urlticker\"><br><br>\n"
    ."<input type=\"submit\" value="._SEND.">\n"
        ."</form><br>\n";

// admin ticker function:
// add text strings in a text file
// and archive previous to another one

function Adminticker ($formtesto,$urlticker)

        {
        //
        // general variables
        // insert directory in nuke folder
        // starting with './' and with '/' at the end
        //

        $percorsobase="./modules/Ticker/text/";
        $nomefile="$percorsobase"."ticker";
        $nomefilearchivio="$percorsobase"."archivio";

        //
        // archive previous text
        //

        if (!file_exists("$nomefile.txt")) touch("$nomefile.txt");
        $aprefile=fopen("$nomefile.txt", 'r') or die (_ERRORE1);
        if (!file_exists("$nomefilearchivio.txt")) touch("$nomefilearchivio.txt");
        $scrivefile=fopen("$nomefilearchivio.txt", 'a') or die (_ERRORE1);

        while (! feof($aprefile))
                {
                $rigafile = fread( $aprefile, 1024);
                fwrite($scrivefile, $rigafile."\n");
                }

        $data=date("d/m/y G.i:s\n", time());
        fwrite($scrivefile, $data);

        //
        // reads text inserted in the form
        // and write it
        //

        if (file_exists("$nomefile.txt")) unlink("$nomefile.txt");
        touch("$nomefile.txt") or die (_ERRORE2."<br>");
        print "<br>"._CONFERMA1."<br>";

        $scrivefile2=fopen("$nomefile.txt", 'a') or die (_ERRORE1);

        $contatorea=0;
        $arrayform=explode("\n", $formtesto);
        foreach ($arrayform as $linea)
                {
                $ecommerciale=($contatorea>0)?"&":"";
                fwrite($scrivefile2,"$ecommerciale"."u$contatorea=".$urlticker."\n");
                fwrite($scrivefile2,"&t$contatorea=".$linea."\n");
                $contatorea++;
                }

        fclose($scrivefile2) or die (_ERRORE3);
        fclose($scrivefile) or die (ERRORE3);
        }

if (isset ($formtesto))
        {
        Adminticker ($formtesto,$urlticker);
        print "<h3><b>"._CONFERMA2."</b></h3>";
        }

    echo "<p align=\"right\"><A href=\"http://www.hi-lab.net\"><img src='modules/Ticker/hilab.gif' width='70' height='30' alt='HI-Lab - The Social Technology'></A><p>";
    CloseTable();
    include ('footer.php');

?>
Return current item: Flash-Ticker