Jump to content

the-sexy-slug

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Everything posted by the-sexy-slug

  1. I am getting an email with this error all the time when I run the cron script bellow this is the error/warning email I am getting :- tar: Removing leading `/' from member names This is the cron I am running :- cd /home/user/access-logs rm -f /home/user/accesS_logs.tar.gz tar -zcvf /home/user/accesS_logs.tar.gz /home/user/access-logs/* cd /home/user/ mutt -a accesS_logs.tar.gz emailaddress@gmail.com -s "RAW Log Backup" -f /home/user/mail_body < /dev/null I have removed my email address and username for security reasons Any help would be most greatfull as I have been trying to solve this now for the past 10 hours! Thanks all in advance
  2. Thanks for your reply. I will check them out I will update this thread as and when I have worked out the search form I am off now to do some newbie stuff lol Thanks again for you help.
  3. It would be a standard search form box on my site not any externam sites. What ever they put in that search box would then be made into a php page/file and linked to a sidebar file and echo the search term also in the generated page. Its a little project as I have seen a few flat file blogs etc that do not have this feature and I just thought it would be an interesting project to learn php with.
  4. Hello This is what I am wanting to do can it be done in php without database or mysql? Basically what I would like to do is from a seach box on my site I would like to take the search term that the user inputs into that search box and then place that seach term on a php page that is automatically generated with the filename search-term.php and is added to a sidebar. The keyword would also be placed on the webpage with a tag %searchterm% so I can have text "you searched for %searchterm%" and it will echo the users search term that they put into the search box. Like I said I am new to php coding so this is a project that I would like to try. It will involve auto generating php files and auto adding links to pages and keyword grabbing. I would like to do this with out mysql or databases.
  5. Thank you thorpe for your help and sorry for posting in the wrong forum. I have tried what you suggested in the search.php file in my wordpress test blog and it has given me a syntax error:- Parse error: syntax error, unexpected '{' Also yes you are correct I am not great at php but I am very slowly learning.
  6. Hello I would like a little help. What I would like to do is to use the default wordpress search function and instead of it searching the blog database for results what I would like to do is to use the keyword that was entered in the wordpress blog search box and display a page that will just basically echo that search term. I do not want it to show results from my blog like posts or pages just the search term. I know that sounds strange but can it be done and if it can how is it done. I am not very knowledgeable on the wordpress coding. Thanks.
  7. Yes each page would have a different feed. The feed will contain around 100 links that I would like to keep but split into pages like page 1 - 2 - 3 etc to the benifit of my web site design and make my site more usable.
  8. Hello I am looking to put a rss feed on my web pages. Each page will have a different feed. The feed gives me 100 results. What I would like to do is to show those 100 results but not show them all in one page. What I would like to do is to split those results into 5 pages showing 20 results for each rss link. Like I said each page will have a new rss link and I am on paid shared hosting so it would need to have little rescourse impact on there hosting servers. Is this possible and if so how would I acheive this please. I am a new learner in PHP with very little knowledge but as I work more with the code the more I am SLOWLY begining to understand how it works Thanks all for your help in advance.
  9. Hello I would like a little advice please. I would like to geo target certain Javascript ads to certain coutry visitors that visit my site. What I am interested in doing is using the Maxmind javascript api which can be found here:- http://www.maxmind.com/app/javascript And then I would like to target the ads for different countries on my site. For example:- UK: will see uk ads in pound sterling US: will see ads in us dollars AUSTRALIA: will see australian ads Etc... How could I accomplish this in Javascript? The reason why I am not using PHP is due to the site I am making is to be hosted on a server that does not have PHP. Thanks all in advance for your kind help. PS. I will be using Generated Javascript code for the ads.
  10. Nightslyr you are a saint Thank you for your kind help. Option 1 worked a treat
  11. It is the code that the EPN or the Ebay partner Netword Editors tool kit creates. Thanks
  12. Hello I am trying to post a javascript code an example would be adsense into a php script and all I am getting is this error:- This is my very simple script: <?php echo "<script language="JavaScript" src=""></script>"; ?> I have not posted the full script as it is a affiliate link script. Thanks in advance
  13. Thanks for the reply. I have changed the > and < with the < etc as you suggested and I still get the same error. What I am trying to do is to post a ebay affiliate link that I created using there ebay tool kit program. It produces a javascript code that you paste in your website. And for some reason it is not working when I paste into the php.
  14. Thank you for yout reply. That seams to work with text but when I put in a javascript ad code it gives me an error:- Any advice to help me show javascript ads for different locations would be very much appreciated. I have been trying to solve this problem now for months. Thanks all in advance for your advice.
  15. Hello I am trying to show/geo target content for certian countries that my visitors to my site are from. I have doing a little research on google and have found a few script but for some reason they do not work. I know about the geoip database from maxmind but I am looking for a remote solution as the geoip database is said to be a heavy strain on servers if you get a lot of visitors. I am hosted on a shared server so I do not want to get my account suspended for over working the server. Also I have a few sites that will use this idea. This is a script I found whilst googling and all it does is give me an error. <?php $ip = $_SERVER [ 'REMOTE_ADDR' ]; $country = file_get_contents ( 'http://api.hostip.info/country.php?ip=' . $ip ); if ( $country == "US" ) { echo "<American-English Ringtone Ad Tag>" ; } elseif ( $country == "AU" OR $country == "UK" OR $country == "IE" ) { echo "<British-English Ringtone Ad Tag>" ; } else { echo "<YPN Ad Tag>" ; } ?> This is the error it gives me:- What I am trying to do is to geo target Javascript ads for different countries. When I add the javascript ad it gives me that error. If I just put in normal text then it works ok. Thank you all for your help in advance.
  16. Hello I am having trouble with 302 and 301 redirects links in PHP. The reason why am I asking this question is due to a recent post on the eBay Partner network blog stating that the 302 redirects are against the eBay Partner network terms of service. Most of my shops use the Mac jiffy open source affiliates script. I would like to know please if anybody could advise me on how I can make the links or redirect links 301 instead of 302 redirect links. I will post the code for the index page of the mc jiffy script. <?php // McJiffy EASy 1.4 // http://www.mcjiffy.com $version = "1.4"; if (!defined('ROOT_DIR')) define('ROOT_DIR', realpath(dirname(__FILE__)).'/'); // load country settings require_once 'country.php'; // load default config require_once ROOT_DIR.'sites/default.php'; // load site specific config findSite($_SERVER['HTTP_HOST']); define('THEME_DIR',ROOT_DIR.'themes/'.$site['theme']); define('AFFILID',$site['account']); // get the base url from the current request $baseUrl = str_replace("index.php","",$_SERVER['PHP_SELF']); $themeUrl = $baseUrl."themes/"; $mainkeywords = split(',',$site['mainkeywords']); $country = array(); if (empty($site['country'])) { $country = findCountry($_SERVER['HTTP_ACCEPT_LANGUAGE']); } else { $country = $countrySettings[strtolower($site['country'])]; } define('GEO_COUNTRY_TLD',$country['GEO_COUNTRY_TLD']); define('GEO_PLACEMENT_ID',$country['GEO_PLACEMENT_ID']); define('GEO_SITE_ID',$country['GEO_SITE_ID']); define('GEO_LANGUAGE',$country['GEO_LANGUAGE']); // define cache lifetimes in seconds if (empty($site["CACHE_KEYWORD_TIME"])) { $site["CACHE_KEYWORD_TIME"] = 604800; // 7 days in seconds } if (empty($site["CACHE_ITEMS_TIME"])) { $site["CACHE_ITEMS_TIME"] = 300; // 5 minutes in seconds } if (empty($site["CACHE_GUIDES_TIME"])) { $site["CACHE_GUIDES_TIME"] = 604800; // 7 days in seconds } if (array_key_exists("action",$_GET)) { $action = $_GET["action"]; } else { $action = "buy"; } // set url for this request $url = "http://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; $q = ""; $keyword = ""; if (!empty($_GET["q"])) { $q = $_GET["q"]; $q = str_replace('-',' ',$q); $keyword = $q; } else { $keywordArray = split(',',$site['mainkeywords']); $keyword = $keywordArray[0]; $q= $keyword; } if ($action=="go") { $link = $_GET['link']; goLink($link, $keyword); exit(); } if ($action=="guide") { $link = $_GET['link']; guideLink($link, $keyword); exit(); } $page = 1; if (!empty($_GET["page"])) { $page = $_GET["page"]; } $pageSize = 21; if (!empty($site['pagesize'])) { $pageSize = $site['pagesize']; } // look for text file for this keyword if (empty($site["textdirectory"])) { $site["textdirectory"] = "text"; } if (file_exists(ROOT_DIR.$site["textdirectory"].'/'.urlencode($q).'.txt')) { $keywordtext = file_get_contents(ROOT_DIR.$site["textdirectory"].'/'.urlencode($q).'.txt'); } else { $keywordtext = null; } $keywordsXML = getEbayKeywords($q); foreach($keywordsXML->PopularSearchResult as $item) { $topicsString = $item->AlternativeSearches; $relatedString = $item->RelatedSearches; if (!empty($topicsString)) { $topics = split(";",$topicsString); } if (!empty($relatedString)) { $related = split(";",$relatedString); } } $node = array(); $node['keywords'] = $q; // set sort by if (!empty($site["sortby"])) { $node['sortby'] = $site["sortby"]; } // set ebay category if (!empty($site["ebaycat"])) { $node['ebaycat'] = $site["ebaycat"]; } // set min price if (!empty($site["minprice"])) { $node['minprice'] = $site["minprice"]; } // set max price if (!empty($site["maxprice"])) { $node['maxprice'] = $site["maxprice"]; } // set auction type if (!empty($site["auctiontype"])) { $node['auctiontype'] = $site["auctiontype"]; } else { // default to all $node['auctiontype'] = 0; } $xml = ebay_rss($node); $ebayItems = array(); $totalItems = count($xml->channel->item); $totalPages = $totalItems / $pageSize; $i = 0; foreach ($xml->channel->item as $item) { $ebayRss = $item->children('urn:ebay:apis:eBLBaseComponents'); if ($i>=($pageSize*($page-1)) && $i<($pageSize*$page)) { $newItem = array(); $newItem['title'] = $item->title; $newItem['link'] = buyLink($item->link, $q); $newItem['image'] = ebay_stripImage($item->description); $newItem['currentbid'] = ebay_convertPrice($item->description); $newItem['bidcount'] = $ebayRss->BidCount; $newItem['endtime'] = ebay_convertTime($ebayRss->EndTime); $newItem['type'] = $ebayRss->AuctionType; if (!empty($ebayRss->BuyItNowPrice)) { $newItem['bin'] = ebay_convertPrice($item->description); } array_push($ebayItems, $newItem); } $i++; } $pageNumbers = array(); for ($i=1; $i<=$totalPages; $i++) { array_push($pageNumbers, $i); } // get user guides $guidesXML = getEbayGuides($q); $guides = array(); foreach ($guidesXML->guide as $guideXML) { $guide = array(); $guide['url'] = makeguideLink($guideXML->url, $q); $guide['title'] = $guideXML->title; $guide['desc'] = $guideXML->desc; array_push($guides,$guide); } $impressionPixel = makeImpressionPixelImg($keyword); // write html output include('themes/'.$site['theme'].'/index.php'); // END PAGE LOAD LOGIC // The following are helper functions function findSite($domain) { global $site; if ($domain=="") { return; } $a = split("\.",$domain); if (count($a)>0) { for ($i=count($a);$i>0; $i--) { $newdomainA = array_slice($a, $i-1, count($a)); $newdomain = implode(".",$newdomainA); if (file_exists(ROOT_DIR.'sites/'.$newdomain.'.php')) { require_once ROOT_DIR.'sites/'.$newdomain.'.php'; } } } } function writeNewFile($filename, $numberSeconds) { if (file_exists($filename)) { if (time()- filemtime($filename) > $numberSeconds) return true; else return false; } else { return true; } } function saveUrl($dir, $url, $file, $age, $out=null) { // allow passing of content directly to the file writing code, bypassing the url grabbing if ($out==null) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, false); $out = curl_exec ($ch); curl_close ($ch); } // Let's check the file perms before trying to write to the folder. if (fileperms(ROOT_DIR.'cache/') != '16895') { echo "<center><font size='28' color='red'>ERROR!</font><br>Cache folder not writeable<br>Make sure " .ROOT_DIR . "cache/ has writeable permissions (777)</center>"; exit; } // create the cache directory if needed. if (!is_dir($dir)) { mkdir($dir,0777, true); } // make sure we can write to the cache file if (!$handle = fopen($file, 'w+')) { echo "<center><font size='28' color='red'>ERROR!</font><br>Cannot save file: $file.<br>Make sure " .ROOT_DIR . "cache/ has writeable permissions (777)</center>"; exit; } // write the cache file if (!fwrite($handle, $out)) { echo "<center><h2><font color='red'>ERROR: Cannot write to file ($query)<br>Make sure " .ROOT_DIR . "cache/ has writeable permissions (777)</font></h2></center>"; exit; } fclose($handle); // delete old files from this directory if ($dh = opendir($dir)) { $deleteTime = time() - $age; while (($oldfile = readdir($dh)) !== false) { if (is_file($dir . $oldfile) && (filectime($dir . $oldfile)<$deleteTime)) { unlink($dir.$oldfile); } } closedir($dh); } } function getEbayGuides($query) { global $site; $dir = ROOT_DIR.'cache/guides/'; $xmlFile = $dir.urlencode($query).'.xml'; if (writeNewfile($xmlFile, $site["CACHE_GUIDES_TIME"])) { $SafeQuery = urlencode($query); // Make the query URL-friendly $url = "http://search.reviews.ebay.com/ws/UCSearch?satitle=$query&ucc=g&fts=2&ugat=2&ufm=1"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, false); $str = curl_exec ($ch); curl_close ($ch); $pattern = '/<li class="catalog"><a href="(.*?)">(.*?)<\/a>.*<li class="desc">(.*)/'; $xml = "<guides>"; if (preg_match_all($pattern, $str, $matches)>0) { array_shift($matches); for ($i=0;$i<count($matches[0]);$i++) { $xml .= "<guide>"; $xml .= "<url><![CDATA[". $matches[0][$i]."]]></url>"; $xml .= "<title><![CDATA[". $matches[1][$i]."]]></title>"; $xml .= "<desc><![CDATA[". $matches[2][$i]."]]></desc>"; $xml .= "</guide>"; } } $xml .= "</guides>"; saveUrl($dir, $url, $xmlFile, $site["CACHE_GUIDES_TIME"],$xml); } $resp = simplexml_load_file($xmlFile); return $resp; } function getEbayKeywords($query, $cat=-1) { global $AppId, $site; $dir = ROOT_DIR.'cache/keywords/'; $xmlFile = $dir.urlencode($query); if (!empty($site['ebaycat'])) { $xmlFile .= '-'.$site['ebaycat']; } $xmlFile .= '.xml'; // cache the keywords file for 7 days since they won't change much if (writeNewfile($xmlFile, $site["CACHE_KEYWORD_TIME"])) { $SafeQuery = urlencode($query); // Make the query URL-friendly $endpoint = 'http://open.api.ebay.com/shopping'; // URL to call $responseEncoding = 'XML'; // Type of response we want back $apicall = "$endpoint?callname=FindPopularSearches&version=571&appid=$AppId&QueryKeywords=$SafeQuery&responseencoding=$responseEncoding"; if (!empty($site['ebaycat'])) { $apicall .= '&CategoryID='.$site['ebaycat']; } saveUrl($dir, $apicall, $xmlFile, $site["CACHE_KEYWORD_TIME"]); } $resp = simplexml_load_file($xmlFile); return $resp; } function ebay_convertTime($str) { $endtime = $str; $endtime = substr($endtime, 0, 10); $endtime = date("M d, h:i a", $endtime); return $endtime; } function ebay_convertPrice($str) { $pattern = "/<strong>(.*?)>/"; if (preg_match($pattern, $str, $matches)>0) { return $matches[0]; } else { return null; } } function ebay_stripImage($str) { $pattern = "/<img(.*?)>/"; if (preg_match($pattern, $str, $matches)>0) { return $matches[0]; } else { return null; } } function buylink($url, $keyword) { global $baseUrl; return $baseUrl ."go/".urlencode($keyword)."/".base64_encode($url); } function makeguidelink($url, $keyword) { global $baseUrl; $i = strpos($url,"http://reviews.ebay.com/")+strlen("http://reviews.ebay.com/"); $url = substr($url, $i, strlen($url)); return $baseUrl ."guide/".urlencode($keyword)."/".$url; } function ebay_rss($node) { global $site; $dir = ROOT_DIR.'cache/'.AFFILID.'/'; $xmlFile = $dir.urlencode($node['keywords']).'-'.GEO_SITE_ID; if (!empty($site['ebaycat'])) { $xmlFile .= '-'.$site['ebaycat']; } $xmlFile .= '.xml'; // cache the rss long enough for someone to page through the results if (writeNewfile($xmlFile, $site["CACHE_ITEMS_TIME"])) { $url = 'http://rss.api.ebay.com/ws/rssapi?FeedName=SearchResults&siteId='.GEO_SITE_ID.'&language='.GEO_LANGUAGE.'&output=RSS20&sacur=0&from=R6&sacqyop=ge&saslc=0&floc=1&saprclo=&saprchi=&fcl=3&nojspr=y&afmp=&saslop=1&fss=0&'; $url .= 'saobfmts=insif&sacqy=&'; if (!empty($node['keywords'])) { $url .= 'satitle='.urlencode($node['keywords']).'&'; } if (!empty($node['ebaycat'])) { $url .= 'catref=C5&sacat='.$node['ebaycat'].'&'; } if (!empty($node['searchfields'])) { $url .= 'fts=' . $node['searchfields'] .'&'; } if (!empty($node['minprice']) && $node['minprice']>0) { $url .= 'saprclo='.$node['minprice'].'&'; } if (!empty($node['maxprice']) && $node['maxprice']>0) { $url .= 'saprchi='.$node['maxprice'].'&'; } $url .= '&sascs=' . $node['auctiontype'] .'&'; $url .= 'fsop=' . $node['sortby'] . '&'; $url .= 'saaff=afepn&customid=&afepn='.AFFILID.'&'; saveUrl($dir, $url, $xmlFile, $site["CACHE_ITEMS_TIME"]); } $rss = simplexml_load_file($xmlFile); if ($rss) { return $rss; } else { echo "error loading ebay items"; } return null; } function goLink($str, $keyword) { header('Location: ' . base64_decode($str)); exit(); } function guideLink($str, $keyword) { $url = 'http://rover.ebay.com/rover/1/' .GEO_PLACEMENT_ID. '/1?type=4&campid='. AFFILID. '&customid=' . urlencode($keyword) . '&toolid=10001&mpre=http%3A%2F%2Freviews.ebay.com%2F'.urlencode($str); header('Location: ' . $url); exit(); } function makeImpressionPixelImg($keyword) { $out = "<img style='text-decoration:none; border: 0; padding: 0; margin: 0;' src='http://rover.ebay.com/ar/1/"; $out .= GEO_PLACEMENT_ID."/1?mpt=" . rand(0, 1000)."&adtype=1&size=1x1&type=3&campid=". AFFILID. "&toolid=10005&"; $out .= "customid=".urlencode($keyword)."&ext=".urlencode($keyword)."&satitle=".urlencode($keyword)."'/>"; return $out; } function findCountry($lang) { global $countrySettings; $pattern = "/[a-zA-Z]{2}-[a-zA-Z]{2}/"; preg_match_all($pattern, $lang, $matches); $langs = $matches[count($matches)-1]; foreach ($langs as $l) { if (array_key_exists(strtolower($l), $countrySettings)) { return $countrySettings[strtolower($l)]; } } return $countrySettings['en-us']; } ?> sorry for the large post and thank you all in advance..
  17. Hello Is there a way to stop wordpress from cacheing _rss in the wp_options table because my database size when I started was under 1 meg and a few days later it was 19 megs and fill of _rss entries. This is proberbly due to a plugin that I do not want to disable. I would rather block the _rss enteries from being cached in the wp_options table of the MySql Database. I know about clean options plugin and options manager plugin. I would rather stop the cacheing automatically if possible. Thanks all in advance
  18. Thank you. After reading your explanation and looking at the code posted it sort of make sense to me now. Again thank you for you help
  19. This post is getting a litle embarasing for me as I am after a way to geotarget the Javascript that the EPN or ebay affiliate editor kit produces. 1) I think I have posted in the wrong section of the forum. 2) My knowledge is extremely limited. If a admin can move this post to get a better answer then thanks.
  20. Could someone please explain where the above code would be place on the site please. I am new to this. Thanks
  21. Thank you for your help. I am still a little confussed as I am not a accomplished PHP Coder I am a starter at this so if it can be explained a little simpler then I would be most greatfull. Will this automatically replace the Country code numbers in the premade rover links that the Editor kit created in the ebay editor toolkik from there affiliate site? Would I need to make a new php file and use a code snippet to call the functions in that file? Sorry for these questions like I said a am new to this and it is a little confussing for me. Thanks in advance for your time and help.
  22. Hello I am in need of a little help. I have found a tutorial on geo-targeting here >> http://www.thewebsiteprofessionals.com/geo-targeting.html I am completely stumped on how to geo-target the ebay affiliate rover links that the Epn Editor Kit Produces. I know that I have to change the rover link number to coraspond with the ebay link numbers for that country if you follow me. I will list the numbers bellow. eBay Program / Placement ID eBay US / 711-53200-19255-0 eBay AU / 705-53470-19255-0 eBay BE / 1553-53471-19255-0 eBay CA / 706-53473-19255-0 eBay ES / 1185-53479-19255-0 eBay FR / 709-53476-19255-0 eBay IT / 724-53478-19255-0 eBay UK / 710-53481-19255-0 eBay IE / 5282-53468-19255-0 eBay NL / 1346-53482-19255-0 eBay DE / 707-53477-19255-0 eBay AT / 5221-53469-19255-0 eBay CH / 5222-53480-19255-0 Use one of those numbers above in the rover link. Example the usual rover links look like this rover.ebay.com/rover/1/xxxx-xxxx-xxxx/ the "xxxx-xxxx-xxxx" then is replaced with one of the country numbers above. So if a visitor from Canada visited my UK based website I would like the UK ebay ads to show as Canada Ebay ads and have the Canada country code in the rover link. Example rover.ebay.com/rover/1/xxxx-xxxx-xxxx/ would be rover.ebay.com/rover/1/706-53473-19255-0/ for the ebay.ca site and not the ebay.co.uk My question is how can showing products from the visitors country and ebay site be done using the above Geo Targeting tutorial and using the EPN Editor kit on a PHP website. I hope this makes sense. Thanks all on advance for your time and help.
×
×
  • 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.