Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. Here's some code for parse_url http://www.phpfreaks.com/forums/php-coding-help/getting-the-path/msg1506898/#msg1506898
  2. Are supposed to use either GET or POST, not both, try to change it to all of one type and see if it works.
  3. Even in firefox i just had the 404 error from hostgator.
  4. I think firstly I would make a rule not to allow any // or /// in a url.(but not the ://) Then go right into the database and change all the // and /// to a simple / Then for your checks I guess can right up a script that can cycle and look for each url. I'd probably start from asc id number, get the url value, and do a mysql select query to get any similar results, if is more than one then do a hold or delete on all except the current id.
  5. Is very hard to see black text on a dark blue background.
  6. ALTER TABLE table_name AUTO_INCREMENT = 7;
  7. Use it like this $q=mysql_real_escape_string($_GET['q']);
  8. Can do a check if url not equal to substr x amount.... http://, ftp://,https://,feed:// then add the http:// to front if not. With or without the www. won't matter as curl will resolve those to where need to be, even though some sites don't work with or without , but hey what gonna do. After curl resolves it, use parse php function and just lowercase the domain name part. I also lowercase the protocols area, who knows why people like to mess with capitalizing this stuff. Some sites require an end slash while others can not. I found it's best not to add the end slash, people that usually have the slashes...their links can resolve to with or without the end slash. So after al my babble here's the code I use to fix links for inclusion to my site. For me I make everything a http instead of https or ftp, because as I post them I chop off the protocols anyway, and when someone clicks the url in browser...they go to where need to be anyway. So maybe you can use some of my code, can add the pot number back in to the complete url as well, i eliminate any ports as can see in my code. I just didn't want those. $trimurl = trim($_GET['domainname']); $trimurl = substr($trimurl, 0,300); if ($_GET['domainname'] == "" OR $_GET['domainname'] == "http://"){ echo "<h1>Please Insert a Url</h1><br />"; } else { $input_parse_url=mysql_real_escape_string($trimurl); /*check for valid urls*/ if ((substr($input_parse_url, 0, == "https://") OR (substr($input_parse_url, 0, 12) == "https://www.") OR (substr($input_parse_url, 0, 7) == "http://") OR (substr($input_parse_url, 0, 11) == "http://www.") OR (substr($input_parse_url, 0, 4) == "www.") OR (substr($input_parse_url, 0, 6) == "ftp://") OR (substr($input_parse_url, 0, 11) == "feed://www.") OR (substr($input_parse_url, 0, 7) == "feed://")) { $new_parse_url = $input_parse_url; } else { /*replace uppercase or unsupported to normal*/ $url_input .= str_replace(array('feed://www.','feed://','HTTP://','HTTP://www.','HTTP://WWW.','http://WWW.','HTTPS://','HTTPS://www.','HTTPS://WWW.','https://WWW.'), '', $input_parse_url); $new_parse_url = "http://$url_input"; } echo "$input_parse_url<br />"; /*parse the complete url to lowercase just the site domain area*/ function getparsedHost($new_parse_url) { $parsedUrl = parse_url(trim($new_parse_url)); return trim($parsedUrl[host] ? $parsedUrl[host] : array_shift(explode('/', $parsedUrl[path], 2))); } $get_parse_url = parse_url($new_parse_url, PHP_URL_HOST); $host_parse_url .= str_replace(array('Www.','WWW.'), '', $get_parse_url); $host_parse_url = strtolower($host_parse_url); $port_parse_url = parse_url($new_parse_url, PHP_URL_PORT); $user_parse_url = parse_url($new_parse_url, PHP_URL_USER); $pass_parse_url = parse_url($new_parse_url, PHP_URL_PASS); $get_path_parse_url = parse_url($new_parse_url, PHP_URL_PATH); $path_parse_url .= str_replace(array('Www.','WWW.'), '', $get_path_parse_url); $query_add_parse_url = parse_url($new_parse_url, PHP_URL_QUERY); $query_add_parse_url = "?$query_add_parse_url"; $query_add_parse_url = rtrim($query_add_parse_url, '#'); $fragment_parse_url = parse_url($new_parse_url, PHP_URL_FRAGMENT); $fragment_parse_url = "#$fragment_parse_url"; $hostpath_url = "$host_parse_url$path_parse_url"; $hostpath_url = rtrim($hostpath_url, '?'); $query_add_parse_url = rtrim($query_add_parse_url, '?'); $hostpathquery_url = "$host_parse_url$path_parse_url$query_add_parse_url"; $complete_url = "$host_parse_url$user_parse_url$pass_parse_url$path_parse_url$query_add_parse_url$fragment_parse_url"; $complete_url = rtrim($complete_url, '#');
  9. you can paste the above where gonna use it in your code, or can create a new php file and include just this. <?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 = time();//or uncheck and use time $timestamp = date('Y-m-d-H-i-s');//this one more readable if ($target) { $new_filename = str_replace($temp_filename1, "$timestamp-$temp_filename", $filename); } else { $new_filename = "$timestamp-$temp_filename"; } return $new_filename; } ?> then for usage just use something like this $some_file = addTimestamp($some_file);
  10. If this helps I made an add a timestamp function Here's the demo and code for it. http://get.blogdns.com/add-timestamp.php
  11. It's not so much your host or panel but your package, if you had a dedicated server you could then load the needed language packs and do any language conversions you needed. Because you would have control of the operating system and any aspect of that. That would also mean using a variety of any panels/admin programs.
  12. I wanted to say I tried this many times and every time it seemed to work just fine.
  13. This is the best reference I can give you. http://dev.mysql.com/doc/refman/5.5/en/optimization-indexes.html Indexing the tables makes searches much faster. EXPLAIN http://dev.mysql.com/doc/refman/5.5/en/explain.html I feel MATCH AGAINST or even full text indexing also in booleon mode is much faster than LIKE when comes to searches.
  14. block unwanted characters http://php.net/manual/en/function.mysql-real-escape-string.php fix quotes and such http://php.net/manual/en/function.htmlentities.php You just can't let anyone input what they want. btw, i did a test post and it didn't show my name or the text, got the insert and then select values correct and the same on both display.php and process.php?
  15. Good, now you may want to filter,escape,sanitize any of the user input before it gets to the database.
  16. Yes, your insert isn't inserting anything. mysql_query("INSERT INTO `mynews` VALUES ('$user', '$title', '$message', '$type', '$url')"); should be something like, of course use your values in the database whatever they are mysql_query("INSERT INTO mynews (user, title, message, type, url) VALUES ('$user', '$title', '$message', '$type', '$url')"); Well that's to be specific, but inserting the other way should still insert them, I did see you originally had it the specific way to start off.
  17. As for your pagination, you can use either one of these and modify it to your needs. The first can do any posts amount, the second I hard coded set to 10 posts per page, which I didn't need more. It takes more math to predetermine all the +jump-to pages Can see them both working and the codes embed below them. http://get.blogdns.com/paginate and this is more deluxe http://get.blogdns.com/dynaindex/paginate.php Basically it controls the limit in a mysql query determined by what current page you are on. Since it gets the script and also queries in the url you should be able to use a GET['comment'] in the code you are doing and it would pass the value to the next set of comments
  18. http://code.google.com/p/inverted-index/
  19. Well it's clean and readable, everything seems to work just fine. But I think it's missing the wow factor. Seems like a simple old 80's html template. Choice of colors, plain square images, maybe can make it a bit more flashy, people like that stuff. I could see maybe dynamic content loading in a content area versus just scrolling down the page separated by dividing lines. If in are the business of making apps, I would think you can show them your ability somehow on the front page. That's just my opinion.
  20. I made 2 types of pagination. The first can do any posts amount, the second I hardcoded set to 10 posts per page, takes more math to predetermine the pages which I didn't need can see them both working and the codes embed below them. http://get.blogdns.com/paginate and this http://get.blogdns.com/dynaindex/paginate.php Basically it controls the limit in a mysql query determined by what current page you are on
  21. Here's the examples page http://simplehtmldom.sourceforge.net/
  22. You download this as BlueSkyIS mentioned, you can even read the tutorials and examples. http://sourceforge.net/projects/simplehtmldom/files/ Upload the new simplehtmldom folder to your website. Every time you use simplehtml dom code you must include the file simple_html_dom.php once before you call any dom code. You can place simple_html_dom.php in the same folder as your script is, or can refer to it from the new simplehtmldom folder, that is up to you.
  23. This is the only file need to include from the simplehtml dom folder you download include('simple_html_dom.php');//modify if in different location than your php script
  24. Some information on inverted indexes http://rosettacode.org/wiki/Inverted_Index Should look into sphinx as well http://sphinxsearch.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.