Jump to content

Bio

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Posts posted by Bio

  1.  

    This is the main file: /counter.php

     

    <html>
    <head>
    </head>
    <body>
    
    <?php
    define ('SECURITY', True);
    include('./includes/connect.php');
    $TheData = $_SERVER['HTTP_REFERER'];
    
    // make sure the script is called from a page not called directly.
    if ($TheData == "") { echo "This script must be embedded on a web page."; die; }
    
    // load the hit count
    
    $query = "SELECT hits FROM counters
    WHERE url='$TheData'";
    
    $result = mysql_query($query)
    	or die ("MySql Error. Please Inform YOUR_INFO_HERE if this problem persists.");
    
    $j = 1;
    while ($row=mysql_fetch_array($result,MYSQL_ASSOC))
    {
    foreach ($row as $colname => $value)
    {
    $array[$j][$colname] = $value;
    $value = strtoupper($array[$j][$colname]);
    }
    $j++;
    }
    
    $count = (int)$array['1']['hits'];
    
    // if this is a new url we need to create the record in the table.
    
    if ($count < 1) { 
    
    $query = "INSERT INTO counters (url, hits, protected)
    VALUES ('$TheData', '0', '0')";	
    }
    
    // increase the hit count then update the table
    
    $count++;
    
    mysql_query("UPDATE counters SET hits = '$count'
    WHERE url = '$TheData'");
    
    $CountDisplay = "0000000" . $count;
    $CountDisplay = substr($CountDisplay, -7);
    
    for ( $counter = 1; $counter <= 7; $counter++) {
    $worker = -8 + $counter;
    $Display = substr($CountDisplay, $worker, 1);
    
    ?>
    <img src="http://www.YOUR_URL_HERE/images/glass_numbers_<?php echo $Display; ?>.png" width="30" height="30">
    
    <?php
    
    }
    
    ?>
    
    </body>
    </html>
    

     

    This is the file that connects to the database: /includes/connect.php

     

    You will have to fill in your database login info.

     

    <?php
    
    
    // First make sure this script isnt called from anywhere except our script.
    
    if ( !defined('SECURITY') )
    {
    die("Hacking attempt");
    
    }
    //
    // ======----------->>>     define variables here    <<<----------=======
    //
    
    // This is the MySql setup
    
    $host = "localhost";
    $user = "username";
    $password = "password";
    $db = "database";
    
    //
    // ======----------->>>     end define variables     <<<----------=======
    //
    
    // End Variables. Do not edit any code below this line.
    
    // Connect to the database
    
    $con = mysql_connect($host,$user,$password);
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    
    // Select the database
    
    mysql_select_db($db, $con);
    
    // unset variables to detour hacking attempts.
    
    unset ($host, $user, $password);
    
    
    ?>

     

    This will create the table for you: (SQL Code)

     

    CREATE TABLE IF NOT EXISTS `counters` (
      `index` int(6) NOT NULL auto_increment,
      `url` varchar(120) collate latin1_general_ci NOT NULL,
      `hits` int(7) NOT NULL,
      `lasthit` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
      `protected` varchar(3) collate latin1_general_ci NOT NULL default '0',
      PRIMARY KEY  (`index`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=6 ;
    

     

    I downloaded the icons here: http://www.google.com/imgres?imgurl=http://www.bittbox.com/wp-content/uploads/2007/02/glass_numbers.png&imgrefurl=http://www.bittbox.com/freebies/free-glass-number-icons&h=76&w=465&sz=11&tbnid=Oq40Jksb-sW-VM:&tbnh=21&tbnw=128&prev=/images%3Fq%3Dglass%2Bnumbers&usg=__7idxAuEpllD9HtLDhHzYTq1uudI=&ei=2OOnS9jAMpKYsgPukIHbAw&sa=X&oi=image_result&resnum=2&ct=image&ved=0CBMQ9QEwAQ

     

    And I call it using an iframe: (HTML)

     

    <iframe src=
    "http://YOUR_URL_HERE/counter.php"width="285" height="50" frameborder=0><p>YOUR BROWSER DOES NOT SUPPORT THIS FUNCTION.</p></iframe>

     

    Dont be too tough on me! I have not been writting PHP for a very long time.. But im open to suggestions!

     

    If you use it lemme know how it works out for ya.

  2. Finding a working script to achieve this task has proven pointless. I have found several examples but have yet to find one that works.

     

    I started using PHP several months ago and have been able to do alot of the content gathering by using snoopy but some features on myspace require you to be signed in. I do not want to spam, or even post anything to myspace. I am solely interested in gathering information (stats specifically) from Myspace Apps.

     

    I have just begun to look at Curl and I certainly believe its capable of it but every script i find (as recently as February  2010) dont work or gives this error:

     

    Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/a1242578/public_html/myspace_login.php  on line 16

     

    line 16 is:

     

    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

     

    php.net says this is redundant because Curl will follow all redirects unless directed otherwise but if i comment it out, i get no error but i get no output either.

     

    PHP is NOT running in safe more. What else could cause this error? Is line 16 required or should it work without it?

     

    Here is the script in its entirety, found on this site.

     

    <?php
    
    class Myspace
    {
        function login($username, $password)
        {
            $username = $_POST['user'];
            $password = $_POST['passwd'];
            
            $login_url = "https://secure.myspace.com/index.cfm?fuseaction=login.process";
            $post_data = "ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Email_Textbox=$username&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Password_Textbox=$password";
            
            $ch = curl_init($login_url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_URL, $login_url);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
            curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
            curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
            curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) ");
            curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS,$post_data);
            
            
            $result = curl_exec($ch);
            
            
            
            curl_close($ch);
            echo $result;
        }
    }
    
    if($_POST['user'] && $_POST['passwd'])
    {
        $login = new Myspace;
        
        echo $login->login($_POST['user'],$_POST['passwd']);
        
    }
    else
    {
        echo
            "<html>
            <body>
            <form action='myspace_login.php' method='POST'>
            <input type='text' name='user' /><br />
            <input type='password' name='passwd' /><br />
            <input type='submit' value='submit' />
            </form>
            
            </form>
            </body>
            </html>";
    }
    
    ?> 

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.