Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem using PHP

    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-mo...o-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!

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,549
    Thanks
    8
    Thanked 1,095 Times in 1,086 Posts
    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 -->

  • #3
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    you have invalid markup:
    http://validator.w3.org/check?verbos...om%2Ftest7.php

    try to fix them before.

    regards

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    You also shouldn't do this:
    PHP Code:
    <!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 Code:
    <?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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • Users who have thanked Fou-Lu for this post:

    oesxyl (08-02-2008)

  • #6
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,549
    Thanks
    8
    Thanked 1,095 Times in 1,086 Posts
    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?

  • #7
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •