Jump to content

how to make this code run faster.


mister X

Recommended Posts

Hi. Im wondering is there any way to make the following code run faster.

if($control == "enable" || $control == "disable")

{

fputs ($fp, "config t\n");

if($protocolType == "RIP")

{

if($control == "enable" && $networkAdd != "")

{

fputs ($fp, "router ".$protocolType."\n");

fputs ($fp, "network ".$networkAdd."\n");

$moredetails .= fgets ($fp, 4096);

$moredetails .= fgets ($fp, 4096);

}

elseif($control == "disable" && $networkAdd == "")

{

fputs ($fp, "no router ".$protocolType."\n");

$moredetails .= fgets ($fp, 4096);

}

}

 

//set IGRP || EIGRP || BGP

if($protocolType == "ISO - IGRP" || $protocolType == "EIGRP" || $protocolType == "BGP")

{

if($control == "enable" && $networkAdd != "" && $autoSystem != "")

{

fputs ($fp, "router ".$protocolType." ".$autoSystem."\n");

fputs ($fp, "network ".$networkAdd."\n");

$moredetails .= fgets ($fp, 4096);

$moredetails .= fgets ($fp, 4096);

}

elseif($control == "disable" && $autoSystem != "")

{

fputs ($fp, "no router ".$protocolType." ".$autoSystem."\n");

$moredetails .= fgets ($fp, 4096);

}

}

 

//set OSPF

if($protocolType == "OSPF")

{

if($control == "enable" && $processID != "" && $networkAdd != "" && $wlidcardMask != "" && $areaNo != "")

{

fputs ($fp, "router ".$protocolType." ".$processID."\n");

fputs ($fp, "network ".$networkAdd." ".$wlidcardMask." area"." ".$areaNo."\n");

 

$moredetails .= fgets ($fp, 4096);

$moredetails .= fgets ($fp, 4096);

}

elseif($control == "disable" && $processID != "")

{

fputs ($fp, "no router ".$protocolType." ".$processID."\n");

$moredetails .= fgets ($fp, 4096);

}

}

 

//exit from config. mode

fputs ($fp,"exit\n");

fputs ($fp, "\r");

if(stristr($zxc,$routername[0].'(config)#'))

{

fputs ($fp,"exit\n");

fputs ($fp, "\r");

}

}

 

Link to comment
https://forums.phpfreaks.com/topic/168767-how-to-make-this-code-run-faster/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.