Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. Now lets look into making this a new array, and will also add preg_match to it for categories // find all td tags with class=forum_listing foreach($html->find('td.forum_listing') as $tdTagExt){ foreach($tdTagExt->find('a')as $aTagExt){ $title = $aTagExt->plaintext; $href = "http://www.backpackinglight.com".$aTagExt->href; //associating the link and title in a new array $links[] = array("title" => "$title","href" => "$href"); //echo "<a href='$href' target='_blank'>$title</a><br />"; } } //access the new array foreach($links as $link){ $category = "uncategorized"; if(preg_match("~tent~i", $link['title'])){ $category = "tent"; } if(preg_match("~bag~i", $link['title'])){ $category = "bag"; } if(preg_match("~shoe|footwear|boot|sneaker~i", $link['title'])){ $category = "shoe"; } if(preg_match("~shirt|pants|parka|shorts|jacket~i", $link['title'])){ $category = "clothing"; } echo "$category : <a href='".$link['href']."' target='_blank'>".$link['title']."</a><br />"; } I ran this and here is what the results looked like: uncategorized : FS or FT: Salomon XA 3D Ultra 2 Trail Runners (size 10.5) uncategorized : FS: Exped Downmat 7 Short (47") uncategorized : Wtb uncategorized : WTB >8oz Pack uncategorized : WTB Cuben Bivy uncategorized : Six moon designs, terra nova, jacks are better, borah gear, and more bag : FS: Montbell #3 & #5 bags bag : WTB 15 Degree Sleeping Bag bag : FS: Clearing house - bags, bivy, tarp, daypack, tent uncategorized : 22oz. 20 degree therm-a-rest sleep system. uncategorized : FS: Fox River Gripper Gloves Large bag : FS: Mont Bell UL Spiral Down Hugger Sleeping Bag #1 (15 degree) 6 ft. length uncategorized : FS: Zpacks Hexamid Long Tarp tent : WTB: Tarptent Contrail uncategorized : Rota Lacura Clarkii Rod (now w/ line and flies), Petzl Tikka XP 2 w/ Core uncategorized : WTB: Katabatic Palisade or Zpacks quilt uncategorized : FS Cold Cold World Ozone Pack $55 uncategorized : WTB: Deuter ACT Zero 45 + 15L SL or ACT Lite 40 + 10L SL uncategorized : FS: La Sportiva Quantum Trail Size 11.5-12 uncategorized : FS: 2013 EE RevX 30F quilt w/ 1oz overstuff, excellent condition clothing : WTB Golite Bitterroot or Selkirk Jacket; sub 6oz bivy; GG LT4 poles uncategorized : FS: Nemo Obi 2P uncategorized : FS: Patagonia Retro-X Windproof Fleece, Men's L, 2012 uncategorized : FS - Lightheart Gear Solo Cuben tent : WTB: Tarptent Rainshadow 2 as you can see it would be insane to try and categorize every possible word they can use in their titles. Are better off not trying to categorize them, save your data and let your search do the work.
  2. Have a look at how i seperated the href links from the title and appended the sites domain. foreach($html->find('td.forum_listing') as $tdTagExt){ foreach($tdTagExt->find('a')as $aTagExt){ $title = $aTagExt->plaintext; $href = "http://www.backpackinglight.com".$aTagExt->href; echo "<a href='$href' target='_blank'>$title</a><br />"; } }
  3. Welcome aboard, interesting post. Possibly some other members can inform you on what schooling they had, their job experiences and what they are currently doing. As for myself I've been programming since i was 8 and now 42, all self taught. I occasionally take on jobs if they interest me enough. I've had other jobs and businesses over my lifetime and always looked at coding as an interesting hobby while at the same time the ability to do my own projects. Simply put I do not rely upon it as a career. I'm gonna be as honest as can with you here, you seem nice and have a caring for your family...none of that will matter when it comes to obtaining work. What will be viewed is your educational training, job performance, completed projects and experience. The sad truth with getting a job is that employers mostly look at what papers you have more than what you can accomplish. I will say there are many talented people that went for certain schooling or degrees, but it's not the case for everyone. There is more than completing simple courses to make you an accomplished programmer. Having failed 2 years of college won't help you any. You may need to get whatever alternate training you can , possibly create a website and build a portfolio. Take on any jobs you can accomplish and add them to your portfolio. You will find out that many jobs are high demanding, require you to know a lot, do it efficiently as well as correct. As for being a professional programmer, that is going to take a lot of time and hard work. If say you wanted to do your own thing, the web is a big place and many people needing assistance. You can get into something like making templates or themes and sell them for instance. Do what you know and expand upon that. Try to do freelance work. A lot of people try to either make a project or get involved in projects to try to sweeten that resume. My final words of advice to you would be to get yourself a dependable 9-5 job and care for your family, in your free time work on anything else.
  4. It has always been an issue and most likely will never change. First you can try to join hotmails junk reporting program https://support.msn.com/eform.aspx?productKey=edfsjmrpp&ct=eformts&scrx=1 never send more than 50 emails in a minute to hotmail sending the correct headers, possibly optional headers bad or mismatched html SMTP server blacklisted or a bad reputation, use an authorized SMTP email server you don't pay the recieving email servers enough to ensure they get through try to make sure popular filtered words are not in your messages problems with your host? are too many being sent at one time? add unsubscribe links add email antispam solutions You can try using phpmailer
  5. If you really want good seo: all article/posts should have a title and also description single reference page to the article use clean urls (also known as fancy or pretty urls) meta tags in the head of your pages categories or tags help greatly getting the keywords into the search engines and also convenient for users consider using opengraph create a sitemap of your site include a meta robots tag to show them they can proceed or not also ensure your robots.txt file is proper set canonical urls , multiple urls going to the same location will harm your site in the search engines A very basic seo guide that can inform you as to why. http://moz.com/beginners-guide-to-seo
  6. When scraping data from sites, you should get the owners permission. Not only do they frown on people mass hitting their sites or using their data....but imagine spending lots of time on something and they just block you one day. It would be a lot easier if they supplied individual feeds or an api for you to access. I can understand why you would want your own search, they use a custom google search and searches it all. I have no idea what your intentions are with the data you will get, if it's to find stuff to purchase for yourself or to better the community. If it's the latter, why not talk to them and work on building a real site search using something like sphinx or a full text search using categories/forums sections Regardless what you do, still look into it for your own projects, save all the data and perform any sort of advanced search on it. link,title,url,category as your columns in a database table, make the url unique so there isn't duplicates. The reason I say what I do is because you can have a single select query displaying the data, the values in the select statement being dynamic coming from a dropdown or search keywords. To me it's a lot easier to just add a WHERE category='$category' if any categories were selected, otherwise never add the WHERE clause and show them all results. Ask if you need more help or info on anything I said, no sense to go into more detail if it's something not interested in doing.
  7. You have to fix their relative links, the links you are finding do not have the domain or subdomains in them. I don't know what your select query or variables looks like. Upon display append their domain to the front of the link for a simple fast fix . $link = "http://www.backpackinglight.com" . $link;
  8. Without knowing anything you are doing..... A link to the tutorial could help. To eliminate any duplicates....but will not help you for updating them. Run this mysql command using your values for tableName and columnName ALTER IGNORE TABLE tableName ADD UNIQUE (columnName); otherwise: Do a query on a specific value that should be unique and check that it does not exist before doing an insert. Can use if/else mysql statements to determine if is new data or update an existing one. This is just an example. //do a query something that has a unique value like an id,url or title $query = mysql_query("SELECT * FROM tableName WHERE title = '" . $escaped_title . "'"); //this will determine if it exists by seeing how many rows exist $check = mysql_num_rows($query); if ($check > 0) { //if exists update by using the id $row = mysql_fetch_array($query); $the_ID = $row['ID']; mysql_query("UPDATE tableName SET title='$escaped_title', description='$escaped_description', url='$escaped_url' WHERE ID='$the_ID'"); } else { //if does not exist insert a new and uses autoincrement id's mysql_query("INSERT INTO tableName (title,description,url) VALUES ('$escaped_title','$escaped_description','$escaped_url')"); }
  9. If you are looking to match their weight in the query, use $weight versus $_SESSION['username'] To display from the query results echo "<p>"; echo " age - " . $row['age'] . "<br />"; echo " weight - " . $row['weight'] . "<br />"; echo " experience - " . $row['experience'] . "<br />"; echo " username - " . $row['user'] . "<br />"; //is the new column you created user? echo "</p>";
  10. This could use lots of improving. You are inserting just the age,weight and experience into a database, but not including the username from the session Consider adding another column to your table for username ALTER TABLE users ADD username VARCHAR(30) FIRST; You should be checking if the POST inputs are set and also that it's not empty with also correct data types you expect, then sanitize/filter before inserting anything into your database. mysqli.real-escape-string() to sanitize data, for numbers...checking for numeric or ctype first will be fine for those. if($_POST){ if (isset($_SESSION['username'])){ $username = mysqli_real_escape_string($con,$_SESSION['username']); }else{ die("username failed"); } if (isset($_POST['age']) && trim($_POST['age']) != '' && is_numeric($_POST['age'])){ $age = trim($_POST['age']); }else{ die("age failed"); } if (isset($_POST['weight']) && trim($_POST['weight']) != '' && ctype_digit($_POST['weight'])){ $weight = trim($_POST['weight']); }else{ die("weight failed"); } if (isset($_POST['experience']) && trim($_POST['experience']) != '' && is_numeric($_POST['experience'])){ $experience = trim($_POST['experience']); }else{ die("experience failed"); } }else{ die("Nothing was submitted"); } $sql="INSERT INTO users (username,age,weight,experience) VALUES ('$username','$age','$weight','$experience')"; Some javascript to check for empty forms, but still check server side <form id="form_814832" class="appnitro" method="post" action="mmaking.php" onsubmit="if (document.getElementById('s').value.length < 1) return false;"> Just some suggestions, is other ways to do it as well. I just noticed you use mysql to connect first, and for the second using mysqli, mysql is deprecated, use mysqli instead.
  11. require_once("http://www.stopchallengechoose.com//wp-load.php"); There is a double slash after domain name require_once("http://www.stopchallengechoose.com/wp-load.php"); But this is all you should need to include it require('./wp-load.php');
  12. You can not get images that don't exist in the feed. http://rss.cnn.com/rss/cnn_topstories.rss
  13. Change to your image folder locations and should see images 10 per page paginated. Modify to suit your needs or merely look over how it's done and implement to your needs. array_slice() was used <html> <head> <style type="text/css"> body { margin: auto; padding: auto; width: 100%; color: #000000; font: normal 80%/120% Georgia, "Times New Roman", Times, serif; position: relative; } a { color: #000000; } .gallery { list-style: none; margin: 0; padding: 0; right: -100px; } .gallery li { margin: 5px; padding: 0; float: left; height: 100px; } .gallery img { background: #fff; border: solid 1px #ccc; padding: 4px; width: 100px; right: -100px; } .gallery span { width: 100px; height: 100px; display: block; position: absolute; top: 50%; } .gallery a:hover img { border: 1px solid #0000ff; width:500px; overflow: -100px auto; position: relative; z-index: 10; top: 0%; left: 0; } </style> </head> <body> <div class="gallery"> <?php function is_dir_empty($dir) { if (!is_readable($dir)) return NULL; return (count(scandir($dir)) == 2); } function paginate($display, $pg, $total) { if (isset($_SERVER['QUERY_STRING']) && trim($_SERVER['QUERY_STRING']) != '') { if (stristr($_SERVER['QUERY_STRING'], 'pg=')) $query_str = '?' . preg_replace('/pg=\d+/', 'pg=', $_SERVER['QUERY_STRING']); else $query_str = '?' . $_SERVER['QUERY_STRING'] . '&pg='; } else $query_str = '?pg='; $pages = ($total <= $display) ? 1 : ceil($total / $display); $first = '<a href="' . $_SERVER['PHP_SELF'] . $query_str . '1">« </a>'; $prev = '<a href="' . $_SERVER['PHP_SELF'] . $query_str . ($pg - 1) . '"> </a>'; $next = '<a href="' . $_SERVER['PHP_SELF'] . $query_str . ($pg + 1) . '"> </a>'; $last = '<a href="' . $_SERVER['PHP_SELF'] . $query_str . $pages . '"> »</a>'; echo '<div><p align="center">'; echo ($pg > 1) ? "$first : $prev :" : '« : :'; $begin = $pg - 4; while ($begin < 1) $begin++; $end = $pg + 4; while ($end > $pages) $end--; for ($i = $begin; $i <= $end; $i++) echo ($i == $pg) ? ' [' . $i . '] ' : ' <a href="' . $_SERVER['PHP_SELF'] . $query_str . $i . '">' . $i . '</a> '; echo ($pg < $pages) ? ": $next : $last" : ': : »'; echo '</p></div>'; } $display = 10; //how many items to display $pg = (isset($_REQUEST['pg']) && ctype_digit($_REQUEST['pg'])) ? $_REQUEST['pg'] : 1; $start = $display * $pg - $display; $dir = 'images/'; //images folder location $file_display = array( 'jpg', 'jpeg', 'png', 'gif', 'bmp' ); //image types to display if (file_exists($dir) == true) { if (is_dir_empty($dir)) { echo "No Images"; } else { $dir_contents = scandir($dir); $total = count($dir_contents); echo "Total count: $total<br />"; $slice = array_slice($dir_contents, $start, $display); paginate($display, $pg, $total); foreach ($slice as $file) { $file_type = strtolower(end(explode('.', $file))); if (in_array($file_type, $file_display) == true) { echo '<li><a href="', $dir, '/', $file, '" target="_blank" ><img src="', $dir, '/', $file, '" alt="', $file, '" /></li>'; } } } } else { echo "$dir not found"; } ?> </div> </body> </html>
  14. mysqli_real_escape_string
  15. Tried this my server to another, and my result showed the contents of the sh file
  16. To continue with what I said... Now remove that country=$country from the form and also hyperlink, treat it as this. if(!isset($_GET['country']) || trim($_GET['country']) == ''){ $country = "us"; }
  17. I was just gonna write what Psycho just wrote, use some sort of geolocation script, or a dropdown in the form with your desired countries. Besides not having anything as a GET value for country visible in this code I always like to check if any or all parameters are actually set in the url or create default values if not I wouldn't use spaces as the parameters name, you have "sort by", instead use "sort_by" if(!isset($_GET['sort_by']) || trim($_GET['sort_by']) == ''){ $sort_by = "newest"; } consider using a switch or an if/elseif/else versus all the if's Example using a switch: switch ($sort_by){ case "rate3asc": echo "Sorted by Lowest Price First"; break; case "rate3desc": echo "Sorted by Highest Price First"; break; case "newest": echo "Sorted by Recently Added Properties First"; break; case "bedsasc": echo "Sorted by Least Bedrooms First"; break; case "bedsdesc": echo "Sorted by Most Bedrooms First"; break; }
  18. To get the required help, it's best to show your relevant code. If your question is how to add that function to your own code... include the file with that function or paste the function say beginning of your php code and outside of any loops wherever you need to use that function, call on that function Example function MemberRouter ($routeme, $hailPostData) { $Routed = NULL; if ($_SESSION['AMember']["isloggedin"] == 'TRUE') { if (!empty($hailPostData) && $hailPostData !== 1) { $Routed = $hailPostData; include $hailPostData; return $Routed;} else { $Routed = 1; include 'CKmembers.php'; return $Routed;} } else { $Routed = 0;} if (isset($_POST['submit'])) { if (self::PostData()) { if (empty($routeme)) { $routeme = $_POST['submit']; } } else { $routeme = "routeback"; $Routed = $_SERVER["PHP_SELF"]; include $_SERVER["PHP_SELF"]; return 0; } } if ($_SESSION['AMember']["isloggedin"] == 'TRUE') { include 'CKmembers.php'; return 1;} else { include 'log.php'; } while (!$out) { switch ($routeme) { case "routeback": $Routed = '$_SERVER["PHP_SELF"]'; include $_SERVER["PHP_SELF"]; return 1; $out = 1; break; case "login": $ML = self::MemberLogin(); if ($ML) { $_SESSION['AMember'] = array('isloggedin' => 'TRUR', RID => '', Username => $_SESSION['field']['username'], ipaddress => '', time => ''); //need site/server prob. $routeme = "loggedin"; break; } if ($ML = 'who') { $Routed = "loginFAILED -- possible miss 1 lo"; $routeme = "routeback"; break; } break; } } } //this will run the function, you will need to use your variables as the arguments echo MemberRouter ($routeme, $hailPostData); Take note that another file named CKmembers.php is being included within the function, most likely is the member sessions script
  19. https://www.dropbox.com
  20. There is knowledge here at phpfreaks, this is a coding help site, not a find me this script. BTW, your example link to that site has had their account suspended. Most the people that I've seen here would never assist in helping to scam people, and that's what that script did.
  21. Is a freelance section here. http://forums.phpfreaks.com/forum/20-php-freelancing/
  22. Why even use gd for this? Just size the original image or if you wanted it smaller, resize your image first. If you want to show something like a preview image then the site, you can time header or meta redirects. header( "Refresh:10; url=http://site.com/welcome", true, 303); or <meta http-equiv="refresh" content="10;url=http://site.com/welcome">
  23. floor() easier, just another way <?php $my_string = "(215.354100, 218.613800, 2501.263000)"; $my_array = array( "215.354100", "218.613800", "2501.263000" ); function format_numbers($input = '') { if ($input == '') { return $input; } if (!is_array($input)) { $input = explode(",", $input); } $first_numbers = array(); foreach ($input as $numbers) { $numbers = trim($numbers); $numbers = str_replace(array( "(", ")" ), '', $numbers); $end_numbers = end(explode(".", $numbers)); $first_numbers[] = str_replace(".$end_numbers", '', $numbers); } $formatted = "(" . implode($first_numbers, ",") . ")"; return $formatted; } echo format_numbers($my_string) . "<br />"; echo format_numbers($my_array) . "<br />"; echo format_numbers() . "<br />"; ?>
  24. Can use geolocation tools that are free from a few places. http://www.geoplugin.com/ http://www.maxmind.com/en/geolocation_landing So add the same script you create to the header of all your sites. Depending on their location do a redirect to the proper top level domain. Keep .com as default, if detects their ip is in a country code that you happen to own..send them there.
  25. Your search is pretty good. I think you need to make single product pages and link the titles/simple descriptions to the single product page. More detailed product information, possibly ratings,comments and so on. The most important thing to all this is when a search engine hits your sites categories or pages, it can then follow or index those single product pages. if you do make the single pages, you can then find or make a script to generate a complete sitemap of your site such as sitemap.xml, the search engines will find it.
×
×
  • 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.