Jump to content

Bio

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Everything posted by Bio

  1. It would be something like this... <a href="http://your_url_here/name_of_file.php?id=1">click here for file 1</a> or <a href="http://your_url_here/name_of_file.php?id=2">click here for file 2</a> etc.. If you need any more help dont hesitate to ask.
  2. Ill try it on my local box and see whats happens - i have been working with it on my web server.
  3. <?php $page = $_GET['id']; if ($page == "1") { header('Location: http://www.your_url.com/page1.html'); } if ($page == "2") { header('Location: http://www.your_url.com/page2.html'); } if ($page == "3") { header('Location: http://www.your_url.com/page3.html'); } ?> etc..
  4. You dont have quotes around the url. I would suggest passing the index# rather than the first & last name. your next query will work better that way.
  5. So you just need to delete a record from a database? $sql = "DELETE FROM `table_name` WHERE `table_name`.`field_name` = " . $RecordToDelete . " LIMIT 1"; set $RecordToDelete to the record you want to delete.
  6. 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.
  7. I wrote a script to do this not long ago. Its 2 scripts, a table in a MySql database, and image display for the hit count. its pretty simple.. Ill see what i can do about posting it.
  8. No change in execution or output that i could see. Thanks tho! Im sure its a step closer!
  9. How about exploding only using the coma leaving out the space? $color_exploded = explode(",", $rows['color']); then use SUBSTR to remove any leading spaces prior to display.
  10. 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.