Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. Well I use php, but I do it a bit different than normal search engines and made it an index. What I think you want to do is break it up maybe, just use python for the crawler in the background to fetch links, store it however you like, and for the display can use anything you want. Even change it later if didn't like it. I messed around a lot with this, the biggest things to worry about is being able to connect to the sites more and not being refused, able to recover their links along with titles. And your database not puking. I've found that using curl can help a lot for resolving the url's and secure connections. Once have the url can do whatever want with it, I would probably suggest just using dom xml. You'll get 99% of the links, is probably multi-trillions of links out there, not like you need to get every single one of them or anything.
  2. Would this help you at all. instead of squishing the pic try this $ratioh = $max_height/$height; $ratiow = $max_width/$width; $ratio = min($ratioh, $ratiow); $width = intval($ratio*$width); $height = intval($ratio*$height); as for hyperlinking or displaying an image this way is easy echo "<a href='$href_location'><img src='$img_src' WIDTH='$width' HEIGHT='$height' border='0'></a><br/>";
  3. ha, something as easy as that. cool
  4. I think the problem lies in SELECT DISTINCT, as it will only display a distinct result but based on just different values, so don't think will work like you had hoped to. Essentially what you were doing is grabbing any videos and showing the users name, so it will associate the users name because the name and the video information were all truly unique when together.
  5. Any time you have to sort/order and pull from specific fields, but only this or that but exclude this....it will consume more memory and cpu, time out even. It sometimes has to run through all those results a few times just to get the desired results. Indexing it properly should help it a lot, but still don't expect blazing fast results. Is almost a skill to get indexing set up properly. By using EXPLAIN SELECT you can see which index it would use or any possible keys it could use for it. Here's an older article, but explains the process very nicely on how to see and what to index and the orders http://www.databasejournal.com/features/mysql/article.php/1382791/Optimizing-MySQL-Queries-and-Indexes.htm
  6. Ahh yeah, most likely is the limit on your max total connections for your server congiguration If on a windows box is also an eventid patch to allow more connections or launch the registry editor by Start, Run and type regedit in the left pane navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters create the entry TcpNumConnections by right clicking in the right pane and choose new from the menu and select DWORD Value give it the name TcpNumConnections right click it and select modify and enter a value of 200 restart server you should probably increase any low apache or mysql limits that could prevent you from doing more as well, such as timeout,max connections, memory
  7. Ha, thats funny response. Yup just one big page that shows a little portion of the page using defined dividers.
  8. Look into making indexes for mysql on those fields to get faster results. http://dev.mysql.com/doc/refman/5.0/en/create-index.html
  9. You may also find this "make your own python search engine" source code and example interesting. http://www.zackgrossbart.com/hackito/search-engine-python/
  10. I believe they use python as their base code along with ajax, most likely to resolve urls better. As curl can not follow all javascript or ajax links. To follow all the links in ajax you need to render the page somehow just as a browser does. But I think they also use php,msql or sqlite as their db's Can look into maybe doing it with python and cassandra as the database http://cassandra.apache.org/ That's what digg, facebook and a few others use. Here's a faitly decent php open source search engine for you to try. http://www.sphider.eu/
  11. Well it couldn't connect to them. Maybe your ip is blocked, they are blocking get requests, maybe checking if is no user agent set, site is dead. Could be any numerous reasons why it's not.
  12. $list = ''; $query = $link->query("SELECT * FROM ".TBL_PREFIX."forums ORDER BY f_lid ASC"); $result = $query->fetchAll(); foreach($result as $key => $val) { if($result[$key]['f_pid'] == 0) { $list .= '<b>'.$result[$key]['f_name'].'</b><br />'; } else { $list .= $result[$key]['f_name'].'<br />'; } } echo $list;
  13. Just tried it with 3 different numbers and works. http://get.blogdns.com/test-code.php
  14. <?php $string = "1900800008"; $string_length = strlen($string); if ($string_length >= 10) { echo $string; } else { echo "String isn't long enough"; } ?>
  15. I'm guessing can't unique the array first then look for matches? $posttags = array_unique($posttags);
  16. To see the duplicates in the array, must look over the entire new array, so I just do something like this and loop it again. I know of no easier way. foreach ($posttags as $tag) { $test = $tag->name; $pattern = "/something/"; if(preg_match($pattern, $test)) { $test2[] = $test; } } $new_array = array_unique($test2); foreach ($new_array as $final_tags){ echo $final_tags; }
  17. I'm all for people learning php, but in your case and just for family, I would think a pre-made cms something like wordpress would be prudent. http://wordpress.org/ Always free and a wealth of plugins to do almost anything you want with it.
  18. But there is already functions PDO::quote() http://docs.php.net/manual/en/pdo.quote.php Returns a quoted string that is theoretically safe to pass into an SQL statement. Returns FALSE if the driver does not support quoting in this way. Bit the preferred method is this but takes more work. http://docs.php.net/manual/en/pdo.prepare.php I often wondered why they don't make databases default to not accept bad characters, if anything make an "accept this bad character function" ha ha
  19. Try netbeans, works pretty good, very advanced and also does other coding languages http://netbeans.org/index.html
  20. can just build your own sanitize if want I removed a few characters you may want, I don't even remember what they were, but you get the idea function anti_injection($sql) { $sql = preg_replace(sql_regcase("/(127.0.0.1|drop table|show tables|\'|'\| |;|\|'|<|>|\*|--|\\\\)/"), "" ,$sql); $sql = trim($sql); $sql = strip_tags($sql); $sql = (get_magic_quotes_gpc()) ? $sql : addslashes($sql); return $sql; }
  21. <?php function removeQuery($insert_link){ $query_parse_url = parse_url($insert_link, PHP_URL_QUERY); $new_link = str_replace("?$query_parse_url",'',$insert_link); return $new_link; } ?> <?php //usage $url = removeQuery("http://www.youtube.com/v/cr19U8TVJtw?fs=1&hl=en_US&rel=0"); echo $url; ?>
  22. I made a function to do that, or can use anything would want from in it if looks at the values and remove/include the parts like you want them see the post here, also look at the one below it http://www.phpfreaks.com/forums/php-coding-help/getting-the-path/msg1506898/#msg1506898 php has a built in parse_url function http://www.php.net/manual/en/function.parse-url.php
  23. Yeah I tried out the above tutorial, one of the few that actually works, but needs quite a few changes. I made a function to add a timestamp to a file name whether it be in a folder or the single file. <?php function addTimestamp($filename) { $character = "/"; $target_check = strrchr($filename,$character); if ($target_check[$character]) { $temp_filename1 = end(explode($target_check[$character],$filename)); $target = true; } else { $temp_filename1 = $filename; } $temp_filename = strtolower(trim($temp_filename1)); $timestamp = date('Y-m-d-H-i-s');//this one more readable //$timestamp = time();//or uncheck this and use time if ($target) { $new_filename = str_replace($temp_filename1, "$timestamp-$temp_filename", $filename); } else { $new_filename = "$timestamp-$temp_filename"; } return $new_filename; } ?> <?php //some example files $file1 = "images/SomeCoolPic.png"; $file2 = "http://mysite.com/path/my-cat.jpg"; $file3 = "pictures-of-flowers.jpg"; $file4 = "thumbnails.png"; $file5 = "PEOPLE.png"; //this will just add the timestamp wherever you call for it $file1 = addTimestamp($file1); $file2 = addTimestamp($file2); $file3 = addTimestamp($file3); $file4 = addTimestamp($file4); $file5 = addTimestamp($file5); //gonna echo to see the new file names echo $file1,"<br />"; echo $file2,"<br />"; echo $file3,"<br />"; echo $file4,"<br />"; echo $file5,"<br />"; ?> The results look similar to this images/2011-01-28-02-14-22-somecoolpic.png http://mysite.com/path/2011-01-28-02-14-22-my-cat.jpg 2011-01-28-02-14-22-pictures-of-flowers.jpg 2011-01-28-02-14-22-thumbnails.png 2011-01-28-02-14-22-people.png
  24. Can always break it down and make it easier on yourself <?php $test_link = "http://www.youtube.com/watch?v=LkjE6FMoBwQ&feature=youtube_gdata"; $new_link = str_replace("&feature=youtube_gdata",'',$test_link); echo "<a href='$new_link'>$new_link</a>"; ?>
  25. Gonna break this down for you. make a form form hits an upload script the file type is checked,max size, name sanitized, and unique timestamp also added to the name of the file. You can make a folder lets say images that will be the path to the image you append the image path to the filename, path/filename save these results into a field in a database you place your uploaded file into that folder You could also add additional information to the database for each mage, like who uploaded it, the current date, what type it is, it's size,etc... If all went well you now have a database that can call to that knows where the exact location is for image. Call to mysql with select statements in whatever way you wish to display them
×
×
  • 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.