prosoxi.com | Archive | PHP

Embed WordPress Outside WordPress

From time to time you need data from WordPress, but should not displayed in the system; they are necessary outside the installation. There are basically two options. Content can be quite easy provide via feed and processed or you gain access to the system. And that is basically very simple and is briefly described here.

Continue Reading

Posted in PHP0 Comments

block ip address using php

Place this code to top of page or to connection file!

Continue Reading

Posted in PHP0 Comments

WP Glossary

Absolute Path

An absolute path or full path is a unique location of a file or directory name within a computer or filesystem, and usually starts with the root directory or drive letter. Directories and subdirectories listed in a path are usually separated by a slash /.

Continue Reading

Posted in PHP0 Comments

WordPress How to translate month names in “Archives”

if the translation is only for the archive widget, a filter function might work (to be added to functions.php of the theme):

Continue Reading

Posted in PHP0 Comments

Install and Develop with Memcached

Your latest PHP/MySQL website is finally online. And it’s awesome. But it’s not as fast as you want it to be, because of the many SQL queries running every time a page is generated. And above that, you have the feeling it will not scale well under heavy loads. And you are most likely right.

Continue Reading

Posted in Linux, PHP0 Comments

PHP prosoxi fucntions

Prosoxi.com php functions!

Continue Reading

Posted in PHP0 Comments

PHP $_POST Array Empty

Fellow PHP programmers, I encountered a most peculiar problem today that I must share. I had a situation where someone was sending me POST data but the PHP $_POST array was empty. I setup a debugging script to see the GET and POST arrays and sure enough everything was empty. I asked my friend Google and found a neat way to get the raw incoming message using PHP:

$data = file_get_contents('php://input');

That convinced me that they were in fact sending me what looked like POST data but for some reason the PHP $_POST array was still empty. Long story short, what I discovered and hopefully what will save someone out there some time, is that if the Content-Type is empty or not recognized in the HTTP message then the PHP $_POST array is empty. Not sure if this is a bug or is by design…

Anyway if the guy on the other end can’t figure out how to send a properly formatted HTTP message, you can force the Content-Type as a last resort using something like this above where you want to access the $_POST array:

if(empty($_SERVER['CONTENT_TYPE'])){   $type = "application/x-www-form-urlencoded";   $_SERVER['CONTENT_TYPE'] = $type;   }

 

<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST'){    echo '<pre>',print_r($_POST, TRUE),'</pre><br /><br /><br />';}

?>

<form method="post" action="">    <input type="hidden" name="test1" value="one" />    <input type="hidden" name="test2" value="two" />    <input type="hidden" name="test3" value="three" />    <input type="submit" value="Test Me" /></form>

Source

http://www.bradino.com/php/empty-post-array/

http://stackoverflow.com/questions/1282909/php-post-array-empty-upon-form-submission

Posted in PHP0 Comments

PHP Array Operators

Array Operators

The + operator returns the right-hand array appended to the left-hand array; for keys that exist in both arrays, the elements from the left-hand array will be used, and the matching elements from the right-hand array will be ignored.

Continue Reading

Posted in PHP0 Comments

Php regular expression to match a div

Use an HTML parser. NOT regular expressions.

The problem with regular expressions is that they cannot match nested structures. Assuming your regex must match a single <div> and its closing tag, there is no way to correctly match this input:

Continue Reading

Posted in PHP0 Comments

PHP-MySql: Select previous row and next row from current ID

During the dark age, the simplest way to get previous row from current ID was using this query:

Continue Reading

Posted in PHP0 Comments

Domain Finder

Domain Finder Tool by Truste.gr

read more for domains

Advertisers

Wedstar all about wedding - gamos - γαμος
Κατασκευή ιστοσελίδων
Domain Names | Hosting

Adds