Ver Mensaje Individual
  #2 (permalink)  
Antiguo 01/02/2016, 06:28
bennykrovert
 
Fecha de Ingreso: febrero-2016
Mensajes: 2
Antigüedad: 8 años, 3 meses
Puntos: 0
Respuesta: Condiciones dependiendo de los primeros dígitos de teléfono.

Ya lo he podido solucionar. Os dejo el planteamiento final:

Código PHP:
Ver original
  1. $intPremium8 = '/^[8-8][0-0][1-9][0-9]*$/';
  2.     $intPremium9 = '/^[9-9][0-0][3-7][0-9]*$/';
  3.     //num int
  4.     $intInternet = '/^[9-9][0-0][8-9][0-9]*$/';
  5.     $int118 = '/^[1-1][1-1][8-8][0-9]*$/';
  6.     $intBasica = '/^[9-9][0-0][1-2][0-9]*$/';
  7.     //num personales
  8.     $intM2M5 = '/^[5-5][9-9][0-0][0-9]*$/';
  9.     $intNomada = '/^[5-5][1-1][1-1][0-9]*$/';
  10.     $expresioMoviles = '/^[6|7][0-9]{8}$/';
  11.     $intDatafono = '/^[1-1][0-9][0-9][0-9]$/';
  12.     $expresioFixes = '/^[8-9][1-9][0-9]*$/';
  13.     $intGratuita = '/^[8-9][0-0][0-0][0-9]*$/';
  14.     $intEmergencias = '/^[0-1][0-9][0-9]$/';
  15.    
  16.    
  17.        
  18.         while ( $cdruser = mysql_fetch_array ( $TrucadesUsuari) ) {
  19.            
  20.              //INTERNACIONALS
  21.              if ( $phoneINT = substr($cdruser['dst'],0,2) == "00" ){
  22.                  $totalsegundosInt = $cdruser['billsec'] + $totalsegundosInt;
  23.                  echo '- int- ';  
  24.                     //NOM PAIS EN UN FUTUR
  25.                     /*$Paisos =  mysql_query ( "SELECT * FROM paises"  ) or die ( mysql_error () );
  26.                     while ( $pais = mysql_fetch_array ($Paisos) ) {
  27.                     }*/
  28.              }
  29.  
  30.               //MOVILS
  31.              else if(preg_match($expresioMoviles,$cdruser['dst'])){
  32.                  echo '- movil -';  
  33.              }
  34.              
  35.              //FIXE
  36.              else if(preg_match($expresioFixes,$cdruser['dst'])){
  37.                  echo '- fixe -';  
  38.              }
  39.              
  40.              //RI GRATUIT
  41.              else if(preg_match($intGratuita,$cdruser['dst'])){
  42.                  echo '- RI GRATUIT -';  
  43.              }
  44.              
  45.              //RI BASIC
  46.              else if(preg_match($intBasica,$cdruser['dst'])){
  47.                  echo '- RI BASIC -';  
  48.              }
  49.              
  50.              //806
  51.              else if(preg_match($intPremium8,$cdruser['dst'])){
  52.                  echo '- Premium 8 -';  
  53.              }
  54.              
  55.              //906
  56.              else if(preg_match($intPremium9,$cdruser['dst'])){
  57.                  echo '- Premium 9 -';  
  58.              }
  59.              
  60.              //118
  61.              else if(preg_match($int118,$cdruser['dst'])){
  62.                  echo '- int118 -';  
  63.              }
  64.              
  65.              //M2M
  66.              else if(preg_match($intM2M5,$cdruser['dst'])){
  67.                  echo '- M2M-';  
  68.              }
  69.              
  70.              //NOMADA
  71.               else if(preg_match($intNomada,$cdruser['dst'])){
  72.                  echo '- Nomada-';  
  73.              }
  74.              
  75.              //INTERNET
  76.              else if(preg_match($intInternet,$cdruser['dst'])){
  77.                  echo '- Internet-';  
  78.              }
  79.              
  80.              //DATAFONO
  81.              else if(preg_match($intDatafono,$cdruser['dst'])){
  82.                  echo '- Datafono-';  
  83.              }
  84.              
  85.              //EMERGENCIES
  86.              else if(preg_match($intEmergencias,$cdruser['dst'])){
  87.                  echo '- Emergencias-';  
  88.              }
  89.              
  90.              //707
  91.              else if($cdruser['dst']== '707' or '704' or '707' or '757' or '770' ){
  92.                  echo '- Num. Personales -';  
  93.              }
  94.              
  95.              
  96.              
  97.         }

Última edición por bennykrovert; 01/02/2016 a las 06:43