Jump to content

Joesavage

Members
  • Posts

    24
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Joesavage's Achievements

Member

Member (2/5)

0

Reputation

  1. By some retarded miracle it has now fixed itself.
  2. What does a phpinfo() statement show for your error_reporting and display_errors settings? I've included an invalid url and I got a clear error message saying the file did not exsist.
  3. I am including a php file with a class called Facebook. I then immediatley call the class Facebook in my php file. It says that the class is undefined. I know that I am including the file correctly because I dont get an error message saying that the file can not be found. Here is what I have, please help. <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script> </head> <body> <? // // this file includes FB_API_KEY and FB_SECRET constants and the ConnectDB function // to connect to your mysql database. $fbapikey = "xxxx"; $fbsecret = "xxxx"; $con = mysql_connect("localhost","xxx","xxx"); mysql_select_db("xxx", $con); // include("facebookplatform/php/facebook.php"); // start facebook api with the codes defined above. $fb=new Facebook($fbapikey,$fbsecret); //this is where I get the error message. $fb_user=$fb->get_loggedin_user(); Here is what my included file looks like. include_once 'facebookapi_php5_restlib.php'; define('FACEBOOK_API_VALIDATION_ERROR', 1); class Facebook { public $api_client; public $api_key; public $secret; public $generate_session_secret; public $session_expires; public $fb_params; blah blah blah alot more definitions and functions ect. } I have no idea what is going on. I thought this was a simple include, but php says it cant find the class which is clearly defined in the included file. By the way is for facebook Connect, if that matters.
  4. I am trying to use a cookie to tell when someone has already been to my website. Right now the problem is that if the cookie gets set on one page, it does not get read by other pages. $Affcookie = 0; $Affcookie = $_COOKIE["track"]; if ($Affcookie == 0) { $Cookvar = 1; $Expire = time() + 60*60*24*60; setcookie("track", 1, $Expire); } if ($Cookvar == 1;) { echo 'blah'; } Right now if I go to a page on my domain it first echoes 'blah' and then if i refresh then it doesnt echo, which is correct. But if I go to any other page on my domain then once again 'blah' is echoed. All pages have this is same piece of code on them. So they all check to see if the cookie[track] = 1.
  5. Hello. I am trying to store a variable name in a mysql table... for instance... Have the string "Hi The Variable is $Var1" stored in the table. Then on the php file... <?php $Var1 = Yay! connect to mysql database. select * from table blahblahblah echo "$row[string]"; ?> and have that echo out "Hi The variable is Yay! I tried this and it prints out Hi The Variable is $Var1 instead, even tho I have set $Var1 to Yay!. Any ideas on how this can be done?
  6. I am working on a search function for my website. I have a single table which stores all of the text from each page on my website, among other things. So here is the problem, my site is huge. Assume that I add about 10000 rows a day to this table. And each row contains all of the text from a webpage, somewhere between 5,000 and 10,000 characters. So then when i search for a word I have too look at every description for every page and see if the description contains that word. So I am afraid that my current configuration will start to slow down very soon. Is there a better way to do this? I have looked at Ruby on Rails, im not sure if that will help, any thoughts? Also, is there a way to distribute the data over multiple databases/tables and if I do, will that speed anything up? Please do not suggest a php search engine script.
  7. damn... /s makes it work perfectly. Thank you very much.
  8. To start: im not good with regex. All i want to do is capture all of the information inbetween <!-- Begin Description --> and <!-- End Description -->. In the example i have below i only have 'k' and i cant even get that to work. In real life i want to be able to capture text with new lines and white text and other weird characters. $data = "<!-- Begin Description -->k<!-- End Description -->"; $regex = '/"<!-- Begin Description -->(.+?)<!-- End Description -->/'; preg_match_all($regex,$data,$description,PREG_SET_ORDER); print_r ($description); The description array gets printed out empty. Any ideas why? I have tried using (.+?), (.*), and (.*?). These are all snippets that i have seen used other places.
  9. Ok well i just called my host to ask what it might be and apparently they have been working on the server for the last couple of days and have been disconnecting any particularly cpu consuming scripts. Thanks for telling me about the die thingy thats a good thing to have in there.
  10. And also I run lots of scripts on this site and this doesnt happen to any of the other ones...
  11. Ok i am getting the error reply "MySQL server has gone away" What the hell does that mean?
  12. Well I guess the error is not so wierd, but I should not be getting it. So my code is shown below. Let me just start off by saying that the scraper down there works fine. I am getting a lame database error. So all of the code works inside that first primary while loop which pulls every row from the table 'Pending' where Date = '2008/07/18' in this case. Then the scraper goes through and scrapes 10 different pages, searching those pages for a link called '/user/$Channel' where $Channel is a variable pulled from the table called Pending. If the scraper finds the link, it breaks out of the scraper and $Subscriptioncomplete gets set = 1. And then, if $Subscription = 1, it executes some code modifying the database. Here is where my error comes in: $result = mysql_query("SELECT * FROM Users where Subchannel = '$Subscriber'"); while($row = mysql_fetch_array($result)) So I need some basic info from another database called Users, so i go to pull some info from there. and i need some more basic info from Users, so I have another pull. $result = mysql_query("SELECT * FROM Users where Subchannel = '$Channel'"); while($row = mysql_fetch_array($result)) They are essentially the same except they are getting info from two different rows. So the weird part is that SOMETIMES i get the error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/blah/public_html/Scraper1.php on line 97 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/blah/public_html/Scraper1.php on line 112 (Lines 97 and 112 are what i posted above.) Sometimes I DONT get this error... And i dont mean for some rows or whatever. I mean sometimes i run the whole script and this error will appear everytime, or I run the whole script and it will never appear. Obviously I need more reliability than that. So anyway, I hope its something really easy that I missed somehow. Please help!! The full script is show below. My first thought was that maybe I couldnt run while loops within eachother or something, but I have done it before so that doesnt make sense. And I dont think it is a problem with the databases, because sometimes this script runs flawlessly.... Anyway, help! <?php $Date = $_GET["Date"]; $con = mysql_connect("blahblahblah"); mysql_select_db("blahblahblah", $con); $Tea = mysql_query("SELECT * FROM Pending where Date = '2008/07/18'"); while($Leaves = mysql_fetch_array($Tea)) { $Count = 0; $Channelcounter = 0; $Channel = $Leaves[Channel]; $Subscriber = $Leaves[subscriber]; $Subscriptioncomplete = 0; $Numberofpages = 10; for ($q = $Numberofpages; $q > 0; $q--) { $target_url = "blahblahblah"; $userAgent = 'Googlebot/2.1 (http://www.googlebot.com/bot.html)'; // make the cURL request to $target_url $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); curl_setopt($ch, CURLOPT_URL,$target_url); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_TIMEOUT, 30); $html= curl_exec($ch); if (!$html) { echo "<br />cURL error number:" .curl_errno($ch); echo "<br />cURL error:" . curl_error($ch); echo "<br>Curl Error."; exit; } // parse the html into a DOMDocument $dom = new DOMDocument(); @$dom->loadHTML($html); // grab all the on the page $xpath = new DOMXPath($dom); $hrefs = $xpath->evaluate("/html/body//a"); for ($i = 0; $i < $hrefs->length; $i++) { $href = $hrefs->item($i); $Url = $href->getAttribute('href'); if ($Url == "/user/$Channel") { $Subscriptioncomplete = 1; break 2; } } } if ($Subscriptioncomplete == 1) { echo "$Subscriber Subscribed to $Channel<br><br><br>"; $result = mysql_query("SELECT * FROM Users where Subchannel = '$Subscriber'"); while($row = mysql_fetch_array($result)) { $Subscompleted = $row[subscompleted]; $Pendingsubscompleted = $row[Pendingsubscompleted]; $Backlink = $row[backlink]; } if ($Backlink == 1) { $Inc = 1.25; } else { $Inc = 1; } $result = mysql_query("SELECT * FROM Users where Subchannel = '$Channel'"); while($row = mysql_fetch_array($result)) { $Subsused = $row[subsused]; $Pendingsubsused = $row[Pendingsubsused]; } $Subscompleted = $Subscompleted + $Inc; $Pendingsubscompleted = $Pendingsubscompleted - 1; $Subsused = $Subsused + 1; $Pendingsubsused = $Pendingsubsused - 1; mysql_query("UPDATE Users SET Subscompleted ='$Subscompleted' WHERE Subchannel = '$Subscriber'"); mysql_query("UPDATE Users SET Pendingsubscompleted = '$Pendingsubscompleted' WHERE Subchannel = '$Subscriber'"); mysql_query("UPDATE Users SET Subsused = '$Subsused' WHERE Subchannel = '$Channel'"); mysql_query("UPDATE Users SET Pendingsubsused = '$Pendingsubsused' WHERE Subchannel = '$Channel'"); mysql_query("INSERT INTO Completedsubs (Subscriber, Channel) VALUES ('$Subscriber', '$Channel')"); mysql_query("DELETE FROM Pending WHERE Channel = '$Channel' && Subscriber = '$Subscriber'"); } } ?>
  13. ah damn... some... some moron put in a value of -9999999999. I wonder who that was.
  14. Hello. I am trying to run a script to add up abunch of numbers. The script works fine. It adds and adds and adds, until it gets to about 30 million. And then all of a sudden, it flips to -70 million. What is going on ? I have tried changing the data type to float, double and decimal. They all have a similar effect. What can i do to make it add it up right?
  15. Damn... Thanks for the help. Works perfect.
×
×
  • 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.