Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I don't understand why does it display this message: "Parse error: parse error in C:\wamp\www\aaa\tftp scripts\testTFTP_r3.php on line 45"

each time I tried to execute the php scripts as below:

<?
//telnet

require_once "PHPTelnet_config.php";


$telnet = new PHPTelnet();

$result = $telnet->Connect('192.168.100.30','','');

if ($result == 0) { 
    //echo $username1;
    $telnet->DoCommand($username1, $result);
    // NOTE: $result may contain newlines
    //echo $result;
    $telnet->DoCommand($password1, $result);
    // NOTE: $result may contain newlines
    //echo $result;
    // say Disconnect(0); to break the connection without explicitly logging out
    //$telnet->Disconnect(); 
    $telnet->DoCommand("super", $result);
    $telnet->DoCommand("super", $result);
    $telnet->DoCommand("enable", $result);
    $telnet->DoCommand("cisco", $result);
    $telnet->DoCommand("copy tftp startup-config", $result);
    $telnet->DoCommand("192.168.100.99", $result);
    }
    //here is the command to specify which lab

    switch(3){
        case 1:
            $telnet->DoCommand("R3_lab1_Config", $result);
            break;

        case 2:
            $telnet->DoCommand("R3_lab2_Config_PPP", $result);
            break;

        case 3:
            $telnet->DoCommand("R3_lab3_Config_SSH_NTP_Syslog", $result);
            break;
        default :
            echo "something went wrong with the selections" ;
            break;
    }
?>

Please assist. Thank you in advance

share|improve this question
1  
This is probably a better fit for SO. –  Joshua Enfield Dec 13 '10 at 4:06
add comment

1 Answer

Try removing break statement that is in the default alternative.

share|improve this answer
    
+1 - You dont need to break using the default when using a switch. Simply end the statement using your } –  JamesK Dec 13 '10 at 9:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.