Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
musica_listas_topsify
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cristian Mauricio Diaz Canales
musica_listas_topsify
Commits
c8bdd27a
Commit
c8bdd27a
authored
Apr 15, 2019
by
Cristian Mauricio Diaz Canales
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Actualizacion proyecto topsify- Se actualiza msisdn y archivos script
parent
06a8f451
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
177 additions
and
319 deletions
+177
-319
extras/desinscribir.php
extras/desinscribir.php
+0
-82
extras/script_topsify.php
extras/script_topsify.php
+2
-2
extras/suscribir.php
extras/suscribir.php
+0
-94
nbproject/project.xml
nbproject/project.xml
+1
-1
src/Utilities/EntelVPW.php
src/Utilities/EntelVPW.php
+20
-8
src/Utilities/Utiles.php
src/Utilities/Utiles.php
+153
-131
templates/frontend/includes/modal_validar_msisdn.html.twig
templates/frontend/includes/modal_validar_msisdn.html.twig
+1
-1
No files found.
extras/desinscribir.php
deleted
100644 → 0
View file @
06a8f451
<?php
/**
* ###################
* 1-INICIO SESION PHP
* ###################
*
*/
if
(
session_id
()
==
''
||
!
isset
(
$_SESSION
))
{
session_start
();
}
/**
* ###################
* 2-INICIO VARIABLES PHP
* ###################
*
*/
$status_code
=
null
;
$desc
=
''
;
$xmlOutput
=
''
;
$xmlDesc
=
''
;
$output
=
''
;
/**
* ###################
* 3-TRATAMIENTO URL Y XML PHP
* ###################
*
*/
$params
=
urldecode
(
$_SERVER
[
'QUERY_STRING'
]);
$url
=
"http://vpwproxy.vas.entelpcs.cl/vpw.php?#PARAMETROS"
;
$url
=
str_replace
(
'#PARAMETROS'
,
$params
,
$url
);
$msisdn
=
$_POST
[
"msisdn"
];
$xml
=
"<?xml version='1.0' encoding='UTF-8'?><unsubscribe><entry>569"
.
$msisdn
.
"</entry></unsubscribe>"
;
/**
* ###################
* 4-LLAMADO A CURL
* ###################
*
*/
try
{
$ch
=
curl_init
(
$url
);
curl_setopt
(
$ch
,
CURLOPT_POST
,
1
);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
$xml
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$ch
,
CURLOPT_TIMEOUT
,
60
);
$output
=
curl_exec
(
$ch
);
$xmlDesc
=
$output
;
$status_code
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
curl_close
(
$ch
);
$xmlOutput
=
simplexml_load_string
(
$output
);
if
(
isset
(
$xmlOutput
->
error
))
{
$desc
=
(
string
)
$xmlOutput
->
error
;
}
else
if
(
isset
(
$xmlOutput
->
info
))
{
$desc
=
(
string
)
$xmlOutput
->
info
;
}
if
(
$desc
==
""
)
{
switch
(
$status_code
)
{
case
300
:
$desc
=
"No fue posible consultar plan."
;
break
;
case
403
:
$desc
=
"IP no autorizada."
;
break
;
}
}
}
catch
(
\Exception
$e
)
{
$status_code
=
null
;
$desc
=
null
;
}
/**
* ###################
* 5-RESULTADO CURL
* ###################
*
*/
//echo '{"desc" : "'.$desc.'", "status_code" : '.$status_code.', "callbackUrl" : "'.$url.'"}';
echo
"
$desc
|
$status_code
|
$xmlDesc
"
;
extras/script_topsify.php
View file @
c8bdd27a
...
...
@@ -57,7 +57,7 @@ if(empty($params)){
write_log
(
"Retorno con msisdn"
,
"INFO"
);
write_log
(
$urlRetorno
,
"INFO"
);
write_log
(
$msisdn
,
"INFO"
);
$msisdn
=
substr
(
$msisdn
,
3
);
$msisdn
=
substr
(
$msisdn
,
2
);
header
(
"Location: http://new.topsify.cl?msisdn=
$msisdn
"
);
die
();
}
...
...
@@ -93,7 +93,7 @@ if (!$check) {
*/
if
(
isset
(
$_COOKIE
[
'User-Identity-Forward-msisdn'
])
&&
$_COOKIE
[
'User-Identity-Forward-msisdn'
]
!=
""
)
{
$msisdn
=
substr
(
$_COOKIE
[
'User-Identity-Forward-msisdn'
],
-
11
);
$msisdn
=
substr
(
$_COOKIE
[
'User-Identity-Forward-msisdn'
],
-
9
);
write_log
(
"COOKIE identificada"
,
"INFO"
);
write_log
(
"
$msisdn
obtenido"
,
"INFO"
);
header
(
"Location: http://new.topsify.cl?msisdn=
$msisdn
"
);
...
...
extras/suscribir.php
deleted
100644 → 0
View file @
06a8f451
<?php
/**
* ###################
* 1-INICIO SESION PHP
* ###################
*
*/
if
(
session_id
()
==
''
||
!
isset
(
$_SESSION
))
{
session_start
();
}
/**
* ###################
* 2-INICIO VARIABLES PHP
* ###################
*
*/
$status_code
=
null
;
$desc
=
''
;
$xmlOutput
=
''
;
$xmlDesc
=
''
;
$output
=
''
;
/**
* ###################
* 3-TRATAMIENTO URL Y XML PHP
* ###################
*
*/
$params
=
urldecode
(
$_SERVER
[
'QUERY_STRING'
]);
$url
=
"http://vpwproxy.vas.entelpcs.cl/vpw.php?#PARAMETROS"
;
$url
=
str_replace
(
'#PARAMETROS'
,
$params
,
$url
);
$msisdn
=
$_POST
[
"msisdn"
];
$xml
=
"<?xml version='1.0' encoding='UTF-8'?><subscribe><entry>569"
.
$msisdn
.
"</entry></subscribe>"
;
/**
* ###################
* 4-LLAMADO A CURL
* ###################
*
*/
try
{
$ch
=
curl_init
(
$url
);
curl_setopt
(
$ch
,
CURLOPT_POST
,
1
);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
$xml
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$ch
,
CURLOPT_TIMEOUT
,
60
);
$output
=
curl_exec
(
$ch
);
$xmlDesc
=
$output
;
$status_code
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
curl_close
(
$ch
);
$xmlOutput
=
simplexml_load_string
(
$output
);
if
(
isset
(
$xmlOutput
->
error
))
{
$desc
=
(
string
)
$xmlOutput
->
error
;
}
else
if
(
isset
(
$xmlOutput
->
info
))
{
$desc
=
(
string
)
$xmlOutput
->
info
;
}
if
(
$desc
=
""
)
{
switch
(
$status_code
)
{
case
300
:
$desc
=
"No fue posible consultar plan."
;
break
;
case
402
:
$desc
=
"El movil no tiene saldo."
;
break
;
case
501
:
$desc
=
"Fallo en la configuracioon de validacion."
;
break
;
case
302
:
$desc
=
"El movil ya esta agendado."
;
break
;
case
415
:
$desc
=
"El movil no es compatible."
;
break
;
case
410
:
$desc
=
"El movil no tiene perfil compatible"
;
break
;
}
}
}
catch
(
\Exception
$e
)
{
$status_code
=
null
;
$desc
=
null
;
}
/**
* ###################
* 5-RESULTADO CURL
* ###################
*
*/
//echo '{"desc" : "'.$desc.'", "status_code" : '.$status_code.', "callbackUrl" : "'.$url.'"}';
echo
"
$desc
|
$status_code
|
$xmlDesc
"
;
nbproject/project.xml
View file @
c8bdd27a
...
...
@@ -3,7 +3,7 @@
<type>
org.netbeans.modules.php.project
</type>
<configuration>
<data
xmlns=
"http://www.netbeans.org/ns/php-project/1"
>
<name>
musica_listas
</name>
<name>
topsify
</name>
</data>
</configuration>
</project>
src/Utilities/EntelVPW.php
View file @
c8bdd27a
...
...
@@ -45,7 +45,7 @@ class EntelVPW {
);
$xml
=
"<?xml version='1.0' encoding='UTF-8'?><subscribe><entry>56
9
"
.
$msisdn
.
"</entry></subscribe>"
;
$xml
=
"<?xml version='1.0' encoding='UTF-8'?><subscribe><entry>56"
.
$msisdn
.
"</entry></subscribe>"
;
$url
=
self
::
URL_EXTERNAL_VPW_SUSCRIBIR
;
$url
=
str_replace
(
'#PARAMETROS'
,
http_build_query
(
$params
),
$url
);
...
...
@@ -68,9 +68,15 @@ class EntelVPW {
curl_close
(
$ch
);
$log
->
debug
(
'Retorno status a suscribir externo:'
.
$status_code_suscribir
.
' | desc:'
.
$output
);
$data
=
explode
(
"|"
,
$output
);
$status_code
=
$data
[
1
];
$desc
=
$data
[
0
];
$xmlDesc
=
$data
[
2
];
if
(
count
(
$data
)
>
1
){
$status_code
=
$data
[
1
];
$desc
=
$data
[
0
];
$xmlDesc
=
$data
[
2
];
}
else
{
$status_code
=
0
;
$desc
=
""
;
$xmlDesc
=
""
;
}
}
catch
(
\Exception
$e
)
{
$log
->
err
(
' Error al suscribir. url:'
.
$url
.
' .Exception: '
.
$e
);
$status_code
=
null
;
...
...
@@ -119,7 +125,7 @@ class EntelVPW {
'code'
=>
$lista
->
getLisCode
()
);
$xml
=
"<?xml version='1.0' encoding='UTF-8'?><unsubscribe><entry>56
9
"
.
$msisdn
.
"</entry></unsubscribe>"
;
$xml
=
"<?xml version='1.0' encoding='UTF-8'?><unsubscribe><entry>56"
.
$msisdn
.
"</entry></unsubscribe>"
;
$url
=
self
::
URL_EXTERNAL_VPW_DESUSCRIBIR
;
$url
=
str_replace
(
'#PARAMETROS'
,
http_build_query
(
$params
),
$url
);
...
...
@@ -141,9 +147,15 @@ class EntelVPW {
curl_close
(
$ch
);
$log
->
debug
(
'Retorno status a suscribir externo:'
.
$status_code_desuscribir
.
' | desc:'
.
$output
);
$data
=
explode
(
"|"
,
$output
);
$status_code
=
$data
[
1
];
$desc
=
$data
[
0
];
$xmlDesc
=
$data
[
2
];
if
(
count
(
$data
)
>
1
){
$status_code
=
$data
[
1
];
$desc
=
$data
[
0
];
$xmlDesc
=
$data
[
2
];
}
else
{
$status_code
=
0
;
$desc
=
""
;
$xmlDesc
=
""
;
}
}
catch
(
\Exception
$e
)
{
$log
->
err
(
' Error al desuscribir. url:'
.
$url
.
' .Exception: '
.
$e
);
$status_code
=
null
;
...
...
src/Utilities/Utiles.php
View file @
c8bdd27a
This diff is collapsed.
Click to expand it.
templates/frontend/includes/modal_validar_msisdn.html.twig
View file @
c8bdd27a
...
...
@@ -16,7 +16,7 @@
<form
class=
"form-horizontal"
action=
"/"
method=
"post"
>
<div
class=
"form-group"
>
<div
class=
"col-md-12"
>
<input
class=
"form-control focused"
id=
"msisdn"
name=
"msisdn"
pattern=
".{
8,8}"
required
title=
"Debe ingresar 8 números"
type=
"text"
placeholder=
"Ej:
74867425"
>
<input
class=
"form-control focused"
id=
"msisdn"
name=
"msisdn"
pattern=
".{
9,9}"
required
title=
"Debe ingresar 9 números"
type=
"text"
placeholder=
"Ej:9
74867425"
>
</div>
</div>
</form>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment