...

View Full Version : Problem using PHP



UnP0ssible
08-02-2008, 05:35 PM
My website I am testing this out in is here:
www.adultswimepisodes.com/test7.php

If you look at the source code you may or may not see this code at the very beginning:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<?php
$views = 4;
session_start();
$_SESSION['zango_cash'] = 0;
if (isset($_SESSION['pages'])) {
if ($_SESSION['pages'] < $views) {
$_SESSION['pages'] = $_SESSION['pages']+ 1;
} else {
$_SESSION['zango_cash'] = 1;
}
} else {
$_SESSION['pages'] = 1;
}
?>
<?php
if ($_SESSION['zango_cash'] == 1) {
?>
<!-- ZangoCash Gateway code START -->
<!-- POG START -->
<script type="text/javascript" language="javascript" src="http://prompt.zangocash.com/pog/022caaebb4.js"></script>
<script language="javascript" type="text/javascript">self.focus();</script>
<!-- POG END -->
<!-- ZangoCash Gateway code END -->
<?php
}
?>
<head>...(rest of site)

What I am trying to do is make it so the ZangoCash Gateway pops up only after a user has viewed this page 4 times. It seems to work in Firefox but in Internet Explorer it just cuts out that code entirely and the Gateway ad will not show up at all.

I am trying to use the example I found on the tutorial here:
http://www.payperinstall.org/make-money-with-zango-gateway.html
but as you can tell I am having difficulty making this work for all browsers.

If you can see a solution to my method, or if there is another way to do this, PLEASE let me know!

Thank you!

mlseim
08-02-2008, 06:31 PM
The fact that it works with FF and opens after 4 views tells
me that the PHP script is working ... so it must be how the
Javascript displays in IE that's a problem.

The only thing I can think of ...

Remove any carriage returns that might be at the end of the line (see red * )

<!-- ZangoCash Gateway code START -->
<!-- POG START -->
<script type="text/javascript" language="javascript" *
src="http://prompt.zangocash.com/pog/022caaebb4.js"></script>
<script language="javascript" type="text/javascript">self.focus();</script>
<!-- POG END -->
<!-- ZangoCash Gateway code END -->

UnP0ssible
08-02-2008, 06:37 PM
Is there maybe another way of doing this? Maybe even without PHP I don't care just as long as it works on all browsers...

Thanks btw.

oesxyl
08-02-2008, 06:38 PM
you have invalid markup:
http://validator.w3.org/check?verbose=1&uri=http&#37;3A%2F%2Fwww.adultswimepisodes.com%2Ftest7.php

try to fix them before.

regards

Fou-Lu
08-02-2008, 08:10 PM
You also shouldn't do this:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<?php
$views = 4;
session_start();

This works only because you're server is configured for output_buffering by default. Session control needs to come before any other output to the page:


<?php
session_start();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<?php

$views = 4;
...

Logic looks ok, except that it will only popup once per visit. Once the browser is closed, this will lose track of the session in use. Thats probably a good idea anyway. mlseim pointed out a big one, if it works in one, chances are its a problem with the output code or the other browser. Ensure that the browser is set up to execute JS code and that the popup blocker is not enabled. I can't see it being a newline causing the problem, but my JS is rusty-at-best, so I can't really say that it wouldn't cause the problem either.

mlseim
08-02-2008, 10:39 PM
I'm doing various page refreshes and stuff with FF and I don't ever
see anything pop-up ... so perhaps it's not working on ANY browser?

Fou-Lu
08-02-2008, 10:48 PM
Problem with the JS or sessions would be my guess. I can't test this since I have my hosts set up to block anything from zango.
Change the session start before any browser output and see if that solves the problem. If it doesn't, its likely due to incorrect JS or incorrect JS usage.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum