SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 41 of 41
  1. #26
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    OK, time to do some debugging.

    PHP Code:
    function increment_stats_count($conn) {
        die(
    'Click increment point reached!');
        
    mysql_query("update stats set clicks = clicks + 1"$conn) or die (mysql_error());

    Try that. What's the point? Well, if you see 'Click increment point reached!' appearing, at least we know the function is being called. If it doesn't appear, then there's something going wrong somewhere else...

    Edit>>
    One more idea... have you actually selected the database proxies_stats in your script?

    PHP Code:
        mysql_query("update proxies_stats.stats set clicks = clicks + 1"$conn) or die (mysql_error()); 

  2. #27
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah

    Well the message was not displayed

    I just tried your edit, no updates

    full script

    Code:
    $dbhost = 'localhost';
    $dbuser = 'proxies_admin';
    $dbpass = 'passwordremoved;
    
    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die                      ('Error connecting to mysql');
    
    $dbname = 'proxies_stats';
    mysql_select_db($dbname);
    
    /* Place the following on your form handling page */
    function increment_stats_count($conn) {
        die('Click increment point reached!');
     mysql_query("update proxies_stats.stats set clicks = clicks + 1", $conn) or die (mysql_error()); 
    }
      if(isset($_POST['browse']))
    {
        increment_stats_count($conn);
    }

  3. #28
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    OK, so the function isn't being called.

    More debug:

    PHP Code:

    echo "<pre>".print_r($_POST)."</pre>";

    if(isset(
    $_POST['browse']))
    {
        
    increment_stats_count($conn);

    This'll show you what's in $_POST. It seems as though $_POST['browse'] isn't set...



    Edit>>
    Tidied your code up a bit.
    PHP Code:
    <?php

    echo "<pre>".print_r($_POST1)."</pre>";

    $dbhost 'localhost';
    $dbuser 'proxies_admin';
    $dbpass 'passwordremoved';

    $conn mysql_connect($dbhost$dbuser$dbpass) or die('Error connecting to mysql');

    mysql_select_db('proxies_stats'$conn);


    function 
    increment_stats_count($conn) {
        die(
    'Click increment point reached!');
        
    mysql_query("update proxies_stats.stats set clicks = clicks + 1"$conn) or die (mysql_error()); 
    }


    if(isset(
    $_POST['browse']))
    {
        
    increment_stats_count($conn);
    }

    ?>

  4. #29
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I get a very werid, unrelated msg:

    Code:
    Array ( )
    
    1
    
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/proxies/public_html/index.php:18) in /home/proxies/public_html/proxy_system.php on line 627
    Code:
    function increment_stats_count($conn) {
        die('Click increment point reached!');
     mysql_query("update proxies_stats.stats set clicks = clicks + 1", $conn) or die (mysql_error()); 
    }
    echo "<pre>".print_r($_POST)."</pre>";
    
    if(isset($_POST['browse']))
    {
        increment_stats_count($conn);
    }
    Is that the correct code?

  5. #30
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    Sorry, should have been:

    PHP Code:
    echo "<pre>".print_r($_POST1)."</pre>"
    But it doesn't matter anymore, I can see all I need to know.

    $_POST is empty.

    Is the button part of a form that has method="post"?

    Or is a button that works in some other way?

  6. #31
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <div>
    <input type="submit" name="browse" value="Browse Website Safely" onclick="return submit_form();" />
    </div>
    </form>

    Is this what you are talking about?

  7. #32
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    OK, that looks fine. What does the function submit_form() do?

  8. #33
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm really not sure - it's part of PHProxy script

  9. #34
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    OK, try putting this at the top of the page:

    PHP Code:
    echo "<pre>".print_r($GLOBALS1)."</pre>"
    THat'll echo out just about every variable there is. Be quick though, as it might also print out passwords and stuff. So put that in, press the button, and then take that line out again so no one else sees it...

    Then, check the output to see if you see anything looking like 'browse'

  10. #35
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is nothing regarding browse

  11. #36
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    Then I'm out of ideas...
    Maybe the authors of PHProxy can help you?

  12. #37
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for all your help Immerse I'll see what I can do!

  13. #38
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Can you shows as the submit_form() code?
    Saul

  14. #39
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    if(isset($_POST['browse']))
    If someone enters a URL to view through the proxy and presses enter to submit the form, the submit button won't be in $_POST. It's also possible the javascript doesn't submit that value either. I would use a different test to see if the proxy form was submitted.

  15. #40
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    Input's of type submit are available in post, aren't they?
    The strange thing here is that the entire $_POST superglobal is empty.

    Ooh, that gives me an idea!

    CWN, what version of PHP are you running on?

  16. #41
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure - I think 5


Bookmarks

Posting Permissions

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