Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. When you include that redirect, it does just that ...redirects. It doesn't render anything after the redirect. So whatever you need you should place it inside http://www.domain.com/winner.html
  2. Top jobs to work at near you: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 20)' at line 1
  3. Here's how to get the position before too. <?php function getSecondLastPath($url) { $path = parse_url($url, PHP_URL_PATH); $trim_path = trim($path, '/'); $positions = explode('/', $trim_path); if (substr($path, -1) !== '/') { array_pop($positions); } return end($positions); } $insert_url = "http://natty.com/p/bh-fitness-class-indoor-magnetic-exercise-bike-2-years-parts-/detail/b004r2wuak/fitness-spinning.html"; echo getSecondLastPath($_SERVER['REQUEST_URI']);//get current page echo '<br />'; echo getSecondLastPath($insert_url); echo '<br />'; ?> Demo: http://get.blogdns.com/dynaindex/find-second-last-path.php
  4. Hey nat. <?php function getLastPath($url) { $trim_path = trim($url, '/'); $parts = explode('/', $trim_path); $last = end($parts); return $last; } $insert_url = "http://natty.com/p/bh-fitness-class-indoor-magnetic-exercise-bike-2-years-parts-/detail/b004r2wuak/fitness-spinning.html"; echo getLastPath($_SERVER['REQUEST_URI']);//get current page echo '<br />'; echo getLastPath($insert_url);//get inserted url ?> Demo: http://get.blogdns.com/dynaindex/find-last-path.php
  5. Try this and see if see the character <?php //read a file $my_file = "iplist.txt"; if (file_exists($my_file)) { $data = file($my_file); $total = count($data); echo "<br />Total lines: $total<br />"; foreach ($data as $line) { $line = trim($line); echo "$line<br />"; } //add a new line to end $write = fopen($my_file, 'a+'); $message = "127.0.0.1\r\n"; fputs($write, $message); fclose($write); /*note the w, this will overwrite the entire contents $write = fopen($my_file, 'w'); $message = "I just added this line\r\n"; fputs($write, $message); fclose($write); */ } else { echo "No file to display"; } ?> Here's a demo of the code, as can see is no strange characters. http://get.blogdns.com/dynaindex/read-write-file.php
  6. Here's code to show and write last line to a text file, the commented one is to replace the entire files contents. <?php //read a file $my_file = "file.txt"; if (file_exists($my_file)) { $data = file($my_file); $total = count($data); echo "<br />Total lines: $total<br />"; foreach ($data as $line) { echo "$line<br />"; } //add a new line to end $write = fopen($my_file, 'a+'); $message = "I just added this line\r\n"; fputs($write, $message); fclose($write); /*note the w, this will overwrite the entire contents $write = fopen($my_file, 'w'); $message = "I just added this line\r\n"; fputs($write, $message); fclose($write); */ } else { echo "No file to display"; } ?>
  7. You can use the built in GD library in php http://php.net/manual/en/book.image.php For some handy examples this site is useful. http://www.roseindia.net/tutorial/php/phpgd/
  8. It's not bad to break in and out of php/html. Sometimes it's just easier. Many big cms do it that way. I personally like to keep everything related in one clump of the code, that would be any functions,rules and rendering output. Just in case I want to completely remove it one day, I hate to search for stuff. I feel is more of a preference really. And i also agree not to use the short tags <?, use <?php
  9. 3 months huh, I been doing my project in total over 3 years with insane hours, lol. Anyway, you should post the link to your site so people know where to look.
  10. Besides inserting data directly to mysql.....you should sanitize that. Can you echo out each value and make sure they actually have values. I personally make them all into variable and then place those into the mysql inserts. example $name = $_FILES['pic']['name'];
  11. or even this could work echo "<img src='logo.gif' alt='Angry face' width='32' height='32' />";
  12. If you added a new id of 100 the next auto increment would be 101. If you don't want those 9 you should delete them. If you want to set the auto increment values to a certain number do this: ALTER TABLE tbl_name AUTO_INCREMENT = xxx; tbl_name is your table name and xxx would be the new auto increment amount I personally see no reason to skip 100, if they are not to be used get rid of them, or set another field with publish/unpublish or similar.
  13. You can try dmoz http://www.dmoz.org/Science/ They have all the sub-categories but they don't aggregate feeds or have posts links, although there are science niche sites that exist on the net. or you can try my http://dynaindex.com/ here is science with astrology as an example http://dynaindex.com/index.php?display=post_date&filter=off&order=DESC&view=publish&search=least_one_word&search_words=%2Bscience+%2Bastrology&page=1 science with physics http://dynaindex.com/index.php?display=post_date&filter=off&order=DESC&view=publish&search=least_one_word&search_words=%2Bscience+%2Bphysics&page=1 The way you use the search are the results you will get. Needs a login but registration is free When having to manually tag something you have to know what to tag it, the way digg works is people just click a button and the link goes to digg, digg does the best they can to get it in the right category going by what the link contains. For them to think up of every single possible tag for everything is insane to do, so that's why nobody does it, they try to keep it to the main or popular ones. Me on the other hand decided to do away with tagging completely and let a very advanced search organize and do the work for me automatic so you can find what you need and how you want it. In the future I'll enable my feed aggregator again, that would mean if you typed in +science +math and was set to show latest links, you will then see exactly as you described. The latest links from sites for science with math. My site has the ability to harvest links from pages, create feeds from pages and also a live feedreader. I am a search engine with my own custom scraper/crawler, but I concentrate more on sites that contain the content more than individual links.
  14. I had some free time. <?php $string = "a, b, rt, tril, drv, b, span, drv, art, arc, d, a, drc"; $string_array = explode(", ",$string); asort($string_array); $string_array = array_unique($string_array); foreach ($string_array as $string_single){ $string_single = trim($string_single); echo "$string_single<br />"; } ?> Results would be: a arc art b d drc drv rt span tril
  15. Wrap everything in double quotes, any other quotes needed inside the double quotes should be single quotes. Plus you forgot a quote anyway after blue. echo "<div style='width:200px;height:100px;border:2px outset blue'>$users</div>";
  16. Just for reference here's to do it the other way too. $timestamp = strtotime($date);
  17. here's an example <?php $timestamp ="1128831859"; $datetime = date("Y-m-d H:i:s", $timestamp); echo $datetime; ?> I guess can make it a function too <?php function convertDateTime($timestamp){ $datetime = date("Y-m-d H:i:s", $timestamp); return $datetime; } ?>
  18. use the variable $timestamp for your current timestamp values $datetime = date("Y-m-d H:i:s", $timestamp);
  19. gotta wrap that sucker....lol <?php $search = $_GET['search']; if (!isset($search)) { echo "Please enter a keyword!"; } else { if (strlen($search)<=2){ echo "search term to short"; } else { echo "you searched for $search <hr size='1'>"; } $db_host = "localhost"; $db_username = "seanhall_search"; $db_pass = "*****"; //i edited the password $db_name = "seanhall_search"; @mysql_connect("$db_host","$db_username"."$db_pass"); // i added a semicolon here $search_exploded = explode(" ",$search); foreach($search_exploded as $search_each) { $x++; if ($x==1) { $construct .= "keywords LIKE '%$search_each%'"; } else { $construct .= " OR keywords LIKE '%$search_each%'"; } $construct = "SELECT * FROM searchengine WHERE $construct"; echo $construct; $run = mysql_query($construct); $found = mysql_num_rows($run); if ($found==0) { echo "No results Found."; } else { echo "$foundnum results found!<p>"; while ($runrows = mysql_fetch_assoc($run)) { $title = $runrows['title']; $desc = $runrows['description']; $url = $runrows['url']; echo " <b>$title</b><br> $desc<br> <a herf='$url'>$url</a><br> "; } } } } ?>
  20. you can post your entire code but I feel it's the line before @mysql_connect("$db_host","$db_username"."$db_pass") no semicolon at the end
  21. forget the semicolon here? @mysql_connect("$db_host","$db_username"."$db_pass");
  22. or ucwords to capitalize each first letter of every word in a string http://www.php.net/manual/en/function.ucwords.php
  23. http://php.net/manual/en/function.ucfirst.php
  24. That's because you aren't connecting to your database whatsoever.
×
×
  • 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.