#StackBounty: #php #wordpress #woocommerce How to show different sizes on select of particular PRODUCT in Woocommerce

Bounty: 50

In Woocommerce, Single product page I have used the 2 different sizes, one for top and other for pant. If the user wants to select pant only pant size select box will show and if the user selects the top size only top size will show and if the user wants to buy the full product both pant and top size will show. Select item has 3 options: Pant, Top, Full.

https://drive.google.com/open?id=17_lJZ1dMnITvW3gQY1ZLNigzZcVMrWDvUA


Get this bounty!!!

#StackBounty: #php #apache #http-status-code-403 #fpm Random 403 errors with apache+php-fpm

Bounty: 100

On a server of mine, running Ubuntu 14.04.5 with Apache 2.4.23 and php-fpm 7.0.11, I’m getting random 403 errors.

I say “random” because the page I see in logs with 403 are running fine when I try them. Also, I experienced directly (I mean by visiting a site on the server with my browser) that I got a 403 error, then retried (just refreshing) and I got a 200.

The server is running some websites (about a dozen), with various kind of solutions (a couple of WordPress, a few old spaghetti php apps, mostly modern apps based on Symfony framework).

I’d also be happy if someone can point me to some way to increase the verbosity of some logs, to try resolving this issue on myself. Currently I see the 403 errors in the apache logs of vhosts.


Get this bounty!!!

#StackBounty: #php #iis #log-files Having PHP Error Log in IIS Log – One for each site

Bounty: 50

I am currently trying to do as I was doing in apache: setting a different PHP Error Log for every application. I read a few tutorial so far and none seems to explain exactly what I want and I cannot believe IIS administrator are not using it since it is a basic and very useful feature.

First of all, I did set these specification in my php.ini file:

log_errors = On
error_log = syslog
error_reporting = E_ALL

Then, in IIS, in the «Logs» option of my Website, I selected the W3C Format, selected the option «One file per site», select «LOG File and ETW Events» and set the task to create a new file every day. I created a bug (by purpose) on my website (causing a 500 error) but it doesn’t seem to keep it in the log. I can see in the log that a user went on the page and had an error 500, but the error is not reported…

Is this even possible using IIS? If so, how?

PS: I do not care to have a separate log for every website containing only the PHP Error(s), or every error linked in one site (that wouldn’t bother me either).

PPS: I know error_log could be a path to one file, but I’d really want each site to have their individual error log…

Thank you, a lot and have a good day.


Get this bounty!!!

#StackBounty: #php #mysql #database #rest #codeigniter Create API endpoint for fetching dynamic data based on time

Bounty: 50

I have a scraper which periodically scrapes articles from news sites and stores them in a database [MYSQL].
The way the scraping works is that the oldest articles are scraped first and then i move onto much more recent articles.

For example an article that was written on the 1st of Jan would be scraped first and given an ID 1 and an article that was scraped on the 2nd of Jan would have an ID 2.

So the recent articles would have a higher id as compared to older articles.

There are multiple scrapers running at the same time.

Now i need an endpoint which i can query based on timestamp of the articles and i also have a limit of 10 articles on each fetch.

The problem arises for example when there are 20 articles which were posted with a timestamp of 1499241705 and when i query the endpoint with a timestamp of 1499241705 a check is made to give me all articles that is >=1499241705 in which case i would always get the same 10 articles each time,changing the condition to a > would mean i skip out on the articles from 11-20. Adding another where clause to check on id is unsuccessful because articles may not always be inserted in the correct date order as the scraper is running concurrently.

Is there a way i can query this end point so i can always get consistent data from it with the latest articles coming first and then the older articles.

EDIT:

   +-----------------------+
   |   id | unix_timestamp |
   +-----------------------+
   |    1 |   1000         |
   |    2 |   1001         |
   |    3 |   1002         |
   |    4 |   1003         |
   |   11 |   1000         |
   |   12 |   1001         |
   |   13 |   1002         |
   |   14 |   1003         |
   +-----------------------+

The last timestamp and ID is being sent through the WHERE clause.

E.g.
$this->db->where('unix_timestamp <=', $timestamp);
$this->db->where('id <', $offset);
$this->db->order_by('unix_timestamp ', 'DESC');
$this->db->order_by('id', 'DESC');

On querying with a timestamp of 1003, ids 14 and 4 are fetched. But then during the next call, id 4 would be the offset thereby not fetching id 13 and only fetching id 3 the next time around.So data would be missing .


Get this bounty!!!

#StackBounty: #php #url-rewriting Rewrite sub folder dynamically with country code in WordPress using PHP

Bounty: 50

I know this question has been asked so many times but I didn’t find any working solution or example which I can use to fix my problem.

I have been working on a client site. There are two similar sites, one for their own country and second for other countries visitors.

Their main site hosted in the root of server and second site hosted in the sub folder.

Now what I want is dynamic url rewrite for second site which is hosted into sub folder with the country code of the visiting user.

For e.g.

http://example.com

http://example.com/subfolder/

are the urls.

I want this http://example.com/subfolder/ to be changed into this http://example.com/country_code/ where country_code is visitor country code in ISO format getting through php function.

So if user is from United States the subfolder must be changed into us, the new url should be now http://example.com/us/.

I want this to work for all type of pages, whether its a page, post, category, tag or author page.

So again, http://example.com/subfolder/any-type-of-url/ => http://example.com/country_code/any-type-of-url/

Remember country_code is user/visitor country code in ISO format.

Let me know if someone needs more information on this. Thanks in Advance.

PS: I tried to achieve this using add_rewrite_rule() function available in WP.


Get this bounty!!!

#StackBounty: #php #apache-2.4 #.htaccess #httpd #php.ini php_value overrides with Apache using a front controller

Bounty: 50

I am trying to set specific server side value for virtual paths used to upload files.

All my URLs are virtual and requested are dispatched by a front controller. I have the following config in my site’s only .htaccess file:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^ index.php [L]
</IfModule>

Since upload_max_filesize cannot be set with ini_set, I need to used either .htaccess files or Apache .conf to overrides this setting.

Considering I do not have real files/folders to put .htaccess, I presume the only way is to use Apache .conf.

I tried several ways to make it way using either <LocationMatch>, <Location> and even <FilesMatch> but cannot figure out how to make it work.

Here is how my site’s vhost.conf look like:

<LocationMatch "upload">
    php_value upload_max_filesize    60M
</LocationMatch>

<Directory "/mysite/documentroot">
    DirectoryIndex index.php
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

My theory is that since my site is using a single FrontController that that the <Location> rule is applied after the redirect, it’s impossible to do this from an Apache side.

Unless I missed something, the best way to solve this would be to request a feature change on the PHP side to allow changing these settings using ini_set?


Get this bounty!!!

#StackBounty: #php #laravel #laravel-socialite Socialite laravel 5.4 Facebook login error (ClientException in RequestException.php line…

Bounty: 50

in past signup with Facebook functionality working fine suddenly when i signup or Login with facebook then i am facing this error

ClientException in RequestException.php line 111: Client error: GET
https://graph.facebook.com/v2.8/me?access_token=&fields=name,email,gender,verified,link&appsecret_proof=5fbda0d218f94cb8024712269c053f0186d360efd82cd358b588eaf621e0c79c
resulted in a 400 Bad Request response: {“error”:{“message”:”An active
access token must be used to query information about the current
user.”,”type”:”OAuthExce (truncated…)

i am using Socialite Package

Note: For some reasons i can’t update composer or complete socialite package

Note: i had some changes in socialite packages for some purpose. if i update whole package then previous changes will be affect.. i did some changes in LinkedInProvider and GoogleProvider files.. i need proper solution for this error

My project is live and users facing this problem. any help will be appreciate..


Get this bounty!!!

#StackBounty: #php #javascript #theme-customizer #settings WordPress customizer: load controls in a custom div

Bounty: 100

I have a custom div (holder for extra settings) which I need to load some specific controls from a specific section in there. I can get the controls in JavaScript but I can’t generate the necessary HTML as WordPress do in sections.

wp.customize.section( 'custom_div_1' ).controls();

It gives an array of controls but how to generate the HTML like Site title or Tagline controls in default WordPress section.

This custom div will toggle by the left button Open extra settings.

Screenshot for easier understanding:screenshot

Any help is appreciated.


Get this bounty!!!

#StackBounty: #php #image #math #imagemagick #sequence Determine tile size sequnce

Bounty: 50

please help, i am stuck very seriously, i have following tile values:

$tileheight = "58"; // 100x100  104px   560x560
$tileheight = "36"; // 200x200  104px   560x560
$tileheight = "32"; // 300x300  104px   560х560
$tileheight = "30"; // 400x400  104px   560х560

100×100…400×400 – height and width of generated image inside tile

104px – height of tile

560×560 – height and width that will always outputs (fits in image)

What would be the value – “?” for dimension 500×500? What formula could i use?

$tileheight = "?"; // 500x500 104px   560х560

Here for what result will outputs for 400×400:
400x400

UPDATE:

Here what code i use for conversion:

exec("convert '$image' -resize ".$imgw."x".$imgh."! -quality 100 'proc/res$session.jpg'");

exec("convert '$tile' -resize x".$tileheight." -quality 100 'proc/til$session.jpg'");

exec("convert $image $pp -write mpr:image +delete 
proc/til$session.jpg -write mpr:edge_top +delete 
proc/til$session.jpg -write mpr:edge_btm +delete 

mpr:image -alpha set -bordercolor none 
-compose Dst -frame ".$tileheight."x".$tileheight."+".$tileheight." -compose over 

-transverse  -tile mpr:edge_btm 
-draw 'color 1,0 floodfill' -transpose -draw 'color 1,0 floodfill' 
-transverse  -tile mpr:edge_top 
-draw 'color 1,0 floodfill' -transpose -draw 'color 1,0 floodfill' 

mpr:image -gravity center -composite proc/ok$session.jpg");

$input = "proc/ok$session.jpg";
$toWidth  = "840";
$toHeight = "560";
$quality  = "100";
// -background white -gravity center -extent {$toWidth}x{$toHeight}
exec("convert $input -thumbnail {$toWidth}x{$toHeight} proc/ok$session.jpg");

Here what formula i use to make correct tile height:

$tiledata = getimagesize($tile);

$tilewidth = $tiledata[0];
$tileheight = $tiledata[1];

$math1 = ($tileheight+$tileheight)/($imgw+$imgh);
$tileheight = $tileheight * $math1;


Get this bounty!!!