#!/bin/sh GUEST="/home/www/guest" GU="guest" NUMERO="$GUEST/.numero" VIRO="$GUEST/lucchetto" PAGINA="/guest/inserimento.html" DATE=/bin/date NUM_MAX=1500 ############################################################################# eval `cgiparse -form` # se NUMERO non e' ancora stato creato assume che non ci siano stati messaggi if [ ! -e "$NUMERO" ]; then echo "0" >$NUMERO; fi if [ "$CONTENT_LENGTH" -gt "500" ]; then echo -e "Content-type: text/html\n\nErrore" echo "

Non sono permessi messaggi troppo lunghi.
" echo "Mòderati.
" echo "
Premi back.

" exit; fi # numerazione messaggi NUM="`eval cat $NUMERO`" if [ -n "$FORM_nome" -a -z "$FORM_testo" ]; then echo -e "Content-type: text/html\n\nErrore" echo "

Testo vuoto.
" echo "
Premi back.

" exit; fi if [ -z "$FORM_nome" -a -n "$FORM_testo" ]; then echo -e "Content-type: text/html\n\nErrore" echo "

Lascia una tua firma.
" echo "
Premi back.

" exit; fi if [ -n "$FORM_testo" ]; then while [ -n "`ln $NUMERO $VIRO 2>&1`" ]; do sleep 1s; done # numerazione messaggi NUM="`eval cat $NUMERO`" echo `expr $NUM + 1` >$NUMERO NUM="`expr $NUM + 1`" rm -f $VIRO TESTO="`echo $FORM_testo | testo`" email="`echo $FORM_email | testo`" nome="`echo $FORM_nome | testo`" # testo da mettere in $GU.$NUM TEMPO="`$DATE '+%d/%m %H:%M'`" echo "$TEMPO   $nome     $email
$TESTO
" >$GUEST/$GU.$NUM else NUM=`eval cat $NUMERO`; fi echo -e "Content-type: text/html\n\n" echo "" echo "
" echo "

Dada's Guest Book

" echo "Lasciate anche voi un commento.

" echo "

" if [ "$NUM" -gt "0" ]; then while [ "$NUM_MAX" -gt "0" ]; do cat $GUEST/$GU.$NUM echo "
" NUM=`expr $NUM - 1` NUM_MAX=`expr $NUM_MAX - 1` if [ "$NUM" = "0" ]; then NUM_MAX="0"; fi; done; else echo "Iniazia tu a lasciare commenti." fi echo "


dada@agonet.it
" echo "" # elimino il messaggio uscito dal limite if [ "$NUM" -gt "0" ]; then rm -f $CHAT/$CH.$NUM; fi