Skip to content

Tag: php

SQL Export – WordPress plugin DEV

Hi So i have the following code.. Now, it works but doesnt download the file. Saying headers already sent. headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/~/wp-admin/includes/template.php:1642) Now i understand that the headers have been sent from my main plugin file already t…

Php convert ipv6 to number

In Ipv4 we can use ip2long to convert it to number, How to convert ipv6 compressed to number in PHP? I tried inet_pton and it’s not working. $ip_1=’2001:0db8:85a3:0000:0000:8a2e:0370:7334′; $ip_2=’…

crypt password storage and retrival php

I am trying to set up a secure login & register system using crypt() as I have read that that is php’s stored function for bcrypt I am registering a user but taking their password and and then crypting it. I then store $hashed_password in the db then when the user logs in I am trying to match the pa…

PHP date add 5 year to current date

I have this PHP code: $end=date(‘Y-m-d’); I use it to get the current date, and I need the date 5 years in the future, something like: $end=date(‘(Y + 5)-m-d’); How can I do this?

How to check if the request is an AJAX request with PHP

I would like to check server-side if a request to my php page is an ajax request or not. I saw two ways to do this: First way: sending a GET parameter in the request which tells the page that this is an AJAX request (=mypage.php?ajax) mypage.php: Second way: set a header to the xmlHttpRequest: client-side js:…

file_get_contents seems to add extra returns to the data

Hi I am trying to run a simple php file open, replace, and save. Here is my code: My file opens, does the replace, and saves the file. But when I opened the file I noticed that there was an extra line return after every item that previously had only one line return. I tested printing out the data directly