Jump to content

leafer

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

leafer's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. In terms of security, is there any advantage to choosing a protected variable over a local variable in the following examples? Thx protected function getPage() { $this->_ch = curl_init(); curl_setopt($this->_ch, CURLOPT_USERAGENT, $this->_userAgent); curl_setopt($this->_ch, CURLOPT_URL, $this->_url); curl_setopt($this->_ch, CURLOPT_REFERER, $this->_referrer); curl_setopt($this->_ch, CURLOPT_FOLLOWLOCATION, false); curl_setopt($this->_ch, CURLOPT_FRESH_CONNECT, true); curl_setopt($this->_ch, CURLOPT_HEADER, false); curl_setopt($this->_ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($this->_ch, CURLOPT_CONNECTTIMEOUT, $this->_timeout); $this->_result = curl_exec($this->_ch); curl_close($this->_ch); return $this->_result; } protected function getPage() { $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, $this->_userAgent); curl_setopt($ch, CURLOPT_URL, $this->_url); curl_setopt($ch, CURLOPT_REFERER, $this->_referrer); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->_timeout); $this->_result = curl_exec($ch); curl_close($ch); return $this->_result; }
  2. It's not entered in with double quotes I just used double quotes to signify the entire sentence I used.
  3. It's the key to the left of enter not the one with the tilde sign (~). I tried your method above but now the line itself doesn't display.
  4. I've tried everything (htmlspecialchars, htmlentities, html_entity_decode with ENT_QUOTES) and nothing seems to work. It keeps displaying a blue boxed question mark in place of the single quote. The portion of the sentence not displaying properly is "john's". I've manually inserted the info using myphpadmin if that makes a difference. Thx
  5. I even tried something like this: $(document).ready(function() { $(".forumPaster").hide(); $(".ForumPasteButton:button").bind('click', function() { $(".forumPaster").each(function(){ $(this).toggle(); }); }); }); Nothing. I can't seem to find anything that says only the next one only.
  6. I've been at this on and off for a week but it never seems to work quite right. Basically I have multiple divs that are hidden preceded by a button before each one but it has to start hidden on load. All I want is any of the buttons to only open the div directly after it. At the moment it seems to want to open all of them. Here is the snippet of code: <div class="buttonClass"><button class="ForumButton" type="button">Click to open</button></div><div class="forumPaster">Hidden information</div> Here's what I have so far: $(document).ready(function() { $(".forumPaster").hide(); $(".ForumPasteButton:button").bind('click', function() { $(".forumPaster").toggle(); }); });
  7. Here's the statement that doesn't entirely work the way it should: $query = "SELECT name FROM thedatabase "; $query .= "WHERE position LIKE '%$position1%' OR position LIKE '%$position2%' OR position LIKE '%$position3%' "; $query .= "OR position LIKE '%$position4%' AND league = '$league' ORDER BY rank ASC LIMIT 5"; Now within my code I have a broad statement which doesn't use the "AND league = '$league'" part and it works perfectly. Once I include the and league part it's almost as if the statement isn't even there. With and without that portion the result is the same. Basically what I'm trying to accomplish with this statement is: If any of the positions exist BUT contain StringX within the league column then return ORDER BY rank ASC LIMIT 5. It seems as if it's treating that AND statement as an OR and once it finds a match ignores the rest. Any ideas?
  8. I noticed! except... I probably already lost more then a bit Thanks again for the info, you probably switched the "rapidshare file check" part with Hotfile. preg_match("/<form action=\"([^\"]+)\" method=\"post\">/",$index,$match); //print $index; is only used for rapidshare in my code... but.. Your explanation was exactly what I needed! I finally understand it and realize that I was started wrong! I started from scratch again and its working now :-) Hip Hip if($row[2]==2) // Hotfile Check { $row[1]="http://www.".$row[1]; $index=getpage($row[1]); print "<a href=\"".$row[1]."\">".$row[1]."</a>\n"; if(strpos($index,"Downloading")===false) //check if page contains the word downloading if not = bad link { mysql_query("UPDATE `v2links` SET `checked`='-1',`lastcheck`=NOW() WHERE `id`=".$row[0]); print "bad link\n"; logstr("log-c.txt","bad link\n"); } else { $pattern = '/<table\sclass="downloading"\>.+<b>(.*?)\<\/b\>.+\<span\sclass="size"\>\| (.*?)\<\/span\>/'; preg_match($pattern, $index, $output); $caption=$output[1]; $fsize=$output[2]; print "$caption :: $fsize\n"; logstr("log-c.txt","$caption :: $fsize\n"); mysql_query("UPDATE `v2links` SET `checked`='1',`lastcheck`=NOW(),`fsize`='$fsize',`caption`='$caption' WHERE `id`=".$row[0]); unset($match); if(mysql_errno()) print mysql_error()."\n"; } } Works link a charm like this! Thanks again for your time and if you have a paypall email please pm me... I'm gonna pay you that BEER! Promised! Glad to hear it worked out for you. As far as the beer goes I only kid. As a fellow noob I enjoy giving back whenever I can. Have a good one.
  9. The perfect word to explain regex is torture. It's an extremely powerful tool as long as your willing to lose a bit of hair in the process. Anyways, I'll assume the getpage() function is a curl call and your passing the url to it. I think I see your problem here and its a bit ironic. Remember I was asking you if you wanted to download the file? Thats exactly what it's trying to here by downloading the form code once it's successful: preg_match("/<form action=\"([^\"]+)\" method=\"post\">/",$index,$match); //print $index; See that. Its grabbing the form code when it should be going directly to the regex I gave you. So put in my regex into that place like so: $index=getpage($row[1]); if(strpos($index,"The file could not be found. Please check the download link.")===false && strpos($index,"Due to a violation of our terms of use, the file has been removed from the server.")===false) { preg_match("/<table\sclass="downloading"\>.+<b>(.*?)\<\/b\>.+\<span\sclass="size"\>\| (.*?)\<\/span\>/",$index,$match); //HERE Grab the $match[1] and $match which are the values we spoke about before THEN Insert into the DB or output to a txt file. Erase all of this: Reason I'm telling you to erase that part is because you mentioned you werent interesting in downloading anything just grabbing the link, file size and filename. That's it. Besides I wouldn't use that code anyhow and prefer a regex over it. Anyways removing all of that code should make it work especially since your first regex statement is NOT looking for a form but rather those values you wanted.
  10. Here's a general function I use for simple curl checks. I'll remove the function part of it. $url = "http://whatever.com"; $agent - "Mozilla/5.0 (Windows; U; Windows NT 5.2 en-US;rv:1.9.0.7)Gecko/2009021910 Firefox/3.0.7"; $ch = curl_init(); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch , CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_URL, $url); $result = curl_exec($ch); curl_close($ch); $pattern = '/(?s)\<item\>.*?\<\/item\>/'; preg_match ($pattern, $result, $output); //ADD IN THE VARS TO GRAB EACH PORTION if $output is empty then = bad link. Else put vars into appropriate places Instead of that pattern, put the one I gave you and move the data into the appropriate vars.
×
×
  • 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.