Jump to content

WeirdMystery

Members
  • Posts

    37
  • Joined

  • Last visited

    Never

Everything posted by WeirdMystery

  1. I have an facebook application, I look in the errors log routinely to see if there are any abnormalities. Today, I found one. [sun Feb 27 15:28:25 2011] [error] [client **.***.71.38] PHP Notice: Undefined offset: 0 in *** on line 33 [sun Feb 27 15:28:26 2011] [error] [client **.***.71.38] Exception: 121: Param pid must be a valid merged photo id Now, I have no idea what is going on here. I have found the location of where the error occurs: $fb_photo = $facebook->api("me/photos", "POST", $attachement); $FQLQuery = "SELECT object_id, pid, src_big, link FROM photo WHERE object_id = " . $fb_photo['id']; $FQLResult = $facebook->api(array('method' => 'fql.query', 'query' => $FQLQuery, 'access_token'=> $session['access_token'])); $targetPhoto = $FQLResult[0]; I tried to help a user of mine get their account back on track, however, re-authenticating the application seems like the only way to fix it. It works for most of the users, however, there are a couple few who get my exception message. If anyone has any knowledge of whats going on here, that would be appreciated
  2. Nevermind, the support at Rackspace helped me solve it, I changed my /etc/hosts file. It did some random dns lookup that caused it to show "c18-ss-2-lb.cnet.com".
  3. This is driving me crazy. I have a server named "Athena", CentOS 5.5 is currently installed it. Whenever I change my hostname to frosly.com (which I own) and reboot it, the FQDN (hostname -f) shows as c18-ss-2-lb.cnet.com. This is really weird, since the hostname and fqdn shows as "Athena" before I changed it. "hostname -d" shows as cnet.com. I've built two servers and rebuilt several times, reproducing the issue EVERY TIME. Please tell me what is going on. Thanks
  4. Nevermind Guys, I'm super stupid. I put a semi-colon right after the declaration of the loop.
  5. The following query in the code returns mysql_num_rows as 20 however, it doesn't go even once through the loop. Could anyone tell me what I'm doing wrong? <?php include("default.php"); if(isset($_POST['lastid'])) { $lastid=mysql_real_escape_string($_POST['lastid']); $preq = mysql_query("SET @rank=0"); $q = mysql_query("SELECT @rank:=@rank+1 AS rank, id, content, likes FROM `makeyourown` ORDER BY `likes` DESC LIMIT $lastid, 20") or die(mysql_error()); while ($r = mysql_fetch_assoc($q)); { echo $r[rank]; echo "<div class=\"stuff_container_right\">\n"; echo "<div class=\"c2\"></div>\n"; echo "<div class=\"c1\"></div>\n"; echo "<div class=\"stuff\">\n"; echo "<a href=\"viewlikepage.php?id=" . $r[id] . "\">" . $r[content] . "</a><span style=\"float: right;\">" . number_format($r[likes]) . " Likes</span>" ; echo "</div>\n"; echo "<div class=\"c1\"></div>\n"; echo "<div class=\"c2\"></div>\n"; echo "</div>\n"; $idddd = $r[rank]; } echo "<div id=\"more" . $idddd . "\" class=\"stuff_container_right\">\n"; echo "<div class=\"c2\"></div>\n"; echo "<div class=\"c1\"></div>\n"; echo "<div class=\"stuff\">\n"; echo "<a id=\"" . $idddd . "\" class=\"more\" href=\"#\">Load More Pages</a>"; echo "</div>\n"; echo "<div class=\"c1\"></div>\n"; echo "<div class=\"c2\"></div>\n"; echo "</div>\n"; echo "</div>\n"; } ?>
  6. Hello, could anyone provide me with a regex that gets the last numbers of a string. Example... "The Useless Piece of Trash - Newly Updated - 22 More Items! - 224 Players" or "The Useless Piece of Trash - OLD - Go To New Game - 22 Players" I want to get "22 Players". Thanks...
  7. Cleaned up your code a bit. <?php session_start(); /* I would recommend reloacting the database connect code to another file and using require_once("filename") to include the file */ $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); if ($username && $password) { $connect = mysql_connect('server','user','password') or die("couldn't connect "); mysql_select_db('hilo102') or die ("couldn't find db"); $query = mysql_query("SELECT * FROM `users` WHERE `username` = '$username'"); $numrows = mysql_num_rows($query); if ($numrows != 0) { while ($row = mysql_fetch_assoc($query)) { /* I would recommend hashing the password on both sides to prevent hackers from getting the password. */ $dbusername = $row['username']; $dbpassword = $row['password']; } if ($username == $dbusername && $password == $dbpassword) { $_SESSION['username'] = $username; echo "You are logged in click <a href=\"http://www.classifiedsinhawaii.com/Post-Ads/post-ads.php\">here</a> to post an Ad"; } else { echo "Incorrect Password"; } } else { die("That User does not Exist"); } echo $numrows; } else { die (" Please enter an username and password !"); } ?>
  8. Somehow, my two loops which parse information from an RSS file don't seem to be looping correctly... For the inner loop, it only counted totally 348 loops, where it is supposed to be 360 loops. However, when I printed $i, it counted 18. When I printed the outer loop, it counted 20. So 18 * 20 = 360. I have no idea how this could have possibly happened. for($i=0;$i<count($arrFeeds);$i++) { $l++; $title_players = explode(" - ", $arrFeeds[$i]['title']); $description_image = $arrFeeds[$i]['desc']; $description_image = str_replace(array ("<p>","</p>"), "", $description_image); $description_image = explode("</a>", $description_image); $title = $title_players[0]; $players_wrong = explode(" ", $title_players[1]); $players = $players_wrong[0]; $date = $arrFeeds[$i]['date']; $link = $arrFeeds[$i]['link']; $gameid = explode("=", $link); $gameid = $gameid[1]; $description = $description_image[1]; $image = $description_image[0] . "</a>\n"; $image_url = explode("<img src=\"", $image); $image_url = explode("\" width", $image_url[1]); $image_url = $image_url[0]; $q = mysql_query("SELECT * FROM `games` WHERE `gameid` = '" . $gameid . "'") or die(mysql_error()); $r = mysql_num_rows($q); $mysql_safe_description = mysql_real_escape_string($description); $mysql_safe_title = mysql_real_escape_string($title); if ($r == 0) { $q = mysql_query("INSERT INTO `games` (id, gameid, players, gamename, gamelink, lastupdated, description, imageurl) VALUES ('NULL', '$gameid', '$players', '$mysql_safe_title', '$link', '$date', '$mysql_safe_description', '$image_url')") or die(mysql_error()); $q = mysql_query("INSERT INTO `players` (id, timestamp, gameid, players) VALUES ('NULL', NOW(), '$gameid', '$players')") or die(mysql_error()); } else { $q = mysql_query("UPDATE `games` SET lastupdated = '$date', description = '$mysql_safe_description', players = '$players' WHERE `gameid` = '$gameid'") or die(mysql_error()); $q = mysql_query("INSERT INTO `players` (id, timestamp, gameid, players) VALUES ('NULL', NOW(), '$gameid', '$players')") or die(mysql_error()); } } This is my code: <?php #!/usr/bin/php //Config File Contents //define("pages_to_parse" 20); require_once("main.php"); $l = 0; for ($j=0; $j < pages_to_parse; $j++) { $doc = new DOMDocument(); $doc->load('http://www.roblox.com/games.aspx?g=all&p=' . $j . '&feed=rss'); $arrFeeds = array(); foreach ($doc->getElementsByTagName('item') as $node) { $itemRSS = array ( 'title' => $node->getElementsByTagName('title')->item(0)->nodeValue, 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue, 'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue ); array_push($arrFeeds, $itemRSS); } for($i=0;$i<count($arrFeeds);$i++) { $l++; $title_players = explode(" - ", $arrFeeds[$i]['title']); $description_image = $arrFeeds[$i]['desc']; $description_image = str_replace(array ("<p>","</p>"), "", $description_image); $description_image = explode("</a>", $description_image); $title = $title_players[0]; $players_wrong = explode(" ", $title_players[1]); $players = $players_wrong[0]; $date = $arrFeeds[$i]['date']; $link = $arrFeeds[$i]['link']; $gameid = explode("=", $link); $gameid = $gameid[1]; $description = $description_image[1]; $image = $description_image[0] . "</a>\n"; $image_url = explode("<img src=\"", $image); $image_url = explode("\" width", $image_url[1]); $image_url = $image_url[0]; $q = mysql_query("SELECT * FROM `games` WHERE `gameid` = '" . $gameid . "'") or die(mysql_error()); $r = mysql_num_rows($q); $mysql_safe_description = mysql_real_escape_string($description); $mysql_safe_title = mysql_real_escape_string($title); if ($r == 0) { $q = mysql_query("INSERT INTO `games` (id, gameid, players, gamename, gamelink, lastupdated, description, imageurl) VALUES ('NULL', '$gameid', '$players', '$mysql_safe_title', '$link', '$date', '$mysql_safe_description', '$image_url')") or die(mysql_error()); $q = mysql_query("INSERT INTO `players` (id, timestamp, gameid, players) VALUES ('NULL', NOW(), '$gameid', '$players')") or die(mysql_error()); } else { $q = mysql_query("UPDATE `games` SET lastupdated = '$date', description = '$mysql_safe_description', players = '$players' WHERE `gameid` = '$gameid'") or die(mysql_error()); $q = mysql_query("INSERT INTO `players` (id, timestamp, gameid, players) VALUES ('NULL', NOW(), '$gameid', '$players')") or die(mysql_error()); } } } echo $j; echo " "; echo $l; ?>
  9. Wow, am I really that stupid? I spelled INSERT wrong...
  10. Its giving me a freakishly hard time, returns... You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSRET INTO `players` (id, timestamp, gameid, players) VALUES ('NULL', 'NULL', '' at line 1 $q2 = mysql_query("INSRET INTO `players` (id, timestamp, gameid, players) VALUES ('NULL', 'NULL', '$gameid', '$players')") or die(mysql_error());
  11. Its giving me a freakishly hard time, returns... You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSRET INTO `players` (id, timestamp, gameid, players) VALUES ('NULL', 'NULL', '' at line 1 $q2 = mysql_query("INSRET INTO `players` (id, timestamp, gameid, players) VALUES ('NULL', 'NULL', '$gameid', '$players')") or die(mysql_error());
  12. I removed the default virtual server from apache using webmin since it did not work. I added 2 virtual hosts, but when I restart apache it gives me this error. apache2: Syntax error on line 235 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/sites-enabled/000-default: No such file or directory ...fail! So I go to /etc/apache/sites-enabled, there were two files. lrwxrwxrwx 1 root root 26 Apr 21 02:31 000-default -> ../sites-available/default (shows red, idk what that means.) lrwxrwxrwx 1 root root 46 May 2 17:09 pyrohawk.com.conf -> /etc/apache2/sites-a Then I go to the config file, I go on line 235 and it has "Include /etc/apache2/sites-enabled/".
  13. Thanks man, thats even a better solution... Sorry guys for not telling you guys that the number before the username is the user id. (BTW, its a Folding@home statistics lister for our team.)
  14. Sorry, I have no knowledge about regrexes... Just to confirm that, I did not know regrex was spelled regex. Oops, forgot to say thanks!...
  15. $content_lower = strtolower($parsed); $strip_tags = strip_tags($content_lower); $remove_tabs = str_replace(" ", "", $strip_tags); $remove_linebreaks = str_replace(array("\r", "\r\n", "\n"), "", $remove_tabs); $remove_before_first_number = preg_replace('#^([^\d]+)?#','', $remove_linebreaks); //Your solution... $final = preg_replace('#(\d)\s([^\d])#', '$1 | $2', $remove_before_first_number); Sorry, must have been the Forum's formatting which removed the extra spaces... Now thats the string that I was trying to modify. 1 weirdmystery 37179 90 2 hdlowrider 1042 11 3 ds_blockcommunity 301 5 4 xredx22 141 4 5 nitt_from_bcy 94 2 6 noobwithagun 47 1
  16. $content_lower = strtolower($parsed); $strip_tags = strip_tags($content_lower); $remove_tabs = str_replace(" ", "", $strip_tags); $remove_linebreaks = str_replace(array("\r", "\r\n", "\n"), "", $remove_tabs); $remove_before_first_number = preg_replace('#^([^\d]+)?#','', $remove_linebreaks); //Your solution... $final = preg_replace('#(\d)\s([^\d])#', '$1 | $2', $remove_before_first_number);
  17. That regrex returns "1 | weirdmystery 37179 | 90 | 2 | hdlowrider 1042 | 11 | 3 | ds_blockcommunity 301 | 5 | 4 | xredx22 | 141 | 4 | 5 | nitt_from_bcy 94 | 2 | 6 | noobwithagun 47 | 1 |"
  18. Hi, I am trying to insert "| " before words, so I can use the PHP explode function on them. Example: "1 weirdmystery 36668 89 2 hdlowrider 1042 11 3 ds_blockcommunity 301 5 4 xredx22 141 4 5 nitt_from_bcy 94 2 6 noobwithagun 47 1" would turn into this "1 | weirdmystery 36668 89 2 | hdlowrider 1042 11 3 | ds_blockcommunity 301 5 4 | xredx22 141 4 5 | nitt_from_bcy 94 2 6 | noobwithagun 47 1". I tried str_replace but that doesn't have a position parameter so I don't replace the word or letter itself. Must be something with preg_replace and some regrex I don't know of. Thanks...
  19. No, it will not fail unless you do not put the tag in the correct place. All Crawlers look for this tag.
  20. What do you mean by "fool-proof". If the page is linked to another page, the crawler can crawl and index it if it wants to, however, you are saying on your page "Please do not index my page". They can crawl and index your site, by adding the tag, you are asking them not to.
  21. Hello, I am continuing my way in making a page viewer bot. There is this problem I've ran in to. There are some pages which tally page views if the client accept cookies. Is there some sort of option I have to set with curl_setopt() to let cURL accept cookies? I would also like to dump them after the session is done. I've used Chrome to disallow cookies and just like I've said, the page view count on some sites do not go up, while on a cookie accepting browser, it does. Thanks...
×
×
  • 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.