Error en rotador de popups

  • Autor Autor seadincperu
  • Fecha de inicio Fecha de inicio
seadincperu

seadincperu

1
Iota
Verificación en dos pasos activada
Verificado por Whatsapp
¡Ha verificado su Paypal!
Suscripción a IA
Hola amigos ando probando un ratador de popups pero tengo un problema:
Parse error: syntax error, unexpected ')', expecting ',' or ';' in /home/demosead/public_html/op.php on line 40

No se mucho php y no entiendo el error aver si alguien se anima a ayudarme, aqui les dejo el codigo:

PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>

<body>
 <?php
 $numpops = 2 ; //Numero de PopUps a rotar.$random = rand(1,$numpops);
$url = array();


$url[1] = " http://www.tuweb1.com ";
$url[2] = " http://www.tuweb2.com ";

echo "<script>
var popunder=\"$url[$random]\"
var winfeatures=\"width=700,height=500,scrollbars=1,resizable=1,toolbar=1,location=1,
menubar=1,status=0,directories=0\"
 var once_per_session=0
 function get_cookie(Name) {
var search = Name + \"=\"
var returnvalue = \"\";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(\";\", offset);
// set index of end of cookie value
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
} 
function loadornot(){
if (get_cookie('popunder')=="){
loadpopunder()
document.cookie=\"popunder=yes\"
}
} 
 function loadpopunder(){
win2=window.open(popunder,\"\",winfeatures)
win2.blur()
window.focus()
} 
 if (once_per_session==0)
loadpopunder()
else
loadornot()
</script> ";
 ?>
</body>
</html>

Saludos :encouragement:

---------- Post agregado el 13-jul-2013 hora: 20:05 ----------

No hay nadie que me ayude?, le doy 2 dolares al que me pueda ayudar o brindarme otro codigo de rotador, saludos :encouragement:
 
Ese error te sale cuando 1) te falta una coma "," o punto y coma ";"

Y en el caso de tu código que es un JavaScript dentro de un PHP el error puede estar en meter una comilla doble sin meterle código de escape (la \ diagonal que va antes de cada comilla doble).

Según tu código (y viendolo a ojo de buen cubero) el error está aquí:
Insertar CODE, HTML o PHP:
if (get_cookie('popunder')=="){

Pones una doble comilla en lugar de dos comillas simples ' ' cámbialo y pruebalo.

Saludos
 
Perfecto ya no sale el error 😎, pero ahora no funciona la variable var popunder=\"$url[$random]\" , ya que no genera alteatoriamente
$url[1] = " http://www.tuweb1.com ";
$url[2] = " http://www.tuweb2.com ";

A que se debe ?
Ese error te sale cuando 1) te falta una coma "," o punto y coma ";"

Y en el caso de tu código que es un JavaScript dentro de un PHP el error puede estar en meter una comilla doble sin meterle código de escape (la \ diagonal que va antes de cada comilla doble).

Según tu código (y viendolo a ojo de buen cubero) el error está aquí:
Insertar CODE, HTML o PHP:
if (get_cookie('popunder')=="){

Pones una doble comilla en lugar de dos comillas simples ' ' cámbialo y pruebalo.

Saludos


---------- Post agregado el 16-jul-2013 hora: 16:13 ----------

El código quedo así:

PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<?php
$numpops = 2 ; //Numero de PopUps a rotar.$random = rand(1,$numpops);
$url = array();


$url[1] = " http://www.tuweb1.com ";
$url[2] = " http://www.tuweb2.com ";

echo "<script>
var popunder=\"$url[$random]\"
var winfeatures=\"width=700,height=500,scrollbars=1,resizable=1,toolbar=1,location=1,
menubar=1,status=0,directories=0\"
 var once_per_session=0
 function get_cookie(Name) {
var search = Name + \"=\"
var returnvalue = \"\";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(\";\", offset);
// set index of end of cookie value
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
} 
function loadornot(){
if (get_cookie('popunder')==''){
loadpopunder()
document.cookie=\"popunder=yes\"
}
} 
 function loadpopunder(){
win2=window.open(popunder,\"\",winfeatures)
win2.blur()
window.focus()
} 
 if (once_per_session==0)
loadpopunder()
else
loadornot()
</script> ";
 ?>
</head>

<body>
 fgggfgf
</body>
</html>
 
Perfecto ya no sale el error 😎, pero ahora no funciona la variable var popunder=\"$url[$random]\" , ya que no genera alteatoriamente
$url[1] = " http://www.tuweb1.com ";
$url[2] = " http://www.tuweb2.com ";

A que se debe ?

Se debe a que en tu codigo no haz colocado el comando para hacer el random (aleatoreo).
Insertar CODE, HTML o PHP:
$random = rand(1,$numpops);

Colócalo después de array() asi:

PHP:
<?php
$numpops = 2 ; //Numero de PopUps a rotar.$random = rand(1,$numpops);
$url = array();

$url[1] = " http://www.tuweb1.com ";
$url[2] = " http://www.tuweb2.com ";

$random = rand(1,$numpops);
 
Perfecto amigo ahora esta que rota el url una pregunta, el pop up no se abre ahora es problema de lo que va dentro de <script> </script> ? , saludos amigo gracias :encouragement:
Se debe a que en tu codigo no haz colocado el comando para hacer el random (aleatoreo).
Insertar CODE, HTML o PHP:
$random = rand(1,$numpops);

Colócalo después de array() asi:

PHP:
<?php
$numpops = 2 ; //Numero de PopUps a rotar.$random = rand(1,$numpops);
$url = array();

$url[1] = " http://www.tuweb1.com ";
$url[2] = " http://www.tuweb2.com ";

$random = rand(1,$numpops);


---------- Post agregado el 16-jul-2013 hora: 21:56 ----------

Asi queda el codigo de fuente al subirlo al host:

PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
 <script>
var popunder="http://seadinc.net/"
var winfeatures="width=700,height=500,scrollbars=1,resizable=1,toolbar=1,location=1,
menubar=1,status=0,directories=0"
 var once_per_session=0
 function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
} 
function loadornot(){
if (get_cookie('popunder')==''){
loadpopunder()
document.cookie="popunder=yes"
}
} 
 function loadpopunder(){
win2=window.open(popunder,"",winfeatures)
win2.blur()
window.focus()
} 
 if (once_per_session==0)
loadpopunder()
else
loadornot()
</script> </head>

<body>
 fgggfgf
</body>
</html>
 
Atrás
Arriba