I have a file, named download.php, which contains a file to be downloaded, so it has the following headers (declared with PHP): header(“Content-Type: “.pathinfo($_GET[‘file’], PATHINFO_EXTENSION)); …
Tag: php
MySQLi $userid returning 0
I’m just learning the ropes of MySQLi, so got this mostly from a tutorial (though had to throw in parts from different sites – hence the errors). Is anyone able to explain why $userid returns 0 instead of 1 that it should be? I’m hoping it’s a simple mistake. The query is correct, I…
Laravel: Validation unique on update
I know this question has been asked many times before but no one explains how to get the id when you’re validating in the model. My validation rule is in the model so how do I pass the ID of the record to the validation rule. Here is my models/User models/BaseModel Answer One simple solution. In your Mo…
How to update Excel data? (Refresh all queries)
I have a Excel xlsm file with a few queries. Currently I open it every day and click on the “Refresh All” command in the “Data” tab. I want this to be done automatically. I wrote a script in python (I’m a newbie in Python). The problem is that after the data is refreshed and the …
Pinterest login with PHP and cURL not working
I have been trying to make cURL login into pinterest.com for the last 17 hours straight, have tried countless and countless different ways just with cURL but it does not work at all. My current code only goes to the page but the data is not posted, so it does not login just takes me to the login page. This
HTML form with windows cyrillic button’s names doesn’t work on OSX
I installed a site locally on OSX. The site was developed under windows and have cyrillic (Windows) encoding for some string values. I noted that some buttons with cyrillic values wouldn’t work until …
Facebook Graph API PHP SDK v4 – Post on Page
I wanna give all my website authors a possiblity to post their articles on our facebook page without having go give them admin access to it. So i created a simple form, where the author types in: URL, URL to image, message On submit, this form will send a ajax request to facebook.php where the magic “sh…
How to modify woocommerce_before_cart action
I’m trying to make my woocommerce cart template display as a full 12 column layout. The existing layout is using bootstrap’s col-sm-8 column. I need to change it to col-sm-12. I checked out the relevant woo-templates shown here, and copied the cart.php template into my theme to override. However, …
Uploading videos to a specific PREDETERMINED account with YouTube API v3
I have a website on which clients will be uploading videos. The thing is – I want those videos to be uploaded to OUR channel, not users’ channels. I don’t see how I could make it work using YouTube API v3. Every time a person wants to upload something using the access token I provided he has…
ftp_put is corrupting my movies after transfer, is it wrong?
I have a bunch of movies that I’m trying to transfer from my CentOS server onto my Windows PC. But when I run them through this script they end up being corrupt. Is there something wrong with the …