[ previous ] [ next ] [ threads ]
 
 From:  Roberto Zilli <r dot zilli at ingredium dot it>
 To:  m0n0wall dash dev at lists dot m0n0 dot ch
 Subject:  Telnet/Serial Menu
 Date:  Tue, 30 Dec 2003 13:12:01 +0100
Hi folks,

i've make this *sh* bold, cursorat, reverse, etc
sample php script.

Anyone is inspired?

*Happy new year*

zr
----------------------------------------------------------------------------------
#!/usr/local/bin/php -f
<?php
                                                                                

function Reverse($on){
    if($on){
        printf("%c%c%cm", 27, 91, 55 );
    } else {
        printf("%c[m%c%c", 27, 0, 0);
    }
}
                                                                                

function CursorAt($l, $c){
    printf("%c%c%d;%d%c", 27, 91, $l, $c, 72);
}
                                                                                

function CursorHome(){
    printf("%c%c%c", 27, 91, 72);
}
function Bold($on){
    if($on){
        printf("%c[1m", 27);
    } else {
        printf("%c[m%c%c", 27, 0, 0);
    }
}
function Clear(){
    printf("%c%c%c%c", 27, 91, 50, 74);
}
                                                                                

$fp = fopen('php://stdin', 'r');
                                                                                

Clear();
CursorHome();
CursorAt(1,1);
echo str_repeat("-",80);
for($i=2;$i<24;$i++){
    CursorAt($i,1);
    echo "*".str_repeat(" ",78)."*";
}
for(;;){
CursorAt(3, 36);
Bold(True);
Reverse(True);
echo "M0n0Wall";
Reverse(False);
Bold(False);
CursorAt(4, 27);
echo "(C)2003-2004 by Manuel Kasper";
                                                                                

CursorAt(6, 3);
echo "1) Interfaces: assign network ports";
CursorAt(6, 51);
echo "2) Set up LAN IP address";
CursorAt(7, 3);
echo "3) Reset webGUI password";
CursorAt(7, 51);
echo "4) Reset to factory defaults";
CursorAt(8, 3);
echo "5) Reboot system";
CursorAt(23, 1);
echo str_repeat("-",80);
CursorAt(22, 35);
Bold(True);
echo "Choose:";
Bold(False);
$choice = chop(fgets($fp));
}
?>