Guest User

Untitled

a guest
Jul 18th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.53 KB | None | 0 0
  1. <form action="" method="POST"> 
  2. <textarea name="prueba"></textarea><br>
  3. <input type="submit" name="e" />   
  4. </form>
  5.  
  6. <?php  
  7. ob_start();
  8. echo str_pad('',4096);
  9. function flushi(){
  10.     ob_end_flush();
  11.     ob_flush();
  12.     flush();
  13.     ob_start();
  14. }
  15.  
  16. if(isset($_POST['prueba'])) { // if isset $_POST   
  17.  
  18.     $a           = explode("\n", $_POST['prueba']);
  19.     $extensiones = count($a);
  20.     $entidad     = 129; // en el cs, "ippstat d <ext> | grep domain" y sale
  21.     $nodo        = 110; // bdg
  22.     $mla         = 3; // ni idea
  23.     $exten       = array();
  24.     $ext         = array();
  25.     $sterm       = '';
  26.  
  27.     foreach($a as $e) if(!empty($e)) $lin[] = explode("\t", trim($e));
  28.     //var_dump($lin);
  29.     for($i=0;$i<count($lin);$i++) {
  30.         $ext[$i]['ext'] = $lin[$i][0];
  31.         $ext[$i]['nombre'] = $lin[$i][4];
  32.         $ext[$i]['ga'] = $lin[$i][7];
  33.     }
  34.  
  35.     function crear() {
  36.         global $ext;
  37.         global $nodo;
  38.         $str = '';
  39.         $c = count($ext);
  40.         $teclas = array(1,73,74);
  41.  
  42.         for($x=0;$x<$c;$x++) {
  43.             for($z=0;$z<$c;$z++) {
  44.                 if($z!=$x) {
  45.                     $str .= 'SET Subscriber_Keyboard   "'.$nodo.'": "'.$ext[$x]['ext'].'": "'.$z.'"<br>';
  46.                     $nom = ucfirst(strtolower($ext[$x]['nombre']));
  47.                     $str .= '{<br>';
  48.                     $str .= ' Type = "Station_Supervision",<br>';
  49.                     $str .= ' Directory_Number = "'.$ext[$z]['ext'].'",<br>';
  50.                     $str .= ' Ringing_Mode = "No_Ring",<br>';
  51.                     $str .= ' Key_NOE_Mnemonic1 = "'.$nom.'"<br>';
  52.                     $str .= '}<br>';
  53.                 }
  54.             }
  55.         }
  56.         return $str;
  57.     }
  58.  
  59.     foreach ($ext as $extn) {
  60.         $s = crear();
  61.         echo $s;
  62.         flushi();
  63.     }
  64.  
  65. } // fin if isset $_POST
  66. ?>
Add Comment
Please, Sign In to add comment