QuickOldCar
Staff Alumni-
Posts
2,972 -
Joined
-
Last visited
-
Days Won
28
Everything posted by QuickOldCar
-
help with back to back loops
QuickOldCar replied to YoungNate_Black_coder's topic in PHP Coding Help
I'm sorry, I didn't fully read the code. $sid = $_REQUEST['sid']; if(isset($_REQUEST['sid']) && $sid != ""){ echo "first code"; } else { echo "second code"; } can also use empty() -
Try this. <?php require_once('auth.php'); ?> <?php //Start session session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>View Users</title> <link href="loginmodule.css" rel="stylesheet" type="text/css" /> <style type="text/css"> body { font: 11px Verdana, Arial, Helvetica, sans-serif; color: #666666; margin: 0px; padding: 20px 10px 0px; } /* general style */ .list{ margin:0; padding:0; width:840px; } .list li{ list-style: none; margin:2px 0; overflow:hidden; border-bottom:1px solid #eee; } .entries span, .heading span{ display:block; width:155px; /* (~width of list) / 5 keep in mind the boxmodel*/ float:left; padding-left:12px; border-right:1px solid #eee; line-height: 30px; height:30px; } .heading span{ background: #CAE8EA; } /* entries */ </style> </head> <body> <h1>View Users</h1> <a href="member-profile.php">Orders</a> | <a href="users.php">Users</a> | <a href="logout.php">Logout</a> <?php //Include database connection details require_once('config.php'); //Connect to mysql server $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); $sql = mysql_query("SELECT * FROM newUsers2 ORDER BY member_id ASC"); $id = 'member_id'; $fname = 'firstname'; $lname = 'lastname'; $login = 'login'; $userType = 'userType'; echo '<ul class="list">' ; echo '<li class="heading">'; echo '<span class="id">ID </span>' ; echo '<span class="firstname">FIRST NAME </span>' ; echo '<span class="lastname">LAST NAME </span>' ; echo '<span class="login">LOGIN </span>' ; echo '<span class="userType">ADMIN RIGHTS</span>'; echo '</li>' ; while ($rows = mysql_fetch_assoc($sql)){ if($rows[$userType] == 1) { $userTypeValue = "YES"; } else { $userTypeValue = "NO"; } echo '<li class="entries">' ; echo '<span class="id">' .$rows[$id]. '</span>' ; echo '<span class="firstname">' .$rows[$fname]. '</span>' ; echo '<span class="lastname">' .$rows[$lname]. '</span>' ; echo '<span class= "login">' .$rows[$login]. '</span>'; echo '<span class="userType">' .$userTypeValue. '</span>' ; echo '</li>' ; } echo '</ul>' ; ?> </body> </html>
-
help with back to back loops
QuickOldCar replied to YoungNate_Black_coder's topic in PHP Coding Help
You need to use AJAX or jQuery to get the results fetched dynamic upon input without page reload. http://www.w3schools.com/ajax/ajax_intro.asp http://rickyrosario.com/blog/sorting-dropdown-select-options-using-jquery/ -
I have a problem with you looking for advice but making people work for the link. It's almost like you are trying to brag...or spam without posting a link. You may not be first in other countries. Either way......I didn't care for the layout of the site at all.
-
Like books? Like t-shirts? Like Jack Russells?
QuickOldCar replied to philcal's topic in Website Critique
Something for sure wrong with www.booksoutofprint.com.au. I could see "/> at the top of your page, check that to see why not closing. There needs to be borders and boundaries for most of the page. Maroon, Brown and Blue clashes hard to me, not very appealing at all. -
Google has a history of closing projects down. When google couldn't buy friendster they made Orkut in 2004, so they already have had a social network.
-
Lets just say you do make a query with finding ip's starting with 192.168 (first 2 positions), don't you think you'll not be allowing too many people in that entire ip range? Even then sadly if they have a dynamic ip they can always come back, or change their static through their isp. If this person is that much a pain, just block them via htaccess and that range for a while, until he forgets about you. as an example Deny 69.60.114.0 - 69.60.114.255
-
I assumed is a NULL value in database, do you have something other if no image uploaded? You can try empty($profileimage) Double check the values, I'm pretty sure this should work or be a minor change. Try this <?php ob_start(); session_start(); $page = "{$users['username']} Profile"; include "../assets/header.php"; include "../assets/includes/connect.php"; ?> <?php $getusers = mysql_query("select * from users where email_verified=1 order by total_earned desc", $c); while ($users = mysql_fetch_array($getusers)) if ($_GET['do'] == $users['username']) { Print " My Profile Link: <a href=\"http://{$configs['siteurl']}/profile/?do={$users['username']}\">http://{$configs['siteurl']}/profile/?do={$users['username']}</a> </div> "; } ?> <?php $profileimage = $users['profileimage']; $imagelocation = "thumbs/$profileimage"; $userimage = "thumbs/user.jpg"; if(file_exists($imagelocation)) { $userimage = "$imagelocation"; } $getusers = mysql_query("select * from users where email_verified=1", $c); while ($users = mysql_fetch_array($getusers)) if ($_GET['do'] == $users['username']) { Print " <div style='width:200; float:left; position:absolute; margin-top:50px;' id='content'> <div class='avatar-b'> <img src='{$userimage}' width='60' height='60'> </div> <span style='font-size:16px;color:#1B91E0;float:left;'>{$users['username']}</span> <br><p> <span style='font-size:16px;color:#A6306B;float:left;margin-right:20px;'><a href=\"inbox.php?send={$users['username']}\">Message</a></span></p> </div> <div style='width:650px; float:right; margin-top:-6px;' id='content'> <form id='myform' action='javascript:get(document.getElementById('myform'));' name='form1'> <div></div><div> <textarea style='color:#000000 !important; margin-left:4px; width:642px;height:46px;' id='comment' rows='5' cols='5' name='comment'></textarea></div> <div style='color:#FF0099; margin-left:4px; font-size:11px;' id='status'></div> <br> <input type='image' style='float:right; margin-right:20px;' value='Post Comment' onclick='submitComment('aaronarod',comment.value)' src='../assets/images/postcomment.png' name='Submit'> <br> </form> </div> <br><br><br> <div style='width:650px; float:right; margin-top:-6px;' id='content'> <div class='avatar-b'> <img src='$userimage' width='60' height='60'> </div> <span style='font-size:16px;color:#1B91E0;float:left;'>{$users['username']}</span> <br> <p> Coming Soon!! </p> </div> <br><br><br> "; } ?> <?php include "footer.php"; ?>
-
<?php //implement leap year function function isleapyear($year = '') { if (empty($year)) { $year = date('Y'); } $year = (int) $year; if ($year % 4 == 0) { if ($year % 100 == 0) { return ($year % 400 == 0); } else { return true; } } else { return false; } } function date_diff($date, $date2 = 0) { if(!$date2) $date2 = mktime(); $date_diff = array('seconds' => '', 'minutes' => '', 'hours' => '', 'days' => '', 'weeks' => '', 'years' => '', 'tseconds' => '', 'tminutes' => '', 'thours' => '', 'tdays' => '', 'tweeks' => '', 'tyears' => ''); if($date2 > $date) $tmp = $date2 - $date; else $tmp = $date - $date2; $seconds = $tmp; $date_diff['years'] = floor($tmp/31556926); $tmp -= $date_diff['years'] * 31556926; $date_diff['weeks'] = floor($tmp/604800); $tmp -= $date_diff['weeks'] * 604800; $date_diff['days'] = floor($tmp/86400); $tmp -= $date_diff['days'] * 86400; $date_diff['hours'] = floor($tmp/3600); $tmp -= $date_diff['hours'] * 3600; $date_diff['minutes'] = floor($tmp/60); $tmp -= $date_diff['minutes'] * 60; $date_diff['seconds'] = $tmp; $date_diff['tyears'] = floor($seconds/31556926); $date_diff['tweeks'] = floor($seconds/604800); $date_diff['tdays'] = floor($seconds/86400); $date_diff['thours'] = floor($seconds/3600); $date_diff['tminutes'] = floor($seconds/60); $date_diff['tseconds'] = $seconds; return $date_diff; } $time1_value = "now";//change this $time2_value = "next Saturday";//change this $time1 = strtotime($time1_value); $time2 = strtotime($time2_value); $diff = date_diff($time1, $time2); echo "Time between <b>$time1_value</b> and <b>$time2_value</b><br />"; echo "Years: " .$diff['years']. "<br />"; echo "Weeks: " .$diff['weeks']. "<br />"; echo "Days: " .$diff['days']. "<br />"; echo "Hours: " .$diff['hours']. "<br />"; echo "Minutes: " .$diff['minutes']. "<br />"; echo "Seconds: " .$diff['seconds']. "<br />"; ?>
-
I guess can get even safer to make sure the image exists also. $profileimage = $users['profileimage']; $imagelocation = "thumbs/$profileimage"; if(file_exists($imagelocation) && $profileimage != NULL ) { $userimage = "$imagelocation"; } else { $userimage = "thumbs/defaultimage.jpg"; } echo "<img src='$userimage' width='60' height='60'>";
-
Something like this should work. if(is_null($users['profileimage'])) { $profileimage = "defaultimage.jpg"; } else { $profileimage = $users['profileimage']; } echo "<img src='thumbs/$profileimage' width='60' height='60'>";
-
Another reinvented similar language, just what we need. I was more impressed by their webgl demo https://github.com/MLstate/webgldemo
-
I came across this and decide to post it for others to look at. Robert Eisele decided to make some changes on his own. http://www.xarg.org/2011/06/php-hacking/ One day these may end up in future releases of PHP...or not. Either way is an interesting read.
-
Sharing high usage objects between sessions
QuickOldCar replied to Darghon's topic in PHP Coding Help
memcached is most likely your best bet. http://memcached.org/ Even if created arrays of text and saved them as xml, you would have bottlenecks in disk i/o, not to mention the size it would grow to. You could look into query cache. http://dev.mysql.com/doc/refman/5.6/en/query-cache.html Can also do page caching per unique url if the content is the same data, just don't cache user data. http://devgrow.com/simple-cache-class/ http://files.zend.com/help/Zend-Server/zend_page_cache_-_php_api.htm http://php.dzone.com/news/php-caching-pages-with-output- -
Website for Broadcasting Equipment Rental service
QuickOldCar replied to klimito's topic in Website Critique
You can eliminate the button images and do them with css style instead. I really don't see how to optimize this more when you are displaying a few images, the images seem a decent smaller size considering the quality and dimensions of them. So it seems to me less or smaller images equates to faster loading. -
<?php $url = $_POST['url']; $term = $_POST['term']; ?> <form method="post" action=""> URL: <input type="text" value="<?php echo $url;?>" name="url"/></br> Search Term: <input type="text" value="<?php echo $term;?>" name="term"/> <input type="submit" value="Search"/> </form> <?php if(isset($_POST['url']) && !empty($_POST['url']) && isset($_POST['term']) && !empty($_POST['term'])){ $content = file_get_contents($url); if (preg_match("/$term/i", $content)) { echo $term ." exists."; } else { echo $term . " not found."; } } else { echo "Insert value."; } ?>
-
I got it back, in the update was a newer driver for my ethernet that broke it. Uninstalled that, uninstalled ethernet, added a network card, then went and added the ethernet back and loaded the original ethernet driver from the cd. Yeah a lot to take in, but thats what I had to do to get it working, rollback, load other drivers..just didn't work. it was very odd, I could see msn,google and youtube every time, also can see gomoviez.info, amazon,yahoo,but not any microsoft,phpfreaks,fastpasstv.com. just to name a few
-
Been around computers most my life(since was 8 ), I build and repair for a living. Today I got in an i5 kit from tigerdirect.com. http://www.tigerdirect.com/applications/SearchTools/item-details.asp?EdpNo=631829&CatId=4910 with an additional 4 gig memory. I feel this a pretty good bargain, and everything worked, loaded up windows 7 and was browsing the net. I liked it. Now here's my rant.....I decide to do windows update, register it and all that jazz. For some reason I can now only see a select few sites on the internet. Really about 99% of websites are blocked or looks more like just trouble loading, but they never connect. Being http:// or https:// sites doesn't matter. Other comps in my network all load them fine. Here's what I did so far, but I'm about ready to just redo the os, or better yet install ubuntu 64 bit. reloaded original drivers from motherboard cd. uninstall and reinstall ethernet reset any internet settings to default remove updates from when noticed the issue reinstall chrome and firefox5 It does this in all browsers as well, firefox4 and 5, chrome and ie9 Going to go try windows restore and see if I can get it back prior to updates. If anyone has had similar issues, maybe knows which update the culprit is, please post back. OS is windows 7 pro 64bit sp1 Long live XP
-
Create a form for url input. Connect to url with Curl. Get raw html. Match content html with preg_match(). Echo results if content found or not. I take it you do not program with php but got sucked into this somehow?
-
Create a website just for one-line advice.
-
Meta search engine - Aggregation techniques
QuickOldCar replied to BurgerBob's topic in Application Design
I myself use boolean mode with match against in full text using MyISAM. In order to use full text search must use MyISAM and also should create indexes on any where,and,or select statement values. Be aware that on insert the table will be locked even for fetching, this is where caching the results and pages helps greatly. The manual can explain much better than I can. http://dev.mysql.com/doc/refman/5.6/en/fulltext-search.html If saving to a database is no need to aggregate them as you say. The results can be displayed back in any order you desire using common mysql select statements. I use multiple mysql queries with if/elseif depending on which type of advanced search the user selects. starts with characters, contains characters, least one word, exact phrase, one word, exclude word Lets break down what we want here. tokenisation: basically this will be grouping words or phrases of the content Do you need the users input to change as a sort of suggestion? I'll tell you right now this will not be easy. But sure...you can merely break up many results in your database with the before word,the word, and then the after word and display them as suggestions or as groups. My boolean searches look like this. I break down each section as well to just search those too. $post_status is a dynamic where for admin view that I can select either all,publish,pending,or banned to see all results, users just see published. others are self explanatory, LIMIT is used for my pagination along with the count. if ($search == "Date") { $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_date) AGAINST ('\"$search_words\"' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_date) AGAINST ('\"$search_words\"' IN BOOLEAN MODE)"); } elseif ($search == "ID") { $result = mysql_query("SELECT * FROM posts $post_status AND ID LIKE '".$search_words."%' ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND ID LIKE '".$search_words."%'"); } elseif ($search == "url_begins_characters") { $result = mysql_query("SELECT * FROM posts $post_status AND post_title LIKE '".$search_words."%' ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND post_title LIKE '".$search_words."%'"); } elseif ($search == "url_contains_characters") { $result = mysql_query("SELECT * FROM posts $post_status AND post_title LIKE '%"."$search_words"."%' ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND post_title LIKE '%"."$search_words"."%'"); } elseif ($search == "feed_single_word") { $result = mysql_query("SELECT * FROM posts $post_status AND link_rss LIKE '%"."$search_words"."%' ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND link_rss LIKE '%"."$search_words"."%'"); } elseif ($search == "one_word") { $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_title,post_content) AGAINST ('$search_words' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_title,post_content) AGAINST ('$search_words' IN BOOLEAN MODE)"); } elseif ($search == "exact_words") { $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_title,post_content) AGAINST ('\"$search_words\"' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_title,post_content) AGAINST ('\"$search_words\"' IN BOOLEAN MODE)"); } elseif ($search == "least_one_word") { $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_title,post_content) AGAINST ('$search_words' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_title,post_content) AGAINST ('$search_words' IN BOOLEAN MODE)"); } elseif ($search == "exclude_word") { $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_title,post_content) AGAINST ('+$search_words -$search_words' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_title,post_content) AGAINST ('+$search_words -$search_words' IN BOOLEAN MODE)"); } elseif ($search == "title_one_word") { $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (title_2) AGAINST ('$search_words' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (title_2) AGAINST ('$search_words' IN BOOLEAN MODE)"); } elseif ($search == "title_exact_words") { $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (title_2) AGAINST ('\"$search_words\"' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (title_2) AGAINST ('\"$search_words\"' IN BOOLEAN MODE)"); } elseif ($search == "title_least_one_word") { $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (title_2) AGAINST ('$search_words' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (title_2) AGAINST ('$search_words' IN BOOLEAN MODE)"); } elseif ($search == "title_exclude_word") { $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (title_2) AGAINST ('+$search_words -$search_words' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (title_2) AGAINST ('+$search_words -$search_words' IN BOOLEAN MODE)"); } elseif ($search == "description_one_word") { $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_description) AGAINST ('$search_words' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_description) AGAINST ('$search_words' IN BOOLEAN MODE)"); } elseif ($search == "description_exact_words") { $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_description) AGAINST ('\"$search_words\"' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_description) AGAINST ('\"$search_words\"' IN BOOLEAN MODE)"); } elseif ($search == "description_least_one_word") { $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_description) AGAINST ('$search_words' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_description) AGAINST ('$search_words' IN BOOLEAN MODE)"); } elseif ($search == "description_exclude_word") { $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_description) AGAINST ('+$search_words -$search_words' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_description) AGAINST ('+$search_words -$search_words' IN BOOLEAN MODE)"); } elseif ($search == "keyword_one_word") { $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_keywords) AGAINST ('$search_words' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_keywords) AGAINST ('$search_words' IN BOOLEAN MODE)"); } elseif ($search == "keyword_exact_words") { $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_keywords) AGAINST ('\"$search_words\"' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_keywords) AGAINST ('\"$search_words\"' IN BOOLEAN MODE)"); } elseif ($search == "keyword_least_one_word") { $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_keywords) AGAINST ('$search_words' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_keywords) AGAINST ('$search_words' IN BOOLEAN MODE)"); } elseif ($search == "keyword_exclude_word") { $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_keywords) AGAINST ('+$search_words -$search_words' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_keywords) AGAINST ('+$search_words -$search_words' IN BOOLEAN MODE)"); } else { //if anything goes wrong above or nothing selected, this will be used as the default query instead //just show last 10 by id main page if ($url == "http://get.blogdns.com/dynaindex/index.php" OR $url == "http://dynaindex.com/index.php") { $result = @mysql_query("SELECT * FROM posts ORDER BY ID DESC LIMIT 0,10"); //$result = mysql_query("SELECT * FROM posts $post_status ORDER BY ID DESC LIMIT 0,10"); $total_count = $result; } else { //todays results new and updated $result = mysql_query("SELECT * FROM posts $post_status AND post_date LIKE '".$today_date."%' ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND post_date LIKE '".$today_date."%'"); } /* $result = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_date) AGAINST ('\"$today_date\"' IN BOOLEAN MODE) ORDER BY $display $order LIMIT $startrow,$posts_per_page" ); $total_count = mysql_query("SELECT * FROM posts $post_status AND MATCH (post_date) AGAINST ('\"$today_date\"' IN BOOLEAN MODE)"); */ } stopword removal: http://dev.mysql.com/doc/refman/5.6/en/fulltext-stopwords.html there is a default list already, and can edit this stopwords are merely ignored in the searches but can be present in the results you may also want to do filtering: you can have an array or read from a list of any bad words or phrases do not want. with this information you have choices, do not show this result, or edit the stop word with something else, in essence...filtering. Here's how I filter when adding sites and links to my index. I have a post_status in mysql with 3 values, publish,pending and banned Upon adding links I have a bad words or phrases text file, the url,title,description,keywords are checked against it and depending on if is in the list gets set to publish or pending. I also have a banned text file as well, if it's in there will be banned. Of course this takes time and usage from getting many links. I have an alternate method too. Merely not display the result if is in a bad-phrases list, or can even mask the word with another word using str_ireplace on output. AND, OR, NOT and keyword search ability: + stands for AND - stands for NOT [no operator] implies OR > < changes a word's contribution to the relevance value that is assigned to a row ( ) group words into subexpressions ~ lowers the words relevence * adds wildcard (you will not get very nice results with this, but is useful for some searches) Now after all I said above...... You may be better off using cassandra as a database and python for the searching. http://cassandra.apache.org/ Cassandra is in use at Digg, Facebook, Twitter, Reddit, Rackspace, Cloudkick, Cisco, SimpleGeo, Ooyala, OpenX, and more companies that have large, active data sets. The largest production cluster has over 100 TB of data in over 150 machines. https://bitbucket.org/mchaput/whoosh/wiki/Home -
Off the top of my head I came up with this. Not sure if you use uppercase for pages or not. $page = preg_replace('/[^-a-zA-Z0-9_]/', '', $_GET['page']);//allow these characters $allowed_pages = array("news", "about", "contact", "links");//add allowed pages if (in_array($page, $allowed_pages) && isset($_GET['page']) && !empty($_GET['page'])) { include_once($page.".php"); } else { header("HTTP/1.0 404 Not Found"); die('Page not found.'); }
-
Meta search engine - Aggregation techniques
QuickOldCar replied to BurgerBob's topic in Application Design
To be honest..I'm not familiar with any of those methods. I take it you are doing more of a live results, and not saving any data into a database. I would have to say pull the results into an array and show them from that. Once in the array could sort,filter,separate any results and display how you would like. I suppose could generate xml's and display this data to users , so you don't have to keep connecting to the search engines as often. It could almost be easier to create your very own search engine. There are many websites that already do as you plan. -
What I did was make a search type feed, so the feeds are dynamic for specific items. This is done by a mysql query and where statements, I use match against in booleon mode, but like,match,where,and,or statements would also work. I'll give my feed examples then some code to show how I did it. main feed http://dynaindex.com/feed/ a simple feed creation page, but placing values into a url also works the same http://dynaindex.com/dyna-feed.php custom feeds: php+tutorials http://dynaindex.com/feed/?keyword=%2Bphp+%2Btutorial php+coding http://dynaindex.com/feed/?keyword=+php+coding alien+ufo http://dynaindex.com/feed/?keyword=alien+ufo And this is how I generate the feeds, made a folder called feed, this script is index.php you will of course have to change values to your own <?php //i use this for caching of the feeds //include 'feed-cache.php'; //$fch = new cache(); //header type header("Content-Type: application/rss+xml; charset=UTF-8"); //database connect information DEFINE ('DB_USER', 'user'); DEFINE ('DB_PASSWORD', 'password'); DEFINE ('DB_HOST', 'localhost'); DEFINE ('DB_NAME', 'db_name'); $connection = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die('Could not connect to database'); mysql_select_db(DB_NAME) or die ('Could not select database'); //get keywords $keyword=mysql_real_escape_string(strtolower(trim($_GET['keyword']))); //check if a keyword exists, if not show main feed if (!isset($_GET['keyword']) || $keyword == "") { $query = "SELECT * FROM table_name ORDER BY ID DESC LIMIT 0,20"; } else { $query = "SELECT * FROM table_name WHERE post_status='publish' AND MATCH (post_title,post_content) AGAINST ('$keyword' IN BOOLEAN MODE) ORDER BY ID DESC LIMIT 0,20"; } $result = mysql_query($query) or die ("Could not execute query"); //start of feed $rssfeed = '<?xml version="1.0" encoding="UTF-8"?>'; $rssfeed .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">'; $rssfeed .= '<channel>'; $rssfeed .= '<atom:link href="http://dynaindex.com/feed" rel="self" type="application/rss+xml" />'; $rssfeed .= '<title>DynaIndex.com ' .$keyword. ' feed</title>'; $rssfeed .= '<link>http://dynaindex.com</link>'; $rssfeed .= '<description>Dynaindex ' .$keyword. ' posts</description>'; $rssfeed .= '<language>en-us</language>'; $current_year = date('Y'); $rssfeed .= "<copyright>Copyright (C) 2009-" .$current_year. " DynaInternet.com</copyright>"; //results loop while($row = mysql_fetch_array($result)) { $post_url = "http://".$row['post_title']; $hyperlink = "<a href='http://dynaindex.com/index.php?post=$post_url'>$post_url</a> "; $title = $row['title_2']; $title = htmlentities($title); $post_date = $row['post_date']; $timedifference = 14400; $get_date = strtotime($post_date); $show_date = date("D, d M Y H:i:s O",$get_date+$timedifference); $permalink = "http://dynaindex.com/index.php?post=".$row['post_name']; $thumb = "http://get.blogdns.com/url-thumb.php?size=400&text=DynaIndex.com&textsize=12&textcolor=aqua&url=$post_url"; $rssfeed .= '<item>'; $rssfeed .= '<title>' . $post_url . '</title>'; $rssfeed .= '<guid>' . $permalink . '</guid>'; $rssfeed .= "<description><![CDATA[<p align=center><a href='http://get.blogdns.com/out/bar.php?url=$post_url' TARGET='_blank'><img src='$thumb' alt='$post_url'/a><br /> $title <hr></p>]]></description>"; $rssfeed .= '<link>' . $permalink .'</link>'; $rssfeed .= '<pubDate>' . $show_date . '</pubDate>'; $rssfeed .= '</item>'; } $rssfeed .= '</channel>'; $rssfeed .= '</rss>'; echo $rssfeed; //close caching //$fch->close(); ?>
-
http://www.sqlite.org/ http://php.net/manual/en/ref.pdo-sqlite.php http://zetcode.com/databases/sqlitetutorial/ http://www.djhweb.co.uk/sqlite1.htm That should get you started.