I am trying to upload an image and passing the userID and file through ajax to the PHP file profileSettings.inc.php. However it succeed in running the php file, but the data was not passed through. When I ran print_r($_POST);, in the php file it returned an empty array. Form: profileSettings.inc.php: ?> An…
Security for websites
I am trying to add some security to my website which has an admin panel and a user page. So far my security has code which sends the user back to the login page if the user tries to access a page through the url. However, there is still one problem that remains. If I login as a user, the
Laravel foreach loop malfunctioning with old() data
I have a form that allows users to add a new row of inputs by clicking a button. For some reason on form submit (with a required row purposefully left empty to test form repopulation), index #1 is being skipped, and it happens every time the form is submitted. Also, extra rows are added on submit, and I can&#…
PHP file download not recognizing file type in Chrome and Edge
I’m trying to create a simple download page, which currently works in Firefox but not entirely in Chrome and Edge. The file to download is an mp3, located in a private directory on the server. When I download the file in Firefox it works as intended. If I download it using Chrome or Edge the file still …
Laravel: Why are results from the database being displayed in the view differently than what Dump&Die says is retrieved?
I have a table called parts. The primary key is part_id, it is not to be incremented, it is a VARCHAR (Laravel string). All part id’s are 2 numbers, hyphen, 4 numbers (e.g. 12-3456) When the results from a query are displayed in the web browser they are not entirely the same as what Dump&Die <?ph…
Any hook in WordPress that runs after session is started?
I need to set a session value in my plugin, but session isn’t started when WordPress loads my plugin and I don’t want to run if (!session_id()) session_start(); manually, because other plugins might rely on setting cookies, etc and face a “headers already sent error”. Is there any hook…
PHP strpos() not acting as expected
I am attempting to clean up my URLS in the database, however I am literally having a brain-fart. This is PHP 101 level stuff, but I seriously cannot figure out what’s wrong with the following snip: &…
WordPress debug – call_user_func_array() expects parameter 1 to be a valid callback
I’ve just updated my WordPress to a new version & I’m getting this error: Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘restrict_admin’ not found or invalid function name in /home/burngeopk/public_html/members/wp-includes/class-wp-hook.php on…
Get weight value from WooCommerce variations of a variable product
I am working on a plugin that auto adjusts product prices. All of my products are variable products which has made this tougher than I can solve. I have a check to make sure the product is variable. The only product Attribute is ‘Size’. Here I have 4-8 different Size Variations per product. Each o…
Send email by Google API
I trying to send an email using Google API Send email controller look as public function sendMessage() { $client = self::getClient(); $service = new Google_Service_Gmail($…