Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. http://php.net/manual/en/function.wordwrap.php
  2. <?php function simplequery($table, $field, $needle, $haystack) { $result = mysql_query("SELECT $field FROM $table WHERE $haystack = $needle LIMIT 1;");//WHAT DOES LIMIT 1 DO? //returns one result if ($result){ if (mysql_num_rows($result)) {//IF RESULT HAS ROWS IN IT //if returns an actual result set $row = mysql_fetch_assoc($result);// MAKE RESULT INTO AN ARRAY //returns an associative array of the fetched row return $row[$field];//SHOULDN'T THIS BE $ROW[$HAYSTACK];? //no... $haystack is a column name for this function } } else { print "Error in query<br />"; } } ?> Basically the function is made to select one field and is why they used $row[$field], look at what the SELECT is. SELECT $field FROM Edit: blah blah, same as Thorpe wrote.
  3. Are most likely using some sort of exec() on their server of a program to encode the sounds and save the file, some type of database to save the user,file location with descriptions.
  4. if you only want one limit the results <?php $query = "SELECT * FROM privateleague WHERE userid = '{$_SESSION['userid']}' LIMIT 0,1"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { echo $row['privateleaguename']; echo "<br \>"; echo $row['privateleaguepasscode']; } ?> if need to use a specific order for latest result... see here http://dev.mysql.com/doc/refman/5.6/en/order-by-optimization.html
  5. this may also help you using filetype:rss or filetype:xml in google search http://lmgtfy.com/?q=filetype%3Arss+photography http://lmgtfy.com/?q=filetype%3Axml+photography
  6. It's not a simple script and took me 3 years of doing this. As can see I have a website/search engine. I crawl by domain names or lists of links using curl. I also grab the feeds by using patterns for the urls and types. This data is all saved. By using a full text booleon mode search it finds the related content..then if contains a feed will be a result. Google does have a feed api http://code.google.com/apis/feed/ here's the load feed http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://feeds.feedburner.com/phpfreaks and here's a feed discovery http://ajax.googleapis.com/ajax/services/feed/lookup?v=1.0&q=http://phpfreaks.com it seems they only grab the first..or main feed though you can look into simplepie http://simplepie.org/ this will display the main feed like a reader by inserting a url
  7. Realize not every site is here yet, but many are added daily, so this list will grow. http://dynaindex.com/feed-urls.php using more than one word with spaces is an either/or + includes +word +word is must contain both - excludes
  8. Correct me if I'm wrong. A dork scanner is a tool to find vulnerabilities of a server for hacking purposes. Nobody here would help with one of those. maybe you meant to write crawler/scraper more like a feed discovery. It's kind of hard and here's why. websites don't always name their sites relevent to content, they have multiple feeds, they don't usually name the feeds by the content, is multiple feed types. My best solution was to search my indexed websites by url,title,description,keywords,feed for a word, if that website contains a feed or the feed contains the word it gets in the desired list. Well my site does feed discovery, I do have a searchable feed aggregator/feedreader, if I have some time today I'll write something up to spit out large lists of feeds related to what you are looking for. You could always search the feeds to see if has content related to what you want after. The hardest part is finding feed urls.
  9. I guess no comments means it's good? I would probably rename movie to video, it could be a clip or tv as well. Works pretty good Paul, I spread the link around.
  10. This also works, if use double quotes to wrap, use all single quotes within. or escape the double quotes \" echo "<a href='AddNewServer.php'>Click here</a>";
  11. I'm assuming you are using JOIN and multiple WHERE,AND,OR or possible LIKE, MATCH mysql select statements. To speed the queries up you can create indexes on any WHERE,AND,OR values http://dev.mysql.com/doc/refman/5.6/en/create-index.html You can view the slow query log to find your bottlenecks http://dev.mysql.com/doc/refman/5.6/en/slow-query-log.html It does matter the order in which you place these, try EXPLAIN, SHOW STATUS, and SHOW PROCESSLIST http://dev.mysql.com/doc/refman/5.6/en/explain.html http://dev.mysql.com/doc/refman/5.6/en/show-status.html http://dev.mysql.com/doc/refman/5.6/en/show-processlist.html Look into memcache to lessen the queries by caching. http://memcached.org/ or http://php.net/manual/en/book.memcache.php If none of the above helps you (which they should), or to get quicker responses to queries, minimize results and only fetch data you need to. To show the solutions can help: http://dynaindex.com/search.php?s=%2Blisten+%2Bfree++%2Bmusic&filter=on&page=1 That's a multiple search sifting through a million plus posts for the correct content in multiple columns, pages will get cached and also is on one of my home computers (single core cpu and run it hard) on a residential line. The thumbs are live loading.
  12. No problem. I have a use for it myself. Still thinking of good ways to exclude it from doing if already a hyperlink or a hyperlink image. Any improvements I do I'll post it.
  13. <?php $variable = "Test string with (brackets)"; $str = preg_replace('~\(.*?\)~', '', $variable); echo $str; ?>
  14. It's called pagination, is a tutorial here. http://www.phpfreaks.com/tutorial/basic-pagination
  15. Post coding problems here. general questions should go here. http://www.phpfreaks.com/forums/index.php?board=14.0
  16. Yes line by line from top to bottom. header redirection before any output to browser, and will also go somewhere, code below will not execute.
  17. I thought I would make this a bit more deluxe. I added the ability to check if alive or dead and also add the titles. It can't handle if someone just writes aol.com with no www. or http://, but to check for all top level and second level domains is crazy..plus also is common words like com,in,no,net and so on. https secure sites will read as original. I handled already made hyperlinks best I could think of at the time, might be some better ways. It's something to use as is or improve upon. <?php function titleHyper($text){ $text = preg_replace( "/(www\.)/is", "http://", $text); $text = str_replace(array("http://http://","http://https://"), "http://", $text); $text = str_replace(array("<a href='", "<a href=\"", "</a>", "'>", "\">"), "", $text); $reg_exUrl = "/(http|https|ftp|ftps|)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; preg_match_all($reg_exUrl, $text, $matches); $usedPatterns = array(); $context = stream_context_create(array( 'http' => array( 'timeout' => 5 ) )); foreach($matches[0] as $pattern){ if(!array_key_exists($pattern, $usedPatterns)){ $usedPatterns[$pattern]=true; $the_contents = @file_get_contents($pattern, 0, $context); if(substr(trim($pattern), 0, != "https://"){ $color = "#FF0000"; } if (empty($the_contents)) { $title = $pattern; } else { preg_match("/<title>(.*)<\/title>/Umis", $the_contents, $title); $title = $title[1]; $color = "#00FF00"; //$title = htmlspecialchars($title, ENT_QUOTES); //saving data to database } $text = str_ireplace($pattern, "<a style='font-size: 14px; background-color: #FFFFFF; color: $color;' href='$pattern' rel='nofollow' TARGET='_blank'> $title </a>", $text); } } return $text; } $text = "Some sample text with WWW.AOL.com<br />http://www.youtube.com/watch?v=YaxKiZfQcX8 <br />Anyone use www.myspace.com? <br />Some people are nuts, look at this stargate link at http://www.youtube.com/watch?v=ZKoUm6z5SzU&feature=grec_index , like aliens exist or something. http://www.youtube.com/watch?v=sfN-7HczmOU&feature=grec_index and here's a secure site https://familyhistory.hhs.gov, unless you use curl or allow secure connections it will never get a title. <br /> This is a not valid site http://zzzzzzz and this is a dead site http://zwzwzwxzw.com.<br /> Lastly lets try an already made hyperlink and see what it does <a href='http://phpfreaks.com'>phpfreaks</a>"; echo titleHyper($text); ?>
  18. I've heard curly braces called curly brackets – flower brackets - squiggly brackets - curvy brackets - curvy braces , and yes even more. The first 3 are commonly used depending what country you live in. But in no way is { or } a quote.
  19. Is that from here? http://www.evolt.org/node/60265 Read the comments and will most likely find the answer.
  20. You can try making small scripts or functions that are useful. From doing them you may realize what you can do with them. A small idea can turn into a large one. If need some ideas I could give you a big list....I have way too many ideas.
  21. You must be using both <br /> and also new line \n or \r return Should look at some functions on that page others have made to eliminate both methods and use just one. http://php.net/manual/en/function.nl2br.php
  22. <?php $text ="Some scentence<br /> <br /> Some more words<br /> and yet some more<br /> and some more"; $text = str_replace("\r\n", "", $text); echo $text; ?>
  23. Can you show the script? I'll run it similar on my xp and see if it works. Is usually permissions issue though.
  24. Some old code there, I modified and got this working, even handles when just www as well. <?php function formatUrlsInText($text){ $text = str_ireplace( "www.", "http://www.", $text ); $reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; preg_match_all($reg_exUrl, $text, $matches); $usedPatterns = array(); foreach($matches[0] as $pattern){ if(!array_key_exists($pattern, $usedPatterns)){ $usedPatterns[$pattern]=true; $text = str_replace($pattern, "<a href='$pattern' rel='nofollow'>$pattern</a> ", $text); } } return $text; } $text = "Some sample text with www.google.com http://google.com and https://google.com"; echo formatUrlsInText($text); ?> Result would be: this: Some sample text with www.google.com http://google.com and https://google.com to this: Some sample text with http://www.google.com http://google.com and https://google.com
×
×
  • 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.