r00t.gr

Programming and more

Entries for the ‘Php’ Category

How to make notepad++ Functions List plugin to work with Windows 7

I use Notepad++ daily for PHP Development. I love it, it’s simple and powerful at the same time. One good feature is the plugins that are available. One of them is Functions List. If you try to install that plugin on a Windows 7 Machine, it will not work ok. You have to do some […]

How to find how many days are there between dates

I was writting a car rental application for some customer, when i came across this problem. Fortunatelly I found the  solution easier that I thought. You have to love google! So here is the solution: Takes into account leap years and it’s tested and it works great.     function dateDiff($start, $end) { $start_ts = […]

Make a POST request with php (No curl or anything else needed)

I found this great post here: http://wezfurlong.org/blog/2006/nov/http-post-from-php-without-curl/ that explains how to make a POST request with php, no curl needed. This is very convinient in many situations. For example I wanted to get the pagerank of some page for some project I am working on. Getting pagerank is hard, you have to know datacenter ips […]

How to get alexa rank with PHP

Ok usefull function for many people. After some googling I give you the easiest way to get the alexa rank: <? $url="toolspot.org"; function getAlexa($url) { $xml = simplexml_load_file(’http://data.alexa.com/data?cli=10&dat=snbamz&url=’.$url); $rank=(int)$xml->SD[1]->POPULARITY->attributes()->TEXT; $web=(string)$xml->SD[1]->POPULARITY->attributes()->URL; return $rank; } echo $url." has Alexa Rank ".getAlexa($url);     function alexaRank($domain) { $remote_url = ‘http://data.alexa.com/data?cli=10&dat=snbamz&url=’.trim($domain); $search_for = ‘<POPULARITY URL’; $part=”; if ($handle = […]

How to import .sql file with php

I am writing an MVC framework with php, and a Content Management System on top of it. As part of that MVC Framework I created an automatic module installer. A part of that installation script is to take an SQL file and import it into the database. Unfortunately this isn’t as easy as it sounds. […]

Creating MVC Framework in PHP

[This article doesn’t explain how to built a Framework, but introduces CodeIgniter, the simplest fucking possible framework out there, at least from those i have seen. If you are looking into how to create a framework, just see spend some time to start reading the documentation. You will see that in 5 hours you will […]

How to fix: PHP Deprecated: Comments starting with ‘#’ are deprecated in /etc/php5/cli/conf.d/ming.ini on line 1 in Unknown on line 0

I setup an Ubuntu system with nginx and php, but i noticed a strange error. Every time i run something php related in the console i get this strange error: PHP Deprecated: Comments starting with ‘#’ are deprecated in /etc/php5/cli/conf.d/ming.ini on line 1 in Unknown on line 0PHP Deprecated: Comments starting with ‘#’ are deprecated […]