SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 41
  1. #1
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Keeping Stats on Button Clicked

    Hi,

    Let's say I have a button:

    Code:
    <input type="submit" name="browse" value="Browse Website Safely" onclick="return submit_form();" />
    I would like to keep record of how many times this button has been clicked. How can I do this? Thank you

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2005
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What you can do is have an if statement check for either $_POST['browse'] or $_GET['browse'] being submitted on whatever "action" you are taking with the form and have a simple SQL insert query or write it to a txt file.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Location
    Brisbane, Australia
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is a simple php database counter
    PHP Code:
    /* Place the following on your form handling page */
    function increment_stats_count()
    {
        
    $q mysql_query('select count from stats');
        
    $f mysql_fetch_assoc($q);
        
    $i $f['count'];
        
    $i++;
        
    $q mysql_query("update stats set count = '$i'");
    }

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


  4. #4
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    pixag employee thanks very much for that!

  5. #5
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    It doesn't appear to work.
    
    <?
    
    $dbhost = 'localhost';
    $dbuser = 'gdgd';
    $dbpass = 'adga';
    
    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die                      ('Error connecting to mysql');
    
    $dbname = 'proagads';
    mysql_select_db($dbname);
    and then i created a database, i created "stats" in stats i put "count"

    am I missing something?

  6. #6
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Location
    Brisbane, Australia
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So you have created a table with a column named count (column type = INT or alternatively MEDIUMINT) and a row with a count field set to say... 1.

    Ok, now what (if any) error message are you getting?

  7. #7
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I have created the database proxies_stats, table "stats", filed "count" and added "1"

    There are no errors, simply, when I click the button, I see no stats change in the table

  8. #8
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pixag employee
    Here is a simple php database counter
    PHP Code:
    /* Place the following on your form handling page */
    function increment_stats_count()
    {
        
    $q mysql_query('select count from stats');
        
    $f mysql_fetch_assoc($q);
        
    $i $f['count'];
        
    $i++;
        
    $q mysql_query("update stats set count = '$i'");

    That could be much simpler:

    PHP Code:
    function increment_stats_count() {
      
    mysql_query("update stats set count = count + 1");


  9. #9
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow, Dan the man

    But for some reason this isn't working hmm

    code must be above the form right?

  10. #10
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by CWN
    code must be above the form right?
    Maybe if you wrote your program that way, but probably not... code should be in the file the form submits to.

  11. #11
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Will using count as a field name cause the query to fail? You could try changing it to ...
    PHP Code:
    function increment_stats_count() {
        
    mysql_query("update stats set `count` = `count` + 1");

    What does isn't working actually mean? You get an error message .... ?
    Last edited by siteguru; Jul 24, 2006 at 06:26. Reason: Spelling
    Ian Anderson
    www.siteguru.co.uk

  12. #12
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <?
    
    $dbhost = 'localhost';
    $dbuser = 'proxies_admin';
    $dbpass = '324t24t4gaaaaary25';
    
    $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() {
      mysql_query("update stats set count = count + 1");
    } 
      if(isset($_POST['browse']))
    {
        increment_stats_count();
    }
    ?> 
        <input type="submit" name="browse" value="Browse Website Safely" onclick="return submit_form();" />
      </form>
    The stats in the table do not appear to update - no error msgs, just nothing works

    http://fileparrot.com/uploads/image/WuK901q4dn.jpg

  13. #13
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?

    $dbhost 
    'localhost';
    $dbuser 'proxies_admin';
    $dbpass '324t24t4gaaaaary25';

    $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) {
      
    mysql_query("update stats set count = count + 1"$conn)
        or die (
    mysql_error());

      if(isset(
    $_POST['browse']))
    {
        
    increment_stats_count($conn);
    }
    ?>
    And if that doesn't work, try the `count` option.
    Ian Anderson
    www.siteguru.co.uk

  14. #14
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did not see any error messages still (http://proxiesrus.com)

    I really think I set up the table wrong...?

  15. #15
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Location
    Brisbane, Australia
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Grossman
    That could be much simpler:

    PHP Code:
     function increment_stats_count() {
       
    mysql_query("update stats set count = count + 1");
     } 
    Touche. However I was thinking on a much more scaleable level where a simple return $i; could be added to read the current count.

    Anyways, CWN have you tried just a simple update statement for debugging purposes? Run the following and report the results.
    PHP Code:
    <?

    $dbhost 
    'localhost';
    $dbuser 'proxies_admin';
    $dbpass '324t24t4gaaaaary25';

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

    $dbname 'proxies_stats';
    mysql_select_db($dbname);

    // DEBUG
    mysql_query("update stats set `count` = `count` + 1");
    exit;

    ?>

  16. #16
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    pixag employee - when I use your script, nothing below that script appears on the page

    If wrong password is entered in the mysql - "error connecting to mysql" appears. Only when incorrect pass is set however

  17. #17
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay the stats have updated - maybe another user used it. It seems to be only adding if the IP is diffrent? Even button click should be counted

  18. #18
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Location
    Brisbane, Australia
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is no logical reason as to why certain IP's are not working. Can you please post the whole page the script is on?

  19. #19
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <?php require_once("inc/variables.php"); ?>
    <?php
    
    // Change this to your domain (no 'www.')
    $domain="proxiesrus.com";
    
    // If no request:
    if($_GET['q']!=""){
      // Get referer
      $referer=$_SERVER['HTTP_REFERER'];
      // Check to see if referer is not the proxys domain
      $count=substr_count($referer,$domain);
      // If there is an outside referer:
      if($count==0){
        // If there is a request:
        if($_GET['q']!=""){
          // Redirect to homepage and finish script
          header("Location: http://www." . $domain . "/");
          exit();
        }
      }
    }
    
    /*
    END MOD
    */  
    
    require 'proxy_system.php';
    
    $config = array
    (
        'url_var_name'             => 'q',
        'flags_var_name'           => 'hl',
        'get_form_name'            => '__script_get_form',
        'proxy_url_form_name'      => 'poxy_url_form',
        'proxy_settings_form_name' => 'poxy_settings_form',
        'max_file_size'            => -1
    );
    
    $flags = 'prev';
    
    if (isset($_GET[$config['flags_var_name']]))
    {
        $flags = $_GET[$config['flags_var_name']];
    }
    
    $PHProxy = & new PHProxy($config, $flags);
    
    if (isset($_GET[$PHProxy->config['get_form_name']]))
    {
        $url = decode_url($_GET[$PHProxy->config['get_form_name']]);
        $qstr = preg_match('#\?#', $url) ? (strpos($url, '?') === strlen($url) ? '' : '&') : '?';
        $arr = explode('&', $_SERVER['QUERY_STRING']);
        if (preg_match('#^'.$PHProxy->config['get_form_name'].'#', $arr[0]))
        {
            array_shift($arr);
        }
        $url .= $qstr . implode('&', $arr);
        $PHProxy->start_transfer(encode_url($url));
        echo $PHProxy->return_response();
        exit();
    }
    
    if (isset($_GET[$PHProxy->config['url_var_name']]))
    {
        $PHProxy->start_transfer($_GET[$PHProxy->config['url_var_name']]);
        echo $PHProxy->return_response();
        exit();
    }
    
    if (isset($_GET['action'], $_GET['delete']) && $_GET['action'] == 'cookies')
    {
        $PHProxy->delete_cookies($_GET['delete']);
        header("Location: $PHProxy->script_url?action=cookies");
        exit();
    }
    
    if (isset($_POST['username'], $_POST['password'], $_POST['server'], $_POST['realm'], $_POST['auth_url']))
    {
        $PHProxy->request_method = 'GET';
        $PHProxy->url_segments['host'] = decode_url($_POST['server']);
        $PHProxy->set_authorization($_POST['username'], $_POST['password']);
        $PHProxy->start_transfer($_POST['auth_url']);
        echo $PHProxy->return_response();
        exit();
    }
    ?>
    <!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>
    <title>Proxies R Us - We're No Toy! We're a Proxy, and More! Proxy</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="Copyright" content="Proxies R Us"/>
    <meta http-equiv="content-language" content="EN"/>
    <meta name="Rating" content="General"/>
    <meta name="Designer" content="Proxies R Us"/>
    <meta name="Keywords" content="Free Proxy, Free Web Proxy, Free Proxy List, Proxy Lists, Free Anonymous Browsing, Free Text Message Proxy, Flash Game Arcade"/>
    <meta name="revisit-after" content="1"/>
    <meta name="Robots" content="index,follow"/>
    <meta name="Description" content="We're No Toy! We're a Proxy, and More! Proxy, Flash Game Arcade, Text Messaging and Software"/>
    <meta http-equiv="Cache-Control" content="no-cache"/>
    <meta http-equiv="Expires" content="0"/>
    <meta name="Author" content="Proxies R Us"/>
    <link rel="shortcut icon" href="images/favicon.ico"/>
    <link href="css/1.css" rel="stylesheet" type="text/css" />
    <script src="js/javascript.js" type="text/javascript"></script>
    </head>
    
    <body>
    <center>
    		<div id="menu"><?php include("inc/header.php"); ?></div>
    		
    		<div id="header">
              <h1>
                <?=$title?>
              </h1>
    		  <span class="submenu">
              <h2>
                <?=$subtext?>
              </h2>
    	      </span>
              <h3>
                <?php include("inc/sublinks.php"); ?>
                <?php include("inc/useronline.php"); ?>
              </h3>
      </div>
    		
    		<div id="content">
    		
    		<img src="images/icons/proxy.gif" alt="Proxies R Us Logo" width="100" height="100" class="logo" />
    		
    		  <p><span class="introduction">Proxies R Us is a anonymous proxy that lets you make indirect connections hiding all your personal information. This means you can browse all your favourite websites, like Myspace, eBay, whatever you like. With Proxies R Us, you can browse websites when you get banned. You can easily
    bypass webfilters that are set up by the school or company server you want to visit the site from. In additon, we have an arcade setup, for you all your gaming needs. A text messaging system to chat with friends, and more! </span></p>
    		  <div id="sidebar">
    						<h1>SPONSORS</h1>
    			            <div class="submenu">
    			    <?php include("inc/sponsors.php"); ?>
    			</div>
    				
    				<h1>fun links </h1>
    					<div class="submenu">
                        <?php include("inc/link_display.php"); ?>
                        </div>
    					
    					
    					<h1>ADVERTISEMENTS</h1>
    					<div class="submenu">
                            <?php include("inc/3.php"); ?>
    					</div>
    </div>				
    		  <div id="mainbar">
    						<h1>PROXY, BROWSE SAFELY!</h1>
    											
                            <noscript>
                              <div align="center"><big>You have Javascript disabled. Please enable it to use the proxy</big>.</div>
                            </noscript>
    <?php
    
    if (isset($_GET['error']))
    {
        echo '<div><b>Error:</b> ' . htmlspecialchars($_GET['error']) . '</div>';
        if (isset($_GET['retry']))
        {
            echo '<div><a href="'. $PHProxy->proxify_url(decode_url($_GET['retry'])) .'">Retry</a></div>';
        } 
    }
    
    if (isset($_GET['action']))
    {
        if ($_GET['action'] == 'cookies')
        {
            $cookies = $PHProxy->get_cookies('COOKIE', false);
    
            if (!empty($cookies))
            {
                echo '<table style="width: 470px">';
                echo '<tr><td colspan="5"><a href="?action=cookies&delete=all">Clear All Cookies</a></td></tr>';
                echo '<tr><td>Name</td><td class="head">Domain</td><td>Path</td><td>Value</td><td>Action</td></tr>';
    
                for ($i = 0; $i < count($cookies); $i++)
                {
                    $j = $i&1 ? ' class="shade"' : '';
                    echo "<tr><td$j>{$cookies[$i][0]}</td><td$j>{$cookies[$i][1]}</td><td$j>{$cookies[$i][2]}</td>"
                       . "<td$j>" . wordwrap($cookies[$i][3], 15, ' ') ."</td><td$j><a href=". '"?action=cookies&delete='. md5(implode('', $cookies[$i])) . '">delete</a></td></tr>';
                }
    
                echo '</table>';
            }
            else
            {
                echo '<div>No cookies available.</div>';
            }
        }
        else if ($_GET['action'] == 'auth' && isset($_GET['server'], $_GET['realm'], $_GET['auth_url']))
        {
            echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">';
            echo '<input type="hidden" name="server" value="'. $_GET['server'] .'" />';
            echo '<input type="hidden" name="realm" value="'. $_GET['realm'] .'" />';
            echo '<input type="hidden" name="auth_url" value="'. $_GET['auth_url'] .'" />';
            echo '<table style="width: 470pxpx">';
            echo '<tr><td colspan="2">Enter user name and password for <b>' . decode_url($_GET['realm']) . '</b> at <i>' . decode_url($_GET['server']) . '</i></td></tr>';
            echo '<tr><td width="470px">User name</td><td class="option"><input type="text" name="username" value="" /></td></tr>';
            echo '<tr><td width="470px">Password</td><td class="option"><input type="password" name="password" value="" /></td></tr>';
            echo '<tr><td colspan="2" style="text-align: center"><input type="submit" value="OK" /></td></tr>';
            echo '</table>';
            echo '</form>';
        }
    } 
    else
    {
      ?>
      <form name="<?php echo $PHProxy->config['proxy_url_form_name'] ?>" method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">
      <input type="hidden" name="<?php echo $PHProxy->config['url_var_name'] ?>" value="" id="url_input" />
      <input type="hidden" name="<?php echo $PHProxy->config['flags_var_name'] ?>" value="" />
      </form>
      <script type="text/javascript"><!--
    google_ad_client = "pub-5621700549651235";
    google_ad_width = 468;
    google_ad_height = 60;
    google_ad_format = "468x60_as";
    google_ad_type = "text";
    google_ad_channel ="";
    google_color_border = "FFFFFF";
    google_color_bg = "FFFFFF";
    google_color_link = "4D87CE";
    google_color_text = "000000";
    google_color_url = "4D87CE";
    //--></script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
      <form name="<?php echo $PHProxy->config['proxy_settings_form_name'] ?>" method="get" action="" onsubmit="return submit_form();">
      <table style="width: 90%">
      <tr><td style="width: 30%">URL</td><td style="width: 80%">&nbsp;<input name="url" type="text" class="textbox" value="" size="50" /></td></tr>
      <?php echo $PHProxy->options_list(true, true) ?>
      <tr><td style="width: 30%">New Window</td><td style="width: 80%"><input type="checkbox" name="new_window" />Open URL in a new window </td></tr>
      </table>
      <div align="center"><script type="text/javascript"><!--
    google_ad_client = "pub-5621700549651235";
    google_ad_width = 468;
    google_ad_height = 60;
    google_ad_format = "468x60_as";
    google_ad_type = "text";
    google_ad_channel ="";
    google_color_border = "FFFFFF";
    google_color_bg = "FFFFFF";
    google_color_link = "4D87CE";
    google_color_text = "000000";
    google_color_url = "4D87CE";
    //--></script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script><br />
    <?
    
    $dbhost = 'localhost';
    $dbuser = 'proxies_admin';
    $dbpass = '324t24t4gaaaaary25';
    
    $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) {
      mysql_query("update stats set count = count + 1", $conn)
        or die (mysql_error());
    }
      if(isset($_POST['browse']))
    {
        increment_stats_count($conn);
    }
    ?> 
        <input type="submit" name="browse" value="Browse Website Safely" onclick="return submit_form();" />
      </div>
      </form>
      <center>
    	<h1>WHAT IS MY IP? </h1>
        <?php
    echo '<p><span class="info">Your IP is</span><span class="ip"> <b>'.$_SERVER["REMOTE_ADDR"].'</b><br>
      <br> 
    </span><span class="info"><strong>Definition:</strong> The Internet Protocol (IP) is a network layer protocol that moves data between host computers.</span></p>
    <p><span class="info"><strong>Importance:</strong> If your IP is publicly displayed, it can be very harmful to your computer. To prevent problems, use the proxy form above. Be safe!</span></p>';
    ?>
    	<h1>WHAT IS MY BROWSER? </h1>
    	    <?php
    echo '<span class="info">You are using the browser <strong>'.$_SERVER["HTTP_USER_AGENT"].'</strong></span><br>
     <br>';
    echo '<a href="software.php" class="info">We reccomend using Mozila FireFox for a safer internet experience!</a>';
    ?>
            <br />
            <br />
            <br />
            <h1>WEBSITE POPULARITY/INFO CHECK </h1>
            <span class="submenu">
            <?php include("inc/website_checker.php"); ?>
            </span><br />
            <br />
      </center>
      </div>
      <p>
        <br />
        <?php
    }
    ?>
      </p>
              <p>&nbsp;</p>
    		  <p>&nbsp;</p>
      </div>
    		</div>
      <div id="footer">
        <?php include("inc/footer.php"); ?>
      </div>
    </center>
    </body>
    </html>
    That's entire code

    Not sure why it doesn't work - the IP thing, forget that - I was just confused why it now shows a count of 3

  20. #20
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Location
    Brisbane, Australia
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:
    PHP Code:
    <?php require_once("inc/variables.php"); ?>
    <?php

    $dbhost 
    'localhost';
    $dbuser 'proxies_admin';
    $dbpass '324t24t4gaaaaary25';

    $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) {
      
    mysql_query("update stats set count = count + 1"$conn)
        or die (
    mysql_error());
    }
      if(isset(
    $_POST['browse']))
    {
        
    increment_stats_count($conn);
    }

    // Change this to your domain (no 'www.')
    $domain="proxiesrus.com";

    // If no request:
    if($_GET['q']!=""){
      
    // Get referer
      
    $referer=$_SERVER['HTTP_REFERER'];
      
    // Check to see if referer is not the proxys domain
      
    $count=substr_count($referer,$domain);
      
    // If there is an outside referer:
      
    if($count==0){
        
    // If there is a request:
        
    if($_GET['q']!=""){
          
    // Redirect to homepage and finish script
          
    header("Location: http://www." $domain "/");
          exit();
        }
      }
    }

    /*
    END MOD
    */  

    require 'proxy_system.php';

    $config = array
    (
        
    'url_var_name'             => 'q',
        
    'flags_var_name'           => 'hl',
        
    'get_form_name'            => '__script_get_form',
        
    'proxy_url_form_name'      => 'poxy_url_form',
        
    'proxy_settings_form_name' => 'poxy_settings_form',
        
    'max_file_size'            => -1
    );

    $flags 'prev';

    if (isset(
    $_GET[$config['flags_var_name']]))
    {
        
    $flags $_GET[$config['flags_var_name']];
    }

    $PHProxy = & new PHProxy($config$flags);

    if (isset(
    $_GET[$PHProxy->config['get_form_name']]))
    {
        
    $url decode_url($_GET[$PHProxy->config['get_form_name']]);
        
    $qstr preg_match('#\?#'$url) ? (strpos($url'?') === strlen($url) ? '' '&') : '?';
        
    $arr explode('&'$_SERVER['QUERY_STRING']);
        if (
    preg_match('#^'.$PHProxy->config['get_form_name'].'#'$arr[0]))
        {
            
    array_shift($arr);
        }
        
    $url .= $qstr implode('&'$arr);
        
    $PHProxy->start_transfer(encode_url($url));
        echo 
    $PHProxy->return_response();
        exit();
    }

    if (isset(
    $_GET[$PHProxy->config['url_var_name']]))
    {
        
    $PHProxy->start_transfer($_GET[$PHProxy->config['url_var_name']]);
        echo 
    $PHProxy->return_response();
        exit();
    }

    if (isset(
    $_GET['action'], $_GET['delete']) && $_GET['action'] == 'cookies')
    {
        
    $PHProxy->delete_cookies($_GET['delete']);
        
    header("Location: $PHProxy->script_url?action=cookies");
        exit();
    }

    if (isset(
    $_POST['username'], $_POST['password'], $_POST['server'], $_POST['realm'], $_POST['auth_url']))
    {
        
    $PHProxy->request_method 'GET';
        
    $PHProxy->url_segments['host'] = decode_url($_POST['server']);
        
    $PHProxy->set_authorization($_POST['username'], $_POST['password']);
        
    $PHProxy->start_transfer($_POST['auth_url']);
        echo 
    $PHProxy->return_response();
        exit();
    }
    ?>
    <!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>
    <title>Proxies R Us - We're No Toy! We're a Proxy, and More! Proxy</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="Copyright" content="Proxies R Us"/>
    <meta http-equiv="content-language" content="EN"/>
    <meta name="Rating" content="General"/>
    <meta name="Designer" content="Proxies R Us"/>
    <meta name="Keywords" content="Free Proxy, Free Web Proxy, Free Proxy List, Proxy Lists, Free Anonymous Browsing, Free Text Message Proxy, Flash Game Arcade"/>
    <meta name="revisit-after" content="1"/>
    <meta name="Robots" content="index,follow"/>
    <meta name="Description" content="We're No Toy! We're a Proxy, and More! Proxy, Flash Game Arcade, Text Messaging and Software"/>
    <meta http-equiv="Cache-Control" content="no-cache"/>
    <meta http-equiv="Expires" content="0"/>
    <meta name="Author" content="Proxies R Us"/>
    <link rel="shortcut icon" href="images/favicon.ico"/>
    <link href="css/1.css" rel="stylesheet" type="text/css" />
    <script src="js/javascript.js" type="text/javascript"></script>
    </head>

    <body>
    <center>
            <div id="menu"><?php include("inc/header.php"); ?></div>
            
            <div id="header">
              <h1>
                <?=$title?>
              </h1>
              <span class="submenu">
              <h2>
                <?=$subtext?>
              </h2>
              </span>
              <h3>
                <?php include("inc/sublinks.php"); ?>
                <?php include("inc/useronline.php"); ?>
              </h3>
      </div>
            
            <div id="content">
            
            <img src="images/icons/proxy.gif" alt="Proxies R Us Logo" width="100" height="100" class="logo" />
            
              <p><span class="introduction">Proxies R Us is a anonymous proxy that lets you make indirect connections hiding all your personal information. This means you can browse all your favourite websites, like Myspace, eBay, whatever you like. With Proxies R Us, you can browse websites when you get banned. You can easily
    bypass webfilters that are set up by the school or company server you want to visit the site from. In additon, we have an arcade setup, for you all your gaming needs. A text messaging system to chat with friends, and more! </span></p>
              <div id="sidebar">
                            <h1>SPONSORS</h1>
                            <div class="submenu">
                    <?php include("inc/sponsors.php"); ?>
                </div>
                    
                    <h1>fun links </h1>
                        <div class="submenu">
                        <?php include("inc/link_display.php"); ?>
                        </div>
                        
                        
                        <h1>ADVERTISEMENTS</h1>
                        <div class="submenu">
                            <?php include("inc/3.php"); ?>
                        </div>
    </div>                
              <div id="mainbar">
                            <h1>PROXY, BROWSE SAFELY!</h1>
                                                
                            <noscript>
                              <div align="center"><big>You have Javascript disabled. Please enable it to use the proxy</big>.</div>
                            </noscript>
    <?php

    if (isset($_GET['error']))
    {
        echo 
    '<div><b>Error:</b> ' htmlspecialchars($_GET['error']) . '</div>';
        if (isset(
    $_GET['retry']))
        {
            echo 
    '<div><a href="'$PHProxy->proxify_url(decode_url($_GET['retry'])) .'">Retry</a></div>';
        } 
    }

    if (isset(
    $_GET['action']))
    {
        if (
    $_GET['action'] == 'cookies')
        {
            
    $cookies $PHProxy->get_cookies('COOKIE'false);

            if (!empty(
    $cookies))
            {
                echo 
    '<table style="width: 470px">';
                echo 
    '<tr><td colspan="5"><a href="?action=cookies&delete=all">Clear All Cookies</a></td></tr>';
                echo 
    '<tr><td>Name</td><td class="head">Domain</td><td>Path</td><td>Value</td><td>Action</td></tr>';

                for (
    $i 0$i count($cookies); $i++)
                {
                    
    $j $i&' class="shade"' '';
                    echo 
    "<tr><td$j>{$cookies[$i][0]}</td><td$j>{$cookies[$i][1]}</td><td$j>{$cookies[$i][2]}</td>"
                       
    "<td$j>" wordwrap($cookies[$i][3], 15' ') ."</td><td$j><a href="'"?action=cookies&delete='md5(implode(''$cookies[$i])) . '">delete</a></td></tr>';
                }

                echo 
    '</table>';
            }
            else
            {
                echo 
    '<div>No cookies available.</div>';
            }
        }
        else if (
    $_GET['action'] == 'auth' && isset($_GET['server'], $_GET['realm'], $_GET['auth_url']))
        {
            echo 
    '<form method="post" action="' $_SERVER['PHP_SELF'] . '">';
            echo 
    '<input type="hidden" name="server" value="'$_GET['server'] .'" />';
            echo 
    '<input type="hidden" name="realm" value="'$_GET['realm'] .'" />';
            echo 
    '<input type="hidden" name="auth_url" value="'$_GET['auth_url'] .'" />';
            echo 
    '<table style="width: 470pxpx">';
            echo 
    '<tr><td colspan="2">Enter user name and password for <b>' decode_url($_GET['realm']) . '</b> at <i>' decode_url($_GET['server']) . '</i></td></tr>';
            echo 
    '<tr><td width="470px">User name</td><td class="option"><input type="text" name="username" value="" /></td></tr>';
            echo 
    '<tr><td width="470px">Password</td><td class="option"><input type="password" name="password" value="" /></td></tr>';
            echo 
    '<tr><td colspan="2" style="text-align: center"><input type="submit" value="OK" /></td></tr>';
            echo 
    '</table>';
            echo 
    '</form>';
        }

    else
    {
      
    ?>
      <form name="<?php echo $PHProxy->config['proxy_url_form_name'?>" method="get" action="<?php echo $_SERVER['PHP_SELF'?>">
      <input type="hidden" name="<?php echo $PHProxy->config['url_var_name'?>" value="" id="url_input" />
      <input type="hidden" name="<?php echo $PHProxy->config['flags_var_name'?>" value="" />
      </form>
      <script type="text/javascript"><!--
    google_ad_client = "pub-5621700549651235";
    google_ad_width = 468;
    google_ad_height = 60;
    google_ad_format = "468x60_as";
    google_ad_type = "text";
    google_ad_channel ="";
    google_color_border = "FFFFFF";
    google_color_bg = "FFFFFF";
    google_color_link = "4D87CE";
    google_color_text = "000000";
    google_color_url = "4D87CE";
    //--></script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
      <form name="<?php echo $PHProxy->config['proxy_settings_form_name'?>" method="get" action="" onsubmit="return submit_form();">
      <table style="width: 90%">
      <tr><td style="width: 30%">URL</td><td style="width: 80%">&nbsp;<input name="url" type="text" class="textbox" value="" size="50" /></td></tr>
      <?php echo $PHProxy->options_list(truetrue?>
      <tr><td style="width: 30%">New Window</td><td style="width: 80%"><input type="checkbox" name="new_window" />Open URL in a new window </td></tr>
      </table>
      </form>
      <div align="center"><script type="text/javascript"><!--
    google_ad_client = "pub-5621700549651235";
    google_ad_width = 468;
    google_ad_height = 60;
    google_ad_format = "468x60_as";
    google_ad_type = "text";
    google_ad_channel ="";
    google_color_border = "FFFFFF";
    google_color_bg = "FFFFFF";
    google_color_link = "4D87CE";
    google_color_text = "000000";
    google_color_url = "4D87CE";
    //--></script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script><br />
      <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>
      <center>
        <h1>WHAT IS MY IP? </h1>
        <?php
    echo '<p><span class="info">Your IP is</span><span class="ip"> <b>'.$_SERVER["REMOTE_ADDR"].'</b><br>
      <br> 
    </span><span class="info"><strong>Definition:</strong> The Internet Protocol (IP) is a network layer protocol that moves data between host computers.</span></p>
    <p><span class="info"><strong>Importance:</strong> If your IP is publicly displayed, it can be very harmful to your computer. To prevent problems, use the proxy form above. Be safe!</span></p>'
    ;
    ?>
        <h1>WHAT IS MY BROWSER? </h1>
            <?php
    echo '<span class="info">You are using the browser <strong>'.$_SERVER["HTTP_USER_AGENT"].'</strong></span><br>
     <br>'
    ;
    echo 
    '<a href="software.php" class="info">We reccomend using Mozila FireFox for a safer internet experience!</a>';
    ?>
            <br />
            <br />
            <br />
            <h1>WEBSITE POPULARITY/INFO CHECK </h1>
            <span class="submenu">
            <?php include("inc/website_checker.php"); ?>
            </span><br />
            <br />
      </center>
      </div>
      <p>
        <br />
        <?php
    }
    ?>
      </p>
              <p>&nbsp;</p>
              <p>&nbsp;</p>
      </div>
            </div>
      <div id="footer">
        <?php include("inc/footer.php"); ?>
      </div>
    </center>
    </body>
    </html>
    Your Browse Website Safely button was part of the proxy form and therefore may have been the cause of your problem.

  21. #21
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It did not change - I really apprciate your helpings by the way

    I wonder why it doesn't update - I check the table, it doesn't change.

  22. #22
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    PHP Code:
    function increment_stats_count($conn) {
      
    mysql_query("update stats set count = count + 1"$conn)
        or die (
    mysql_error());

    Should be:

    PHP Code:
    function increment_stats_count($conn) {
      
    mysql_query("update stats set `count` = `count` + 1"$conn)
        or die (
    mysql_error());

    count is a reserved word in SQL, so maybe it wasn't updating it for that reason.

  23. #23
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay so..

    Code:
    /* Place the following on your form handling page */
    function increment_stats_count($conn) {
      mysql_query("update stats set 'clicks' = count + 1", $conn)
        or die (mysql_error());
    }
      if(isset($_POST['browse']))
    {
        increment_stats_count($conn);
    }
    This is what I have - does not work, just doesn't update. I have changed the field name to 'clicks' as well.

  24. #24
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    In that case your query should read:

    PHP Code:
    mysql_query("update stats set clicks = clicks + 1"$conn
    1 - the field is called clicks, so count doesn't do anything here anymore
    2 - field names should be enclosed in backticks (`) or not at all, but never in apostrophes (')


  25. #25
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It didn't update, yet again:

    Code:
    -- phpMyAdmin SQL Dump
    -- version 2.8.0.2
    -- http://www.phpmyadmin.net
    -- 
    -- Host: localhost
    -- Generation Time: Jul 24, 2006 at 02:51 PM
    -- Server version: 4.1.19
    -- PHP Version: 4.4.2
    -- 
    -- Database: `proxies_stats`
    -- 
    
    -- --------------------------------------------------------
    
    -- 
    -- Table structure for table `stats`
    -- 
    
    CREATE TABLE `stats` (
      `clicks` int(10) NOT NULL default '0',
      UNIQUE KEY `clicks` (`clicks`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    
    -- 
    -- Dumping data for table `stats`
    -- 
    
    INSERT INTO `stats` VALUES (1);
    This is my database - does it appear to work with what we're doing?


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
  •