Search the Community
Showing results for tags 'filter'.
-
At my CMS I want to give site moderators ability to associate any meta information to a page. For meta keywords and description I have different fields but all other stuff are inserted like raw html , like this: <meta name="Generator" content="SomeCMS" /> <meta name="robots" content="nofollow" /> <link rel="canonical" href="http://example.com/content/poisk-i-upravlenie-kontentom" /> This html will be echoed to the page. Mainly only meta tags and link(rel=canonical) will be here. And now I think I have to make sure there is no xss attack in this code. So I need to filter it before saving to database. HtmlPurifier or http://github.com/voku/anti-xss don't work with meta tags. So what would you advise me? To parse text with regexp for meta tags and then check every metatag found for any style or on attributes or http-equiv="refresh"(to deny malicious metatag)?
-
I am developing a database application using Yii Framework. I am reading tables from MySQL database and displaying them to the user. I need the user to be able to filter the fields in the table or search for a certain value. For example, I have a table named "supermarkets": CREATE TABLE IF NOT EXISTS `supermarkets` ( `name` varchar(71) NOT NULL, `location` varchar(191) DEFAULT NULL, `telephone` varchar(68) DEFAULT NULL, `fax` varchar(29) DEFAULT NULL, `website` varchar(24) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; .../model/supermarkets: <?php namespace app\models; use yii\db\ActiveRecord; class Supermarkets extends ActiveRecord { } .../views/supermarkets/index.php: <?php use yii\helpers\Html; use yii\widgets\LinkPager; ?> <h1>Supermarkets</h1> <ul> <?php $array = (array) $supermarkets; function build_table($array){ // start table $html = '<table class="altrowstable" id="alternatecolor">'; // header row $html .= '<tr>'; foreach($array[0] as $key=>$value){ $html .= '<th>' . $key . '</th>'; } $html .= '</tr>'; // data rows foreach( $array as $key=>$value){ $html .= '<tr>'; foreach($value as $key2=>$value2){ $html .= '<td>' . $value2 . '</td>'; } $html .= '</tr>'; } // finish table and return it $html .= '</table>'; return $html; } echo build_table($array); ?> ....Controllers/SupermarketsController: <?php namespace app\controllers; use yii\web\Controller; use yii\data\Pagination; use app\models\Supermarkets; class SupermarketsController extends Controller { public function actionIndex() { $query = supermarkets::find(); $pagination = new Pagination([ 'defaultPageSize' => 20, 'totalCount' => $query->count(), ]); $supermarkets = $query->orderBy('Name') ->offset($pagination->offset) ->limit($pagination->limit) ->all(); return $this->render('index', [ 'supermarkets' => $supermarkets, 'pagination' => $pagination, ]); } } I need the user to be able to filter the table or search its fields by one or more attribute. I'm using Yii2, so CDbcriteria doesn't work. How can I do this?
-
What would be the best way to add filters on a page?
helloworld001 posted a topic in PHP Coding Help
For eg. I have a page with a query that retrives records from the database and I want to have options of filtering out the shown records by date, time, likes, views..etc; how would I go about doing that? The way I am thinking is having a html form with those filter inputs and using a relative query based on the filter selection to retrive the results. What you think? -
hello all, I am trying to use ajax, to filter my custom post_type using a dropdown (several actually, but just working on one now). when I check the console.log for my two variables the log returns the values that I need to pass into my function check_ajax() I am using to do the filtering, but when I check the log for the data array it comes up with 0? Here is my Jquery code: //Listen for the menu's to change except the main filter_by dropdown var ids = ['filter_preacher_dropdown', 'filter_sort_by_dropdown', 'filter_per_page_dropdown', 'filter_series_dropdown', 'filter_tag_dropdown', 'filter_book_dropdown', 'filter_year_dropdown']; $('#' + ids.join(',#')).change(function() { var sermonForm = $("#sermon_filter_form"); var myForm = $(this).closest("form"); var meta_key = this.name; var meta_value = $(this).val(); var current_selection = $(this); var ajaxLoader = '<div class="loading_img"></div>'; $(this).after(ajaxLoader); $.ajax ( { type: "POST", url: ajax_object.ajax_url, data: { 'action': 'filter_sermons', 'meta_key': meta_key, 'meta_value': meta_value, }, dataType: 'JSON', success:function(data){ console.log(data); } } ); }); and here is my function.php code: //ajax for sermons filter add_action('wp_ajax_filter_sermons', 'check_ajax'); add_action('wp_ajax_nopriv_filter_sermons', 'check_ajax'); } /** * Sets up custom query for AJAX to filter * */ function my_sermon_query($meta_key, $meta_value) { return new WP_Query( array( 'meta_key' => $meta_key, 'meta_value' => $meta_value, 'post_type' => 'mbsb_sermon' ) ); } function check_ajax() { $mk = intval($_POST['meta_key']); $mv = intval($_POST['meta_value']); $query = my_sermon_query($mk, $mv); echo json_encode($query); die(); } Any ideas what I am missing/doing wrong? Thanks,
-
Hi, I'm trying to make a program that filters data out of a website. Now I've got a problem. For example, I've this line: <td class="maintxt" width="200"><a href="profile.php?x=Stranger">Stranger</a></td><td class="maintxt" width="200">Godfather (96.76%)</td><td class="maintxt" width="200"><i><a href="clanprofile.php?x=Ettertjes">Ettertjes</a></i></td> Form this line I want to set the word "Stranger" in a variable, and do the same for the word "Godfather". What is the best method to do this? Thanks in advance, iRoot121
-
Can anyone help me please? I am trying to populate my page with data that is filtered from the dropdown box. It can either be "onchange" or clicking a button, not too fussed on this. I have tried so many ways but getting more and more lost an confused and ended up with nothing at all. I have stripped the coding back to where it last worked so any help is appreciated. <body> <table width="680" border="0" align="center" cellpadding="4" cellspacing="0"> <tr> <td> </td> </tr> <tr><td class="text-heading"><p>Financial Services Guides and Adviser Profiles</p><p class="Text_Heading_Black1">PAGE STILL IN DEVELOPMENT</p> <form id="form1" name="form1" method="post" action=""> <span class="text-questions">Adviser: </span> <select name="advselect" id="advselect"> <option value=" " selected="selected"> </option> <?php require ('../edb.php'); if (!$con) { die("MySQL could not connect!"); } $result= mysql_query("SELECT id, LastName, FirstName, UserType FROM `eusers` WHERE UserType='ADV' or UserType='STF' ORDER by LastName ASC"); while ($row = mysql_fetch_array($result)){ echo '<option value="'. $row['id'] .'">'. $row['LastName'] .', '. $row['FirstName'] .'</option>'; } ?> </select> <input type="submit" name="advselect" id="advselect" value="Filter / View" /> </form></td> </tr> <tr><td><p class="Text_SubHeading">Current Version </p> <table width="650" border="0" align="center" cellpadding="4" cellspacing="0"> <tr class="text-sectionheading"> <td width="100">Date </td> <td width="150">Adviser</td> <td width="200">Document</td> <td width="100">Version</td> <td width="50">Current</td> <td width="50">View</td> </tr> <?php include("../edb.php"); $data=mysql_query("SELECT * FROM `adocs_fsg_profile` INNER JOIN `eusers` ON eusers.id = adocs_fsg_profile.AdviserCode WHERE Current='Y' and ORDER BY LastName ASC, FirstName ASC, DocName ASC, DateUploaded DESC"); while($test = mysql_fetch_array($data)) { $id = $test['id']; echo"<tr>"; echo"<td class='text-questions'>".$test['DateUploaded']."</td>"; echo"<td class='text-questions'>".$test['LastName'].", ".$test['FirstName']."</td>"; echo"<td class='text-questions'>".$test['DocName']."</td>"; echo"<td class='text-questions'>".$test['Version']."</td>"; echo"<td class='text-questions'>".$test['Current']."</td>"; echo"<td><a class='".$test['cssclass']."'href =".$test['URL'].">".$test['ImageType']."</a>"; echo "</tr>"; } mysql_close($conn); ?> </table> <p class="Text_SubHeading">Previous Versions </p> <table width="650" border="0" align="center" cellpadding="4" cellspacing="0"> <tr class="text-sectionheading"> <td width="100">Date </td> <td width="150">Adviser</td> <td width="200">Document</td> <td width="100">Version</td> <td width="50">Current</td> <td width="50">View</td> </tr> <?php include("../edb.php"); $data=mysql_query("SELECT * FROM `adocs_fsg_profile` INNER JOIN `eusers` ON eusers.id = adocs_fsg_profile.AdviserCode WHERE Current='N' ORDER BY LastName ASC, FirstName ASC, DocName ASC, DateUploaded DESC"); while($test = mysql_fetch_array($data)) { $id = $test['id']; echo"<tr>"; echo"<td class='text-questions'>".$test['DateUploaded']."</td>"; echo"<td class='text-questions'>".$test['LastName'].", ".$test['FirstName']."</td>"; echo"<td class='text-questions'>".$test['DocName']."</td>"; echo"<td class='text-questions'>".$test['Version']."</td>"; echo"<td class='text-questions'>".$test['Current']."</td>"; echo"<td><a class='".$test['cssclass']."'href =".$test['URL'].">".$test['ImageType']."</a>"; echo "</tr>"; } mysql_close($conn); ?> </table></td> </tr> </table> </body>
-
Hello Guys/Gals, Can someone please tell me how safe this sanitation is? $username = filter_var($_POST['user_name'], FILTER_SANITIZE_STRING); Thanks, Halben
-
Im doing an adult model filter and I have the html but I need the php. I am new so bear with me. I apologize for the adult verbage. <div class="modelsearch"> <span style='color: black; font-size: 16px; position: relative; left: 5px; bottom: 5px;'>Available For:</span><span style='color: black; font-size: 16px; position: relative; left: 500px; bottom: 5px;'>More Options:</span> <form id="form1" name="form1" method="get" action="femaletalent-talent.php"> <div class="columnsearch"> <input name="anal" type="checkbox" id="anal" value="1" onClick="submitform()"> <label for="anal">Anal</label><br><input name="bbg" type="checkbox" id="bbg" value="1" onClick="submitform()"> <label for="anal">BBG</label><br> <input name="bg" type="checkbox" id="bg" value="1" onClick="submitform()"> <label for="anal">BG</label><br><input name="bgg" type="checkbox" id="bgg" value="1" onClick="submitform()"> <label for="anal">BGG</label> <br> <input name="bisexual" type="checkbox" id="bisexual" value="1" onClick="submitform()"> <label for="anal2">Bi-Sexual</label> </div> <div class="columnsearch"> <input name="blowbang" type="checkbox" id="blowbang" value="1" onClick="submitform()"> <label for="anal3">Blowbang</label> <br> <input name="blowjob" type="checkbox" id="blowjob" value="1" onClick="submitform()"> <label for="anal4">Blowjob</label> <br> <input name="bondage" type="checkbox" id="bondage" value="1" onClick="submitform()"> <label for="anal5">Bondage</label> <br> <input name="creampie" type="checkbox" id="creampie" value="1" onClick="submitform()"> <label for="anal6">Creampie</label> <br> <input name="dp" type="checkbox" id="dp" value="1" onClick="submitform()"> <label for="anal7">DP</label> </div> <div class="columnsearch"> <input name="deepthroat" type="checkbox" id="deepthroat" value="1" onClick="submitform()"> <label for="anal9">Deepthroat</label> <br> <input name="fetish" type="checkbox" id="fetish" value="1" onClick="submitform()"> <label for="anal10">Fetish</label> <br> <input name="gg" type="checkbox" id="gg" value="1" onClick="submitform()"> <label for="anal11">GG</label> <br> <input name="gganal" type="checkbox" id="gganal" value="1" onClick="submitform()"> <label for="anal12">GG Anal</label> <br> <input name="ggonly" type="checkbox" id="ggonly" value="1" onClick="submitform()"> <label for="anal13">GG ONLY</label> </div> <div class="columnsearch"> <input name="gangbang" type="checkbox" id="gangbang" value="1" onClick="submitform()"> <label for="anal14">Gangbang</label> <br> <input name="group" type="checkbox" id="group" value="1" onClick="submitform()"> <label for="anal15">Group</label> <br> <input name="handjob" type="checkbox" id="handjob" value="1" onClick="submitform()"> <label for="anal16">Handjob</label> <br> <input name="interracial" type="checkbox" id="interracial" value="1" onClick="submitform()"> <label for="anal17">Interracial</label> <br> <input name="softcoreonly" type="checkbox" id="softcoreonly" value="1" onClick="submitform()"> <label for="anal18">Soft Core only</label> </div> <div class="columnsearch"> <input name="solo" type="checkbox" id="solo" value="1" onClick="submitform()"> Solo <br> <input name="squirting" type="checkbox" id="squirting" value="1" onClick="submitform()"> <label for="anal19">Squirting</label> <br> <input name="stills" type="checkbox" id="stills" value="1" onClick="submitform()"> Stills <br> <input name="swallow" type="checkbox" id="swallow" value="1" onClick="submitform()"> Swalllow <br> <input name="webcam" type="checkbox" id="webcam" value="1" onClick="submitform()"> Webcam </div> <div class="columnsearch"><input name="teen" type="checkbox" id="teen" value="1" onClick="submitform()"> <label for="anal">Teen</label><br><input name="early20s" type="checkbox" id="early20s" value="1" onClick="submitform()"> <label for="anal">Early 20's</label> <br> <input name="late20s" type="checkbox" id="late20s" value="1" onClick="submitform()"> <label for="anal">Late 20's</label><br><input name="milf" type="checkbox" id="milf" value="1" onClick="submitform()"> <label for="anal">Milf/Cougar</label> <br><input name="storesignings" type="checkbox" id="storesignings" value="1" onClick="submitform()"> Store Signings <label for="anal"></label></div> <div class="columnsearch"><input name="speaksspanish" type="checkbox" id="speaksspanish" value="1" onClick="submitform()"> <label for="anal">Speaks Spanish</label><br><input name="featuredancer" type="checkbox" id="featuredancer" value="1" onClick="submitform()"> <label for="anal">Feature Dancer</label> <br> <input name="flexible" type="checkbox" id="flexible" value="1" onClick="submitform()"> <label for="anal">Flexible</label><br><input name="allnatural" type="checkbox" id="allnatural" value="1" onClick="submitform()"> <label for="anal">All Natural</label> <br><input name="smokes" type="checkbox" id="smokes" value="1" onClick="submitform()"> <label for="anal">Smokes</label></div> <div style='height: 105px;'><input name="Reset" type="reset" style="float: left; position: relative; top:70px; font-size: 20px; ' name=; background-color: #00F; color: white; border-radius: 8px;" onClick="resetform()"> </form> </div> I need some help with this
-
I am using two tables. "Landlord Table" is a 2 column table. column 1 = "Landlord name" and column 2 ="buildings". "buildings" are set as a primary key. All data from this table is displayed under "Landlord Table" on bottom of page at: http://responsiblyvodka.com/tester.php Problem: I want to add available apartments into a NEW table for potential renters. Instead of searching through all the buildings like I currently have at top in the second combobox. I want to click the landlord name i.e. "ABC" and only have 3 building addresses show up in the combo next to it.
-
I have a custom filter for WordPress' wp_link_pages which allows both next/previous links and pagination to be used. However, I have an extra linked space in front of 'Next page' I can't seem to get rid of. I need to maintain the spacing while de-linking the extra space in front of "Next page". I was able to figure out how to remove the space itself, but I really just need to remove the linking from the space. The problem can be viewed in this post. add_filter('wp_link_pages_args', 'wp_link_pages_args_prevnext_add'); /*** Add prev and next links to a numbered link list */ function wp_link_pages_args_prevnext_add($args) { global $page, $numpages, $more, $pagenow; if (!$args['next_or_number'] == 'next_and_number') return $args; # exit early $args['next_or_number'] = 'number'; # keep numbering for the main part if (!$more) return $args; # exit early if($page-1) # there is a previous page $args['before'] .= _wp_link_page($page-1) . $args['link_before']. $args['previouspagelink'] . $args['link_after'] . '</a>' ; if ($page<$numpages) # there is a next page $args['after'] = _wp_link_page($page+1) .' '. $args['link_before'] . $args['nextpagelink'] . $args['link_after'] . '</a>' . $args['after'] ; return $args; }
-
Hi, I have just finished creating a profanity filter in PHP and would like to see if anyone can bypass it. I have spent a few days working on the algorithm which accounts for spaces and symbols as well as words that sound like profanity eg/ replacing "er" with "a". I should mention that this project displays a list of all the words that bypass the filter. So if you do not wish to see these words then please do not visit the page. http://cjmarkham.co.uk/projects/profanity/ http://cjmarkham.co.uk/projects/profanity/phpfreaks.txt Thanks
-
Searching A Text File And Filtering What Is Shown? Help
codingbenn posted a topic in PHP Coding Help
So basically I have a HUGE text file; download here or the code is like this; FirstName: Wayne, LastName: Brown, CommonName:None, Height: 185, DateOfBirth: Year: 1977, Month: 1, Day: 14, PreferredFoot: Right, ClubId: 1951, LeagueId: 61, NationId: 14, Rating: 54, Attribute1: 56, Attribute2: 53, Attribute3: 47, Attribute4: 61, Attribute5: 36, Attribute6: 49, Rare: 0, ItemType: PlayerGk but this is repeated like 11,480 times(to be exact) but with different information e.g names ect. I have the search working ATM like this; <?php $search = 'Wayne'; $lines = file('cleanedfutplayers.txt'); $found = false; foreach($lines as $line) { if(strpos($line, $search) !== false) { $found = true; echo $line; } } if(!$found) { echo "<i>No match found"; } ?> And atm I get a return of this; BUT i want to filter it out. I want it to just take the values such as getting the value of first name would just get Wayne and the same for the rest of the fields. and i also need some <br> 's in there and some spacing. So how would I go about filtering this? Also how would I add a search box and a button that would give and set the value of the; $search = ''; so for example i THINK the code will be something like this; echo "First Name: ", ['FirstName']; but it isnt because ive tested and it doesnt work? so PLEASE help me! -
Hi, I received a task to insert one more condition into filtering proces of this script. Since i am not coder i really need help on this. here is a piece of a bit larger script that i think is handling filtering proces: if($next_conds){ foreach($next_conds as $next_cond){ if($next_cond['type']=='SKIP' ){ if($compare_features){ foreach($compare_features as $compare_feature){ if(!empty($compare_features2) && $next_cond['feature2']){ foreach($compare_features2 as $compare_feature2){ if($next_cond['feature'] == $compare_feature['id_feature'] && $next_cond['feature2'] == $compare_feature2['id_feature']){ $json['js'] = array('type'=>'SKIP','pop_text'=>Pcconfig::translate($next_cond['pop_text'])); } } }else{ if($next_cond['feature'] == $compare_feature['id_feature']){ $json['js'] = array('type'=>'SKIP','pop_text'=>Pcconfig::translate($next_cond['pop_text'])); } } } } } if($next_cond['type']=='PREFER'){ foreach($a_products as $a_product){ $current_features = $a_product['features']; if($current_features){ foreach($current_features as $c_feature){ if($compare_features){ foreach($compare_features as $compare_feature){ if(!empty($compare_features2) && $next_cond['feature2']){ foreach($compare_features2 as $compare_feature2){ if($compare_feature['id_feature'] == $c_feature['id_feature'] && $next_cond['feature'] == $compare_feature['id_feature'] && $next_cond['feature2'] == $compare_feature2['id_feature']){ $product_quantity[$a_product['id_product']] = $next_cond['yes_value']; } } }else{ if($compare_feature['id_feature'] == $c_feature['id_feature'] && $next_cond['feature'] == $compare_feature['id_feature']){ $product_quantity[$a_product['id_product']] = $next_cond['yes_value']; } } } } } } } } if($next_cond['type']=='SUM'){ $watt = 0; foreach($selected as $selectkey => $selectp){ if($selectp>0){ $selectprod = new Product($selectp); $selectprod_features =$selectprod->getFeatures(); if($selectprod_features){ foreach($selectprod_features as $s_feature){ if($s_feature['id_feature'] == $next_cond['feature']){ $f_values = FeatureValue::getFeatureValueLang($s_feature['id_feature_value']); if($f_values){ foreach($f_values as $f_value){ if($f_value['id_lang'] == $cookie->id_lang){ $watt = $watt + $f_value['value']*$selected_quan[$selectkey]; } } } } } } } } $af_products = $a_products; $a_products = array(); foreach($af_products as $af_key => $af_product){ $current_features = $af_product['features']; if($current_features){ foreach($current_features as $c_feature){ if($c_feature['id_feature'] == $next_cond['feature'] && $c_feature['value'] < $watt){ unset($af_products[$af_key]); } } } } $a_products = my_array_unique($af_products); } } } Now part of filtering that is called "PREFER" has certain "yes_value" I must insert a code in case if this yes_value == 0 so that product wich meet this yes_value gets ignored. Anyone care to help me on this one? (Do i need to paste entire script or is this enough?) Thank you in advance! V