Jump to content

lightningstrike

Members
  • Posts

    155
  • Joined

  • Last visited

    Never

Everything posted by lightningstrike

  1. Umm I'm not sure what your cURL spider is actually loading. could you try putting echo $Page; at the end of the page at share the results.
  2. Well that means that fileLocation in your mysql table contains no data. maybe show us the rows in your table that your trying to delete.
  3. Can you show me the code for the actual page that is calling these functions. Edit: Alright I'll take a closer look at the original code.
  4. Try debugging it by putting after the unlink statement print_r($g); then post all the data it prints.
  5. <?php set_time_limit(100); include('includes.php'); // get the search string passed to the page, and the page number if there is one $searchString = ''; if (!empty($_GET)) { $searchString = $_GET['id']; } // this is the URL that needs to be requested to get the XML results $serviceURL = 'http://www.find-services.co.uk/cd/cdPrices.aspx?id='; $serviceURL .= $searchString; $serviceURL .= '&site='; $serviceURL .= getSiteToken(); $serviceURL .= '&mode=heavy&sort=price'; if (isSpider(getenv("HTTP_USER_AGENT"))) { $serviceURL .= '&cache=1'; } // call the service, the returned XML is in $Page $Page = GetPage($serviceURL,''); // create an XML parser $parser = xml_parser_create(); // declare some variables for use in parsing the XML $lastTag = ''; $cdTitle = ''; $cdPicURL = ''; $cdRetailer = ''; $cdRetailerID = ''; $cdTotalPrice = ''; $cdDeepLink = ''; $cdReleaseDate = ''; $cdCategory = ''; $cdReview = ''; $cdTracks = ''; $cdArtist = ''; $cdLastRetailerID = ''; // this is because the character data event handler splits data on an & character // set options and event handlers for the XML parser xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true); xml_set_element_handler($parser, "startElement", "endElement"); xml_set_character_data_handler($parser, "characterData"); // parse the XML and stop if there is a problem if (!xml_parse($parser, $Page)) { die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser))); } // free up memory from this XML parser xml_parser_free($parser); // event handler for start elements in the XML function startElement($parser, $name, $attrs) { global $lastTag; // get the tag name $lastTag = $name; switch ($name) { case "RETAILERS": echo '<table width="350" cellspacing="1" cellpadding="2">'; break; } } // event handler for end elements in the XML function endElement($parser, $name) { // allow access to global variables global $cdTitle, $cdArtist, $cdLastRetailerID, $cdPicURL, $cdReview, $cdTracks, $cdReleaseDate, $cdRetailer, $cdTotalPrice, $cdDeepLink, $cdRetailerID; // determine the name of the tag in the XML switch ($name) { case "IMAGEURL": echo '<div style="float:right;width:250px;"><div align="center"><img border="0" src="',$cdPicURL,'" alt="',$cdTitle,'" class="reflect rheight33 ropacity66" /></div><div id="lw_context_ads">Review:<br />',$cdReview,'</div></div>'; break; case "TITLE": echo '<h1 style="margin:0px;padding:0px;" title="',$cdTitle,'">',$cdTitle,'</h1>'; break; case "TRACK": echo '',$cdTracks,''; break; case "RELEASED": echo '<strong>Release date:</strong> ',$cdReleaseDate,'<br />'; break; case "RETAILERS": echo '</table>'; break; case "TOTAL": // display those retailers with a price if ($cdTotalPrice != '') { echo "<tr class='hovering'"; echo '<td nowrap="nowrap" align="left"><a title="header=[Click to Buy for £',$cdTotalPrice,']body=[]fade=[on]" target="_blank" href="redirect.php?retailer=',$cdRetailerID,'&deeplink=',urlencode($cdDeepLink),'">',$cdRetailer,'</a></td>'; echo '<td nowrap="nowrap" align="center"><a title="header=[Click to Buy for £',$cdTotalPrice,']body=[]fade=[on]" target="_blank" href="redirect.php?retailer=',$cdRetailerID,'&deeplink=',urlencode($cdDeepLink),'"><strong>£',$cdTotalPrice,'</strong></a></td>'; echo '<td nowrap="nowrap" align="right"><a title="header=[Click to Buy for £',$cdTotalPrice,']body=[]fade=[on]" target="_blank" href="redirect.php?retailer=',$cdRetailerID,'&deeplink=',urlencode($cdDeepLink),'">Visit shop</a>'; echo '</tr>'; } $cdLastRetailerID = ''; $cdTotalPrice = ''; $cdRetailer = ''; $cdDeepLink = ''; $cdRetailerID = ''; break; } } echo '<title>',$cdTitle,' by ',$cdArtist,' - rockcrypt.com</title>'; // event handler for the XML character data (i.e. the actual data in the XML) function characterData($parser, $data) { global $lastTag, $cdTitle, $cdArtist, $cdPicURL, $cdReview, $cdTracks, $cdReleaseDate, $cdRetailer, $cdTotalPrice, $cdDeepLink, $cdRetailerID, $cdLastRetailerID; switch ($lastTag) { case "IMAGEURL": $cdPicURL = $data; break; case "TITLE": $cdTitle .= $data; break; case "REVIEW": $cdReview .= $data; break; case "TRACK": $cdTracks .= $data . ", "; break; case "RELEASED": $cdReleaseDate = $data; break; case "NAME": $cdRetailer = $data; break; case "TOTAL": $cdTotalPrice = $data; break; case "ARTIST": $cdArtist = $data; break; case "PRODUCTURL": if ($cdRetailerID == $cdLastRetailerID) { $cdDeepLink .= $data; } else { $cdDeepLink = $data; } $cdLastRetailerID = $cdRetailerID; break; case "IDENT": $cdRetailerID = $data; break; } } function isSpider($userAgent) { //if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'spider') !=== false) { //return 'spider'; //} if (stristr($userAgent, "Googlebot")|| /* Google */ stristr($userAgent, "Slurp")|| /* Inktomi */ stristr($userAgent, "MSNBOT")|| /* MSN */ stristr($userAgent, "MMCrawler")|| /* Yahoo */ stristr($userAgent, "teoma")|| /* Teoma */ stristr($userAgent, "ia_archiver")|| /* Alexa */ stristr($userAgent, "Scooter")|| /* Altavista */ stristr($userAgent, "Mercator")|| /* Altavista */ stristr($userAgent, "FAST")|| /* AllTheWeb */ stristr($userAgent, "MantraAgent")|| /* LookSmart */ stristr($userAgent, "Lycos")|| /* Lycos */ stristr($userAgent, "OmniExplorer")|| /* Omni categorizer */ stristr($userAgent, "HenryTheMiragoRobot")|| /* Mirago */ stristr($userAgent, "Ocelli")|| /* Ocelli */ stristr($userAgent, "ichiro")|| /* ichiro */ stristr($userAgent, "aipbot")|| /* aipbot */ stristr($userAgent, "ExactSearch")|| /* ExactSearch */ stristr($userAgent, "psbot")|| /* PicSearch */ stristr($userAgent, "cometsearch")|| /* CometSystems */ stristr($userAgent, "ZyBorg") /* WISEnut */ ) return TRUE; return FALSE; } ?> Try that.
  6. Umm can you show us your php because we have no idea what you're doing.
  7. mysql_fetch_array returns a associative array so unlink($g["fileLocation"]);
  8. <?php set_time_limit(100); include('includes.php'); // get the search string passed to the page, and the page number if there is one $searchString = ''; if (!empty($_GET)) { $searchString = $_GET['id']; } // this is the URL that needs to be requested to get the XML results $serviceURL = 'http://www.find-services.co.uk/cd/cdPrices.aspx?id='; $serviceURL .= $searchString; $serviceURL .= '&site='; $serviceURL .= getSiteToken(); $serviceURL .= '&mode=heavy&sort=price'; if (isSpider(getenv("HTTP_USER_AGENT"))) { $serviceURL .= '&cache=1'; } // call the service, the returned XML is in $Page $Page = GetPage($serviceURL,''); // create an XML parser $parser = xml_parser_create(); // declare some variables for use in parsing the XML $lastTag = ''; $cdTitle = ''; $cdPicURL = ''; $cdRetailer = ''; $cdRetailerID = ''; $cdTotalPrice = ''; $cdDeepLink = ''; $cdReleaseDate = ''; $cdCategory = ''; $cdReview = ''; $cdTracks = ''; $cdArtist = ''; $cdLastRetailerID = ''; // this is because the character data event handler splits data on an & character // set options and event handlers for the XML parser xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true); xml_set_element_handler($parser, "startElement", "endElement"); xml_set_character_data_handler($parser, "characterData"); // parse the XML and stop if there is a problem if (!xml_parse($parser, $Page)) { die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser))); } // free up memory from this XML parser xml_parser_free($parser); // event handler for start elements in the XML function startElement($parser, $name, $attrs) { global $lastTag; // get the tag name $lastTag = $name; switch ($name) { case "RETAILERS": echo '<table width="350" cellspacing="1" cellpadding="2">'; break; } } // event handler for end elements in the XML function endElement($parser, $name) { // allow access to global variables global $cdTitle, $cdArtist, $cdLastRetailerID, $cdPicURL, $cdReview, $cdTracks, $cdReleaseDate, $cdRetailer, $cdTotalPrice, $cdDeepLink, $cdRetailerID; // determine the name of the tag in the XML switch ($name) { case "IMAGEURL": echo '<div style="float:right;width:250px;"><div align="center"><img border="0" src="',$cdPicURL,'" alt="',$cdTitle,'" class="reflect rheight33 ropacity66" /></div><div id="lw_context_ads">Review:<br />',$cdReview,'</div></div>'; break; case "TITLE": echo '<h1 style="margin:0px;padding:0px;" title="',$cdTitle,'">',$cdTitle,'</h1>'; break; case "TRACK": echo '',$cdTracks,''; break; case "RELEASED": echo '<strong>Release date:</strong> ',$cdReleaseDate,'<br />'; break; case "RETAILERS": echo '</table>'; break; case "TOTAL": // display those retailers with a price if ($cdTotalPrice != '') { echo "<tr class='hovering'"; echo '<td nowrap="nowrap" align="left"><a title="header=[Click to Buy for £',$cdTotalPrice,']body=[]fade=[on]" target="_blank" href="redirect.php?retailer=',$cdRetailerID,'&deeplink=',urlencode($cdDeepLink),'">',$cdRetailer,'</a></td>'; echo '<td nowrap="nowrap" align="center"><a title="header=[Click to Buy for £',$cdTotalPrice,']body=[]fade=[on]" target="_blank" href="redirect.php?retailer=',$cdRetailerID,'&deeplink=',urlencode($cdDeepLink),'"><strong>£',$cdTotalPrice,'</strong></a></td>'; echo '<td nowrap="nowrap" align="right"><a title="header=[Click to Buy for £',$cdTotalPrice,']body=[]fade=[on]" target="_blank" href="redirect.php?retailer=',$cdRetailerID,'&deeplink=',urlencode($cdDeepLink),'">Visit shop</a>'; echo '</tr>'; } $cdLastRetailerID = ''; $cdTotalPrice = ''; $cdRetailer = ''; $cdDeepLink = ''; $cdRetailerID = ''; break; } } echo '<title>',$cdTitle,' by ',$cdArtist,' - rockcrypt.com</title>'; // event handler for the XML character data (i.e. the actual data in the XML) function characterData($parser, $data) { global $lastTag, $cdTitle, $cdArtist, $cdPicURL, $cdReview, $cdTracks, $cdReleaseDate, $cdRetailer, $cdTotalPrice, $cdDeepLink, $cdRetailerID, $cdLastRetailerID; switch ($lastTag) { case "IMAGEURL": $cdPicURL = $data; break; case "TITLE": $cdTitle .= $data; break; case "REVIEW": $cdReview .= $data; break; case "TRACK": $cdTracks .= $data . "\r\n"; break; case "RELEASED": $cdReleaseDate = $data; break; case "NAME": $cdRetailer = $data; break; case "TOTAL": $cdTotalPrice = $data; break; case "ARTIST": $cdArtist = $data; break; case "PRODUCTURL": if ($cdRetailerID == $cdLastRetailerID) { $cdDeepLink .= $data; } else { $cdDeepLink = $data; } $cdLastRetailerID = $cdRetailerID; break; case "IDENT": $cdRetailerID = $data; break; } } function isSpider($userAgent) { //if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'spider') !=== false) { //return 'spider'; //} if (stristr($userAgent, "Googlebot")|| /* Google */ stristr($userAgent, "Slurp")|| /* Inktomi */ stristr($userAgent, "MSNBOT")|| /* MSN */ stristr($userAgent, "MMCrawler")|| /* Yahoo */ stristr($userAgent, "teoma")|| /* Teoma */ stristr($userAgent, "ia_archiver")|| /* Alexa */ stristr($userAgent, "Scooter")|| /* Altavista */ stristr($userAgent, "Mercator")|| /* Altavista */ stristr($userAgent, "FAST")|| /* AllTheWeb */ stristr($userAgent, "MantraAgent")|| /* LookSmart */ stristr($userAgent, "Lycos")|| /* Lycos */ stristr($userAgent, "OmniExplorer")|| /* Omni categorizer */ stristr($userAgent, "HenryTheMiragoRobot")|| /* Mirago */ stristr($userAgent, "Ocelli")|| /* Ocelli */ stristr($userAgent, "ichiro")|| /* ichiro */ stristr($userAgent, "aipbot")|| /* aipbot */ stristr($userAgent, "ExactSearch")|| /* ExactSearch */ stristr($userAgent, "psbot")|| /* PicSearch */ stristr($userAgent, "cometsearch")|| /* CometSystems */ stristr($userAgent, "ZyBorg") /* WISEnut */ ) return TRUE; return FALSE; } ?> I just added \r\n after the cdTracks data not sure if I'm understanding your problem correctly.
  9. Without posting your php code we cannot assist you properly.
  10. Umm use a / to signify $dir as a directory $fullfile = $dir . "/" . $file;
  11. \r\n represents a carriage return and a new linefeed you can just add that after printing each track.
  12. I believe it should be like this UPDATE table SET value1 = '" . $variable1 . "', value2 = '" . $variable2 . "' WHERE value = '" . $x . "' and so on
  13. Has to deal with mozilla firefox's about:config settings network.http.max-persistent-connections-per-server That value is user set on the browser. Meaning that firefox will request the page x times. I changed my value to 1 and it worked fine but before when it was 2 it increased your views by 2 each actual view.
  14. Umm if you don't have register_globals on, then shouldn't you use $page = $_GET["page"];
  15. Umm $PATH_INFO is just a local scope variable. You need to define it yourself using the pathinfo() function. e.g. $PATH_INFO = pathinfo("/path/to/files/");
  16. No matter what you would have to use javascript in order for the mouseover to activate. You can store the coords with php. But the javascript needs to use those coords to show the image tag. For example: <img src="image.JPEG" width="145" height="126" alt="Planets" usemap="#tag" /> <map id ="tag" name="tag"> <area shape ="rect" coords ="0,0,82,126" onMouseOver="writeText('This part of the image has been tagged')" alt="Sun" /> </map> With writeText being a proprietary javascript function you would have to create to display the text.
  17. Don't worry about that MySQL handles that automatically. e.g. "company co" tells MySQL to abbreviate table company as co. You should type it as Barand did it with cu.col1, cu.col2 etc.
  18. cu stands for the table customers, and co table company col1 and col2 are for you to change into the appropriate column names i believe or if you need all the row data you could remove both of them and put a * instead.
  19. This can be accomplished with Apache's .htaccess files by creating a rewrite rule, it has nothing to do with php. http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
  20. I'm pretty sure, most search engines ignore javascript and cookie headers. So they usually generate tons of sessions, like googlebot and the yahoo bot who cause message boards guest numbers to skyrocket. Unless of course the website appends the Session id to the links.
  21. Well the only solution I can think of would be to access the website initially, and read the headers to save the cookie. Then save the sessionid to a variable. Then when starting a new cURL session to send in the headers cookie information with the sessionid.
  22. $otheralbum_cover = $_POST["file"][0]; I believe thats what you want.
  23. maybe you should look into the LIMIT clause to increase the speed, and show only x results per page.
  24. In order to do that you would need to parse the text provided using replacing functions in order to convert the code into in html. For example to parse tags you could use. $string = str_replace("[b]","<b>",$string); $string = str_replace("[/b]","</b>",$string); by the way for more advanced replacements like for links and image tags which require regular expressions you should check out PHPfreaks regexp forum.
  25. do you mean a function like str_replace($search,$replace,$string); ?
×
×
  • 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.