Guest User

Untitled

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