PHP - Worpress-plugin Api - Giving Back The Meta-data According The Usage Of Different Filters
hello and good day
first of all:; i hope youre all right and everything goes well at your site;: Worpress-Plugin API - giving back the meta-data according the usage of different filters
I'm currently working on a parser to make a small preview on the newest plugins in wordpress. at the moment i think i work from a URL given out of the range of these: https://de.wordpress.org/plugins/browse/popular/ - let us say the first 30 to 40 URL-pages.
What i subsequently want to filter out after the fetch is - those plugins that have the newest timestamp Version: 1.9.5.12 installations: 10,000+ WordPress Version: 5.0 or higher Tested up to: 5.4 PHP Version: 5.6 or higher Tags 3 Tags: database member sign-up form volunteer Last updated: 19 hours ago plugin-ratings
Supported arguments per action +--------------------+---------------+--------------------+----------+----------------+ | | | | | | +--------------------+---------------+--------------------+----------+----------------+ | Argument Name | query_plugins | plugin_information | hot_tags | hot_categories | | $slug | No | Yes | No | No | | $per_page | Yes | No | No | No | | $page | Yes | No | No | No | | $number | No | No | Yes | Yes | | $search | Yes | No | No | No | | $tag | Yes | No | No | No | | $author | Yes | No | No | No | | $user | Yes | No | No | No | | $browse | Yes | No | No | No | | $locale | Yes | Yes | No | No | | $installed_plugins | Yes | No | No | No | | $is_ssl | Yes | Yes | No | No | | $fields | Yes | Yes | No | No | +--------------------+---------------+--------------------+----------+----------------+
regards dil_Bert
cf: https://developer.wordpress.org/reference/functions/plugins_api/ $fields = array( 'active_installs' => true, // rounded int 'added' => true, // date 'author' => true, // a href html 'author_block_count' => true, // int 'author_block_rating' => true, // int 'author_profile' => true, // url 'banners' => true, // array( [low], [high] ) 'compatibility' => false, // empty array? 'contributors' => true, // array( array( [profile], [avatar], [display_name] ) 'description' => false, // string 'donate_link' => true, // url 'download_link' => true, // url 'downloaded' => false, // int // 'group' => false, // n/a 'homepage' => true, // url 'icons' => false, // array( [1x] url, [2x] url ) 'last_updated' => true, // datetime 'name' => true, // string 'num_ratings' => true, // int 'rating' => true, // int 'ratings' => true, // array( [5..0] ) 'requires' => true, // version string 'requires_php' => true, // version string // 'reviews' => false, // n/a, part of 'sections' 'screenshots' => true, // array( array( [src], ) ) 'sections' => true, // array( [description], [installation], [changelog], [reviews], ...) 'short_description' => false, // string 'slug' => true, // string 'support_threads' => true, // int 'support_threads_resolved' => true, // int 'tags' => true, // array( ) 'tested' => true, // version string 'version' => true, // version string 'versions' => true, // array( [version] url ) );
what do you say-!? Similar Tutorials
I Need To Show Data After Pressing Browser's Back Button [accidentally Pressed Enter Instead Of Tab]
I would like to be able to have my meta data pick out the information of a page and insert it into the meta tags. I have a controller class which has the coding to get the data, which is this: controller.class.php Code: [Select] function get_title(){ $title=''; if (isset($this->_params['item']['meta_title']) && !empty($this->_params['item']['meta_title'])){ $title=$this->_params['item']['meta_title']; } $title=strip_tags($title); $title=str_replace('"', '\'', $title); $title=trim($title); if (strlen($title)>150){ $end_of_last_sentence=strpos($title, '.', 150)+1; if ($end_of_last_sentence<150){ $end_of_last_sentence=150; } $title=substr($title, 0, $end_of_last_sentence); } return $title; } function get_description(){ $description=''; if (isset($this->_params['item']['meta_description']) && !empty($this->_params['item']['meta_description'])){ $description=$this->_params['item']['meta_description']; } $description=strip_tags($description); $description=str_replace('"', '\'', $description); $description=trim($description); if (strlen($description)>150){ $end_of_last_sentence=strpos($description, '.', 150)+1; if ($end_of_last_sentence<150){ $end_of_last_sentence=150; } $description=substr($description, 0, $end_of_last_sentence); } return $description; } function get_keywords(){ $keyword=''; if (isset($this->_params['item']['meta_keyword']) && !empty($this->_params['item']['meta_keyword'])){ $keyword=$this->_params['item']['meta_keyword']; } $keyword=strip_tags($keyword); $keyword=str_replace('"', '\'', $keyword); $keyword=trim($keyword); if (strlen($keyword)>150){ $end_of_last_sentence=strpos($keyword, '.', 150)+1; if ($end_of_last_sentence<150){ $end_of_last_sentence=150; } $keyword=substr($keyword, 0, $end_of_last_sentence); } return $keyword; } Then I have a pages.controller which has the coding for the home page pages.controller.php Code: [Select] public function home(){ //instantiate a model $galleries_model = new galleries_model('galleries'); $galleries = $galleries_model -> get_all(); foreach($galleries as $gallery){ //how to loop through an image so that only the first //image is selected $sql = "SELECT image_path FROM gallery_images WHERE gallery_id = {$gallery['id']} ORDER BY order_by"; $image = $this->_model->get_one($sql); $gallery['image'] = $image; $this->_params['list'][] = $gallery; } $this->_params['item'] = $this->_model->get(array("pages.name = 'home'")); } Code: [Select] galleries.controller.php public function galleries(){ $galleries = $this->_model->get_all(); $this->_params['list'] = $galleries; } public function view($gallery_id){ $this->_params['item'] = $this->_model->get($gallery_id); $this->_params['item'] ; //die; } This is my default page where I want the meta tags to echo out the relevent information default.php Code: [Select] !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> <title><?php echo $this->get_title(); ?></title> <meta name="Description" content="<?php echo $this->get_description(); ?>" /> <meta name="Keywords" content="<?php echo $this->get_keywords(); ?>" /> <title>Welcome to the Framework</title> <?php $this->_page->add_javascript('/vendor/lightbox/js/jquery.lightbox-0.5.min.js'); $this->_page->add_stylesheet('/vendor/lightbox/css/jquery.lightbox-0.5.css'); echo $this->page('stylesheets'); echo $this->page('javascripts'); ?> </head> <body> <h1> Welcome to the My site </h1> <?php echo $this->page('view');?> </body> </html> In the pages.controller.php I managed to get it to work using $this->_params['item'] = $this->_model->get(array("pages.name = 'home'")); I want to be able to do the same thing on different pages but I can't get it to work. I hope I explained it clearly. Thank you the difference between memory usage and bandwidth usage? I did a test with 500 rows in table, got 2.36mb memory usage, and then once without 500 rows in table, i got 2.34 (IN MBS) memory usage, can that translate into bandwidth usage? somone told me that bandwidth usage != memory usage, how so? it does effect it some doesn't it ? Ok so i'm not a programmer of any kind however I'm trying to enter what I believe is HTML generated metadata into the header.php of my wordpress theme here is how the wordpress header reads ?> <!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" <?php language_attributes(); ?>> <head profile="http://gmpg.org/xfn/11"> <title><?php if ( is_single() ) { single_post_title(); } elseif ( is_home() || is_front_page() ) { bloginfo('name'); print ' | '; bloginfo('description'); get_page_number(); } elseif ( is_page() ) { single_post_title(''); } elseif ( is_search() ) { bloginfo('name'); print ' | Search results for ' . wp_specialchars($s); get_page_number(); } elseif ( is_404() ) { bloginfo('name'); print ' | Not Found'; } else { bloginfo('name'); wp_title('|'); get_page_number(); } ?></title> <meta http-equiv="content-type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> AND HERE IS WHAT I WANT TO PLACE I just don't know where I put it. It gives me Syntax errors when I paste just above the last title tag....does it need to be in php form and if so how do i change it? thanks for anyones help, sorry if this is a lame question but I've been slapping my head against a wall for 4 hours now Page: http://www.dylanpatrickarts.com/ <title>NYC Headshots, Lifestyle Portraits, Corporate, PR, Live Music</title> <meta name="description" content="Providing quality affordable NYC Headshots to the working actor, as well as Lifestyle Photography, Corporate Photography, Public Relations Photography, and much more! I strive to push my creative potential at all times, while having fun doing it!"> <meta name="keywords" content="photography,wedding photography,headshots,headshot,actors headshot,headshots nyc,nyc headshots,new york city headshot photography,headshot photographers in new york city,portraits,portrait,portrait photographer,hospitality photography,live music photography,public relations photography"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/galleries/headshots/ <title>NYC Headshots</title> <meta name="description" content="A collection of NYC Headshots for actors, dancers, and models"> <meta name="keywords" content="headshots,headshot,good headshots examples,actors headshots,actors headshot,headshots nyc,nyc headshots,new york city headshot photography,headshot photographers in new york city,new york headshots,actors,headshot photography,headshot photography in nyc,affordable headshots,affordable headshots nyc"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/galleries/ <title>Portfolio</title> <meta name="description" content="A collection of NYC Headshots, People Photography, Live Music Photography, Scenic Photography, and Public Relations Photography, as well as a gallery for you to buy prints!"> <meta name="keywords" content="headshots,actors headshots,actors headshot,headshots nyc,headshot photographers in nyc,portrait photography,abstract photography,scenic stock photography,live music photography,music photography,hospitality photography,hotel photography,public relations,cocktail photography,buy print photography"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/galleries/people/ <title>People</title> <meta name="description" content="A collection of Portraits, Candids, and Outtakes"> <meta name="keywords" content="people photography,people stock photography,black white photography of people,portrait photography,family portrait photography,headshots,headshot,actors headshot,actors headshots,photographers in new york city,new york city corporate photographer,headshot photographers in new york city,dylan,candids"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/galleries/live-music/ <title>Live Music</title> <meta name="description" content="A collection of Live Music work in NYC"> <meta name="keywords" content="music photography,photography,live music photography,live music nyc,new york city live rock music,bleecker street"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/galleries/pr-work/ <title>PR Work</title> <meta name="description" content="A collection of public relations and hospitality work. "> <meta name="keywords" content="public relations,public relations photography,hospitality,hospitality photography,cocktails,cocktail,dylan,bentley,clients,empire"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/galleries/tear-sheets/ <title>Tear Sheets</title> <meta name="description" content="A collection of published work"> <meta name="keywords" content="tear sheets,photography,actors headshots,actors headshot,headshot,headshots,headshots nyc,nyc headshots"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/galleries/scenic-artistic/ <title>Scenic & Artistic</title> <meta name="description" content="A collection of scenic and artistic work. Certain photos also available for purchase!"> <meta name="keywords" content="scenic stock photography,scenic photography,scenic photography for sale,abstract photography,artistic photography,hdr photography,hdr photography galleries,examples of hdr photography,scenic,new york city,new york city skyline,san francisco,idaho"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/galleries/buy-prints/ <title>Buy Prints</title> <meta name="description" content="A collection of available prints for purchase."> <meta name="keywords" content="web site shopping cart,shopping cart,buy photography,buy scenic photography"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/your-shoot/ <title>Your Shoot</title> <meta name="description" content="Details about your headshot session."> <meta name="keywords" content="headshots nyc,nyc headshots,headshots,headshot,actors headshots,actors headshot,information,clients,consultation,dylan,people,portfolio,testimonials"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/pricing/ <title>Pricing</title> <meta name="description" content="Pricing information for headshot sessions"> <meta name="keywords" content="headshot pricing,pricing information,nyc headshots,headshots,headshot,actors headshot,photography prices,digital photography prices,prices for photography,headshot photography prices,nyc headshot photography prices,wardrobe,session"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/testimonials/ <title>Testimonials</title> <meta name="description" content="Testimonials from some of my wonderful clients!"> <meta name="keywords" content="testimonials,testimonial,photographer testimonials,headshots,headshot,actors headshots,actors headshot,headshot photographers in nyc,headshot photography in nyc,nyc headshot photographers,headshots nyc,nyc headshots,photographer,dylan,amazing"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/resources/ <title>Resources</title> <meta name="description" content="A few links to photographers, and some cool places"> <meta name="keywords" content="photography links,headshots,headshot,actors headshot,actors headshots,headshot photographers in nyc,nyc headshot photographers,acting schools links,the empire hotel,the empire hotel new york"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/blog/ <title>Blog</title> <meta name="description" content="Official Blog for Dylan Patrick Photography"> <meta name="keywords" content="blog,photography blogs,blogs on photography,photography,portraits,portrait,portrait photographer,portrait photographers,headshot photographers in nyc,headshot photographers in new york city,nyc headshot photographers,headshots nyc,nyc headshots,headshots,headshot"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/about/ <title>About Dylan</title> <meta name="description" content="A short bio about Dylan Patrick"> <meta name="keywords" content="nyc headshots,dylan patrick arts,dylan patrick photography,headshot photographers in nyc,headshot photographers in new york city,nyc headshot photographers,headshot,headshots,actors headshot,actors headshots"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/contact/ <title>Contact</title> <meta name="description" content="Contact information for Dylan Patrick"> <meta name="keywords" content="contact info,headshot photographers in nyc,headshot photographers in new york city,nyc headshot photographers,portraits,portrait,portrait photographers"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/shopping-cart/ <title>Shopping Cart</title> <meta name="description" content="Your Shopping Cart"> <meta name="keywords" content="web site shopping cart,shopping cart,buy photography,buy scenic photography"> I have recently started a Wordpress Site (www.edsstudios.com). Let me say in advance I am a designer and not a coder, hence the need to come to this forum. I installed a theme which I would like to customize on the home page. I want to place three images along with text below the image slider of the theme. I have included an attachment (pic1.jpg) showing the photoshop mock of how I want the home page to look. Keep in mind I only want to add the image below the image slider. The rest of the page is already existing as part of the wordpress theme. So, I sliced up only the images from the photoshop mock(pic2.jpg) within photoshop and produced the web ready images and html code. I opened the home.php file but can't get the code to function. Below is the code for the home.php page first. Below that is the html code for the images. Can someone tell me if there is something wrong with the code for the images along with where to place it on the home.php file? Home.php CODE <!-- --><?php get_header(); ?> <div id="contenthome"> <div id="slider"> <p> <?php include(TEMPLATEPATH."/includes/slider.php");?> </p> </div> <div id="homepage"> <div class="homepageright"> <div id="subscribe" class="widget"> <h4><span><?php _e("Subscribe", 'organicthemes'); ?></span></h4> <p><?php _e("Receive news and updates from us.", 'organicthemes'); ?></p><form action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=<?php echo ot_option('feedburner'); ?>', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true"><input type="text" value="Enter your email address..." id="subbox" onfocus="if (this.value == 'Enter your email address...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Enter your email address...';}" name="email"/><input type="hidden" value="<?php echo ot_option('feedburner'); ?>" name="uri"/><input type="hidden" name="loc" value="en_US"/><input type="submit" value="Subscribe" id="subbutton" /><input type="hidden" value="eNews Subscribe" name="title"/></form> </div> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Home Sidebar') ) : ?> <div class="widget"> <h4>Widget Area</h4> <p>This section is widgetized. To add widgets here, go to the <a href="<?php echo admin_url(); ?>widgets.php">Widgets</a> panel in your WordPress admin, and add the widgets you would like to <strong>Homepage Top Right</strong>.</p> <p><small>*This message will be overwritten after widgets have been added</small></p> </div> <?php endif; ?> </div> <div class="homepageleft"> <h3><?php echo cat_id_to_name(ot_option('hp_cat')); ?></h3> <?php $recent = new WP_Query("cat=" .ot_option('hp_cat'). "&showposts=" .ot_option('hp_num') ); while($recent->have_posts()) : $recent->the_post();?> <div class="postarea"> <div class="posttitle"> <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <a class="commenticon" href="<?php the_permalink(); ?>#comment" title="Comments"><?php comments_number('0', '1', '%'); ?></a> </div> <div class="homecontent"> <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail( 'home-thumbnail' ); ?></a> <p><?php the_excerpt(); ?></p> <p><a class="more-link" href="<?php the_permalink() ?>">Read More</a></p> </div> </div> <?php endwhile; ?> </div> </div> </div> <!-- The main column ends --> <?php get_footer(); ?> IMAGES CODE <html> <head> <title>home page icons</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/javascript"> <!-- function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> </head> <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/home-page-icons_05ro.png','images/home-page-icons_07ro.png','images/home-page-icons_09ro.png')"> <!-- ImageReady Slices (home page icons.psd) --> <table width="960" height="183" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01"> <tr> <td colspan="3"> <img src="images/home-page-icons_01.png" width="310" height="143" alt=""></td> <td colspan="3"> <img src="images/home-page-icons_02.png" width="332" height="143" alt=""></td> <td colspan="3"> <img src="images/home-page-icons_03.png" width="318" height="143" alt=""></td> </tr> <tr> <td> <img src="images/home-page-icons_04.png" width="223" height="39" alt=""></td> <td><div align="center"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image19','','images/home-page-icons_05ro.png',1)"><img src="images/home-page-icons_05.png" name="Image19" width="66" height="39" border="0"></a></div></td> <td colspan="2"> <img src="images/home-page-icons_06.png" width="273" height="39" alt=""></td> <td><div align="center"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image20','','images/home-page-icons_07ro.png',1)"><img src="images/home-page-icons_07.png" name="Image20" width="65" height="39" border="0"></a></div></td> <td colspan="2"> <img src="images/home-page-icons_08.png" width="248" height="39" alt=""></td> <td><div align="center"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image21','','images/home-page-icons_09ro.png',1)"><img src="images/home-page-icons_09.png" name="Image21" width="62" height="39" border="0"></a></div></td> <td> <img src="images/home-page-icons_10.png" width="23" height="39" alt=""></td> </tr> <tr> <td> <img src="images/spacer.gif" width="223" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="66" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="21" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="252" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="65" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="15" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="233" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="62" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="23" height="1" alt=""></td> </tr> </table> <!-- End ImageReady Sl I have a profile page where the user answers a list of about 20 questions. These questions are then put into a mysql table with username, questionid, and answer. I can store the answers to the table, but I cannot figure out how to get them back to view and edit. My form is built from basic HTML. I know how to pull answers from a db table with only 1 row of results, where each field is a different question, but this one is different, as it will pull 20 rows, and each row is for a different question. Here is how I populate the questions and then fill in the answers. Code: [Select] // If this user has never set their profile, insert empty questions into the database $query1 = "SELECT * FROM u_profile WHERE username = '" . $_SESSION['username'] . "'"; $data = mysqli_query($dbc, $query1); if (mysqli_num_rows($data) == 0) { // First grab the list of questionids $query2 = "SELECT questionid FROM questions ORDER BY q_order"; $data = mysqli_query($dbc, $query2); $questionids = array(); while ($row = mysqli_fetch_array($data)) { array_push($questionids, $row['questionid']); } // Insert empty question rows into the u_profile table, one per question foreach ($questionids as $questionid) { $query3 = "INSERT INTO u_profile (username, questionid) VALUES ('" . $_SESSION['username']. "', '$questionid')"; mysqli_query($dbc, $query3); } } // If the questionnaire form has been submitted, write the responses to the database if (isset($_POST['submit'])) { // Write the questionnaire response rows to the response table foreach ($_POST as $answer_id => $answer) { $query4 = "UPDATE u_profile SET answer = '$answer' WHERE username = '" . $_SESSION['username'] . "' AND questionid = '$answer_id'"; $uprofile_set = "CALL uprofile_set('" . $_SESSION['username'] . "')"; mysqli_query($dbc, $query4) or die( "Connection Error1" . mysqli_error($dbc) ) ; mysqli_query($dbc, $uprofile_set) or die( "Connection Error2" . mysqli_error($dbc) ) ; } $races = "SELECT * FROM u_raceschedule WHERE username = '" . $_SESSION['username'] . "'"; $data = mysqli_query($dbc, $races); if (mysqli_num_rows($data) > 0) { set_time_limit(30); $buildplan = "CALL tplan('" . $_SESSION['username'] . "')"; mysqli_query($dbc,$buildplan) or die("Connection Error2" . mysqli_error($dbc) ) ; Would LOVE any help. I am really new to this whole coding thing. Hi All, I have a table (with an ID of example) that can be seen he http://tinyurl.com/cfla7wp The following script calls jeditable.js and makes the Telephone & Mobile columns editable. Once edited, the table shows the new value plus a * symbol. Code: [Select] <script type="text/javascript"> $(document).ready(function() { /* Init DataTables */ var oTable = $('#example').dataTable(); /* Apply the jEditable handlers to the table */ $('td:eq(4), td:eq(5)', oTable.fnGetNodes()).editable( 'update_table_tenants.php', { "callback": function( sValue, y ) { var aPos = oTable.fnGetPosition( this ); oTable.fnUpdate( sValue, aPos[0], aPos[1] ); }, "submitdata": function ( value, settings ) { return { "row_id": this.parentNode.getAttribute("1"), "column": oTable.fnGetPosition( this )[2] }; }, "height": "14px" } ); } ); </script> What I need to do however is add the value entered into my database, but I do not know how to do this. I believe I need to do something like: UPDATE my_table VALUE whatever column has been edited in the table WHERE tenID is the same as the row selected in the table i.e. if I update the MOBILE NUMBER of the person called BILL GATES it would find his tenID, update numMobile in the table called my_table All help appreciated Dave I have these two tables...
schedule (gameid, homeid, awayid, weekno, seasonno)
teams (teamid, location, nickname)
This mysql query below gets me schedule info for ALL 32 teams in an array...
$sql = "SELECT h.nickname AS home, a.nickname AS away, h.teamid AS homeid, a.teamid AS awayid, s.weekno FROM schedule s INNER JOIN teams h ON s.homeid = h.teamid LEFT JOIN teams a ON s.awayid = a.teamid WHERE s.seasonno =2014"; $schedule= mysqli_query($connection, $sql); if (!$schedule) { die("Database query failed: " . mysqli_error($connection)); } else { // Placeholder for data $data = array(); while($row = mysqli_fetch_assoc($schedule)) { if ($row['away'] == "") {$row['away']="BYE";} $data[$row['homeid']][$row['weekno']] = $row['away']; $data[$row['awayid']][$row['weekno']] = '@ '.$row['home']; } }However, I only want to get info for one specific team, which is stored in the $teamid variable. This should be very easy, right? I have tried multiple things, including this one below (where I added an AND statement of "AND (h.teamid=$teamid OR a.teamid=$teamid)"), but this one still outputs too much... $sql = "SELECT h.nickname AS home, a.nickname AS away, h.teamid AS homeid, a.teamid AS awayid, s.weekno FROM schedule s INNER JOIN teams h ON s.homeid = h.teamid LEFT JOIN teams a ON s.awayid = a.teamid WHERE s.seasonno =2014 AND (h.teamid=$teamid OR a.teamid=$teamid)"; $schedule= mysqli_query($connection, $sql); if (!$schedule) { die("Database query failed: " . mysqli_error($connection)); } else { // Placeholder for data $data = array(); while($row = mysqli_fetch_assoc($schedule)) { if ($row['away'] == "") {$row['away']="BYE";} $data[$row['homeid']][$row['weekno']] = $row['away']; $data[$row['awayid']][$row['weekno']] = '@ '.$row['home']; } }Below is the array that the above outputs. In a nutshell, all I want is that 1st array ([1]) which has, in this example, the Eagles full schedule. It's not giving me too much else and I guess I could live with it and just ignore the other stuff, but I'd rather be as efficient as possible and only get what I need... Array ( [1] => Array ( [1] => Jaguars [2] => @ Colts [3] => Redskins [4] => @ 49ers [5] => Rams [6] => Giants [7] => BYE [8] => @ Cardinals [9] => @ Texans [10] => Panthers [11] => @ Packers [12] => Titans [13] => @ Cowboys [14] => Seahawks [15] => Cowboys [16] => @ Redskins [17] => @ Giants ) [27] => Array ( [1] => @ Eagles ) [28] => Array ( [2] => Eagles ) [4] => Array ( [3] => @ Eagles [16] => Eagles ) [14] => Array ( [4] => Eagles ) [15] => Array ( [5] => @ Eagles ) [3] => Array ( [6] => @ Eagles [17] => Eagles ) [] => Array ( [7] => @ Eagles ) [16] => Array ( [8] => Eagles ) [25] => Array ( [9] => Eagles ) [11] => Array ( [10] => @ Eagles ) [7] => Array ( [11] => Eagles ) [26] => Array ( [12] => @ Eagles ) [2] => Array ( [13] => Eagles [15] => @ Eagles ) [13] => Array ( [14] => @ Eagles ) ) hello dear php-experts,
https://europa.eu/youth/volunteering/organisations_en#open
<?php // Report all PHP errors (see changelog) error_reporting(E_ALL); include('inc/simple_html_dom.php'); //base url $base = 'https://europa.eu/youth/volunteering/organisations_en#open'; //home page HTML $html_base = file_get_html( $base ); //get all category links foreach($html_base->find('a') as $element) { echo "<pre>"; print_r( $element->href ); echo "</pre>"; } $html_base->clear(); unset($html_base); ?>
I have the above code and I'm trying to get certain elements of the page but it isn't returning anything.
Is it possible that certain PHP functions might be disabled on the server to stop that? The above code works perfectly on other sites.
Is there any workaround?
btw: i have created a small snipped as a proof of concept to run this with Python and BeautifulSoup -
import requests from bs4 import BeautifulSoup url = 'https://europa.eu/youth/volunteering/organisations_en#open' response = requests.get(url) soup = BeautifulSoup(response.content, 'lxml') print(soup.find('title').text) block = soup.find('div', class_="eyp-card block-is-flex")
and this....
European Youth Portal >>> block.a <a href="/youth/volunteering/organisation/48592_en" target="_blank">"Academy for Peace and Development" Union</a> >>> block.a.text '"Academy for Peace and Development" Union' >>> block.select_one('div > div > p:nth-child(9)') <p><strong>PIC:</strong> 948417016</p> >>> block.select_one('div > div > p:nth-child(9)').text 'PIC: 948417016'
what is aimed in the end - i want to gather the first 20 results of the page - and put them in to a sql-db or alternatively show the information in a little widget not sure if this will find an answer but I am posting anyway. Any help is appreciated....my coder has left the team and no matter how I invite her to come and do some bug squashing, her new schedules won't fit a re-visit into my little aplication...I am eager to delve into the codes at my very low knowledge of php. I have initiated reading and is still trying to teach myself...but of course not as fast as the app needs the patch...here's the meat: Please, take a look to the following code.After clicking Next it goes to overview.php.Why when I click back on my browser to return to this page again, it is not returning back? When I click back I receive "Confirm Form Resubmission" message. After refreshing page it loads page. I guess problem is in "session_start();" part. Something to do with cookies. Please, help me it is very urgent for me. <?php session_start(); echo "<html> <head> <title>Hello World</title> <meta http-equiv='Content-Type' content='text/html; charset=Windows-1252'/> </head>"; require_once ('functions.inc'); if(!isset($_POST['userid'])) { echo "<script type='text/javascript'>"; echo "window.location = 'index.php'"; echo "</script>"; exit; }else{ session_register("userid", "userpassword"); $username = auth_user($_POST['userid'], $_POST['userpassword']); if(!$username) { $PHP_SELF = $_SERVER['PHP_SELF']; session_unregister("userid"); session_unregister("userpassword"); echo "Authentication failed " . "Please, write correct username or password. " . "try again "; echo "<A HREF=\"index.php\">Login</A><BR>"; exit; } } function auth_user($userid, $userpassword){ global $default_dbname, $user_tablename; $user_tablename = 'user'; $link_id = db_connect($default_dbname); mysql_select_db("d12826", $link_id); $query = "SELECT username FROM $user_tablename WHERE username = '$userid' AND password = '$userpassword'"; $result = mysql_query($query) or die(mysql_error()); if(!mysql_num_rows($result)){ return 0; }else{ $query_data = mysql_fetch_row($result); return $query_data[0]; } } echo "hello"; echo "<form method='POST' name='myform' action='overview.php'>"; echo "<input type='submit' value='Next'>"; echo "</form>"; ?> Right i have my code below, i also have a drop down box My drop down menu code <table class="thinline" width="175"> <tr><td class="topic">Show All Cars From:</td> </tr><tr> <td> <select name="lim" class="text"> <option value="X">Everywhere</option> <option value="England">England</option> <option value="China">China</option> <option value="Japan">Japan</option> <option value="Brazil">Brazil</option> <option value="South-Africa">South-Africa</option> <option value="America">America</option><br><input type="submit" value="Show!" class="button" style="margin-top: 4px;"> </td></tr></table> i want this box's values to update my SQL query so it shows only cars from that location seleteted. Code: [Select] <?php require("connections/db.php"); require("connections/require.php"); require("connections/jailed.php"); $submit = strip_tags($_POST['submit']); $ros = strip_tags($_POST['ros']); $play = mysql_query("SELECT * FROM `players` WHERE `playername` = '$player' LIMIT 1")or die(mysql_error()); $arry = mysql_fetch_array($play); $cash = $arry['money']; $qry = mysql_query("SELECT * FROM `garage` WHERE `owner` = '$player' ORDER BY `id` DESC")or die(mysql_error()); $num = mysql_numrows($qry); ?> <html> <head> <link rel="stylesheet" type="text/css" href="connections/style.css" /> <script type="text/javascript" src="selectall.js"></script> </head> <body> <form action="" method="post"> <table class="thinline" width="175"> <tr><td class="topic">Show All Cars From:</td> </tr><tr> <td> <select name="lim" class="text"> <option value="X">Everywhere</option> <option value="England">England</option> <option value="China">China</option> <option value="Japan">Japan</option> <option value="Brazil">Brazil</option> <option value="South-Africa">South-Africa</option> <option value="America">America</option><br><input type="submit" value="Show!" class="button" style="margin-top: 4px;"> </td></tr></table> <br> <table width="95%" align="center" class="tbl"> <tr><td align="center" class="hdr" colspan="8">.::Garage::.</td></tr> <tr> <td align="center" class="sub" width="5%"> <input type="checkbox" name="checkall" onClick="checkUncheckAll(this);"> </td> <td align="center" class="sub">Type</td> <td align="center" class="sub">Damage</td> <td align="center" class="sub">Value</td> <td align="center" class="sub">Origin</td> <td align="center" class="sub">Location</td> <td align="center" class="sub">Repair</td> <td align="center" class="sub">Sell</td> </tr> <? if ($num == 0){ ?> <tr><td align="center" class="tbl" colspan="8">You don't have any cars.</td></tr> <? }elseif ($num > 0){ while ($arr = mysql_fetch_array($qry)){ $id = $arr['id']; $car = $arr['car']; $dam = $arr['damage']; $origin = $arr['origin']; $location = $arr['location']; $status = $arr['status']; $value = $arr['value']; if ($status == 0){ $rep = "<a href=\"?rep=".$id."\">Repair</a>"; }else{ $rep = "Unavailable"; } if ($status == 0){ $sell = "<a href=\"?sell=".$id."\">Sell</a>"; }else{ $sell = "Unavailable"; } $car = "<a href=\"".$img."\" target=\"main\">".$car."</a>"; ?> <tr> <td align="center" class="tbl"> <input type="checkbox" name="radio[]" value="<? print $id; ?>"> </td> <td align="center" class="tbl"><? print $car; ?></td> <td align="center" class="tbl"><? print $dam; ?>%</td> <td align="center" class="tbl"><? print ("$".number_format($value).""); ?></td> <td align="center" class="tbl"><? print $origin; ?></td> <td align="center" class="tbl"><? print $location; ?></td> <td align="center" class="tbl"><? print $rep; ?></td> <td align="center" class="tbl"><? print $sell; ?></td> </tr> <? }} ?> <tr><td align="center" class="tbl" colspan="8"> <select name="ros"> <option value="sell" Selected>Sell</option> <option value="rep">Repair</option> </select> <? sub(submit,Submit); ?> </td></tr> </table> </form> </body> </html> 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?
1st the log in code: Code <form method ="post" action="cartnisya.php"> <table border="0"align="right"> <td>Username:</td> <td><input type="Text" name="Username"></td> <td>  </td> <td>  </td> <td>Password:</td> <td><input type="Password" name="Password"></td> <td>  </td> <td colspan="2" align="center"><input type="Submit" name=submit" value="Submit"></td> </table> <img src="Vinnex1.jpg"> </form> it will then go the php code: CODE: <html> <?php $db = mysql_connect("localhost", "root",""); mysql_select_db("vinnex",$db); $Username = $_POST['Username']; echo $Username; $result = mysql_query("Select TransNo From transaction", $db); $myrow = mysql_fetch_array($result); if ($myrow=='') { $TransNo='1000'; $sql = mysql_query("Select * From customer where Username='$Username'", $db); $myrow1 = mysql_fetch_array($sql); $Username = $myrow1['Username']; $Firstname = $myrow1['Firstname']; $Lastname = $myrow1['Lastname']; $name = $Firstname. " ".$Lastname; $Date = date('m/d/y'); $sql1 = "INSERT INTO temptransaction (TransNo, Username, Firstname, Date) VALUES ('$TransNo', '$Username', '$Firstname', '$Date')"; $result = mysql_query($sql1); //or die(mysql_error()); } else { $sql = mysql_query("Select max(TransNo) maxTransNo From transaction", $db); $myrow1 = mysql_fetch_array($sql); $orderno = $myrow1['maxTransNo']+1; $sql = mysql_query("Select * From customer where Username='$Username'", $db); $myrow1 = mysql_fetch_array($sql); $Username = $myrow1['Username']; $Firstname = $myrow1['Firstname']; $Lastname = $myrow1['Lastname']; $name = $Firstname. " ".$Lastname; $Date = date('m/d/y'); $sql1 = " INSERT INTO temptransaction (TransNo, Username, Firstname, Date) VALUES ('$TransNo', '$Username', '$Firstname', '$Date')"; $result = mysql_query($sql1) or die(mysql_error()); } ?> <meta http-equiv="refresh" content="0;url=orderproduct.html"/> </html> once this is open it will go the selected it wont display the matched echo for the text field. once i call the database when using username and password it wont filter and it wont call for a firstname and username to be saved in the database please help I have a property website and I want users to be able to filter the properties, So when they access the page, and click 'detached properties' only detached properties will appear, if the user selects 'semi-detached' then only semi detached properties will appear. I already have a mySQL database set up. Image attached here to have a better understanding. Hi there, I have been creating a website which shows products of the companys (www.theadventurestartshere.org) and I have been trying to make some filters for the products using URL Parameters and recordsheet filters... Can someone advise me on the easiest way to do this? As I have created a method to do it with, (check website) but it has to be entered manually and I was hoping there is an easier way? Please Note I like to use drop down boxes for the filters but if there is a way to do the checkbox style you see on say Amazon then that would be brilliant... I use Dreamweaver CS5, and the newest versions of PHP and MySql Many Thanks, Paul Basically I have a property page where I want users to be able to click 'detached' and then only detached properties will appear, if the user click 'semi-detached' then only semi-detched properties will appear. but these properties that I want to appear are just images, then a link to the actually property page with all the details. You can view the page here to get a better understanding: http://www.mumtazproperties.hostei.com/forsale.html At the moment all of the properties appear on the page. (and when you select the filters it actually does what I want it too, but through HTML) But I want the information to come from a database and then use PHP code to execute it all. Help is hugely appreciated, thanks. Hello everyone, I have website that uses the php(mail) function to notify users when something happens on their account. The site was created for a school district so all the users are district employees where their incoming email is subject to pretty strict spam filtering. I am using headers to indicate to the recipient that the email is coming from support@mysite.com, but I guess the mail servers see past this and recognize that it's coming from a php(mail) function. Because of this, all of the emails being sent are being blocked by the filter. I've tried adding all emails coming from an address that ends with "@mysite.com" but this doesn't work. This is what the addresses look like that the spam filter is actually seeing: elmas156@p3nlhftpg049.shr.prod.phx3.secureserver.net And I can't just add a single address to the white list because each time an email is sent, the letters and numbers after "@" and before "secureserver.net" are different. Here's another address that shows up: elmas156@p3nlhg331.shr.prod.phx3.secureserver.net here is the code that I'm using to send the emails: Code: [Select] <?php $sendto = "$email"; $emailsubject = "Testing Message Report For $cdate."; $emailmessage = "This is a test email."; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'From: MySite.com Report <support@mysite.com>' . "\r\n"; // Mail it mail($sendto, $emailsubject, $emailmessage, $headers); ?> Does anyone have any suggestions on what to do to make every email sent to be recognized by the spam filter as coming from the same email instead of a bunch of random ones? I hope this is making sense to someone because it was very difficult for me to explain in writing. Thanks in advance for any help or suggestions. Hi all,
I have been reading in almost everywhere that we should not use our own custom login and password validations ( like regex etc.) but instead use the filter_var and filter_input built in functions provided by PHP 5 and above. However even after searching for more than an hour for with different search strings, I have not found even a single example that shows how we may validate for a username/login and password in a login form. Can someone be kind enough to provide a strong secure validations for username and login.
Additionally I would also like to clarify if the username and login fields in a Login form be manipulated in any manner to pose a security threat? I mean can a hacker craft a username/login or password in such a manner as to pose an injection or any other threat?
Thanks all.
Folks, I am just trying to learn PHP. For form input validation which is better - Regexp or PHP Filters? Or do they have completely different uses? Where does preg fit in? Thank you! J.S. Hi, My hosting disabled my account because my site used too many system resources (CPU). There is no way for me to know how much CPU my site is using since i am not a psychic or god so no clue how they expect me to monitor this or fix this (the site has been running just fine for 2 years with the same code). Is there any code that can tell me how much CPU my site is using on the server? Thanks in advance, Jay |