CPA/CPL affiliate networks that show targeted ads

That is what I get for my browser.
Something like this would work well.
$langdone == false;
if (preg_match("/en-gb/siU", $_SERVER["HTTP_ACCEPT_LANGUAGE"]) == 1) {
 echo "echo your en gb links/banner";
 $langdone == true;
}
if (preg_match("/en-us/siU", $_SERVER["HTTP_ACCEPT_LANGUAGE"]) == 1) {
 echo "echo your en us links/banner";
 $langdone == true;
}
// default
if ($langdone==false) {
 echo "echo your default links/banner";
}
?>

In php preg_match the s = treat as string, not exactly needed as there are no new lines, i = case insensitive and U = ungreedy

Posted in Php Code. Comments Off on CPA/CPL affiliate networks that show targeted ads »

Ban users from your website using the .htaccess file

User IP Ban

Valid entries:
IP-addresses should have this format:
xxx.xxx.xxx.xxx

where “xxx” is a number between 0 and 255. In the .htaccess files you can specify a certain IP from your site, but you can also block full ranges.
Examples:
42.13.6.32
Block the specific IP address

212.172.49.
Blocks all IP’s from the range:

212.172.49.xxx
69.241.
Blocks all IP’s from the range:

69.241.xxx.xxx
81.143.4
Blocks all IP’s from the range:

81.143.4xx.xxx.xxx
To actually set the User IP Ban, put this code in your .htaccess file of your server (or create one of your own):

## USER IP BANNING

order allow,deny
#deny from 218.3.89.115
# deny from 222.184.47 dis allow ip from 222.184.47.0 to 222.184.47.255
allow from all

Posted in Apache. Comments Off on Ban users from your website using the .htaccess file »

Generate a phrase to url.

str_replace
(PHP 4, PHP 5)

str_replace — Replace all occurrences of the search string with the replacement string

$vowels = array(“a”, “e”, “i”, “o”, “u”, “A”, “E”, “I”, “O”, “U”);
$onlyconsonants = str_replace($vowels, “”, “Hello World of PHP”);

Posted in Php Code, Php Functions. Comments Off on Generate a phrase to url. »

How to write IE specific PHP

if((ereg("Nav", getenv("HTTP_USER_AGENT"))) || (ereg("Gold", getenv("HTTP_USER_AGENT"))) || (ereg("X11", getenv("HTTP_USER_AGENT"))) || (ereg("Mozilla", getenv("HTTP_USER_AGENT"))) || (ereg("Netscape", getenv("HTTP_USER_AGENT"))) AND (!ereg("MSIE", getenv("HTTP_USER_AGENT")) AND (!ereg("Konqueror", getenv("HTTP_USER_AGENT"))))) $browser = "Netscape";
elseif(ereg("MSIE", getenv("HTTP_USER_AGENT"))) $browser = "MSIE";
elseif(ereg("Lynx", getenv("HTTP_USER_AGENT"))) $browser = "Lynx";
elseif(ereg("Opera", getenv("HTTP_USER_AGENT"))) $browser = "Opera";
elseif(ereg("WebTV", getenv("HTTP_USER_AGENT"))) $browser = "WebTV";
elseif(ereg("Konqueror", getenv("HTTP_USER_AGENT"))) $browser = "Konqueror";
elseif((eregi("bot", getenv("HTTP_USER_AGENT"))) || (ereg("Google", getenv("HTTP_USER_AGENT"))) || (ereg("Slurp", getenv("HTTP_USER_AGENT"))) || (ereg("Scooter", getenv("HTTP_USER_AGENT"))) || (eregi("Spider", getenv("HTTP_USER_AGENT"))) || (eregi("Infoseek", getenv("HTTP_USER_AGENT")))) $browser = "Bot";
else $browser = "Other";

this will return the browser name in $browser

and you can have a test at http://www.botsvsbrowsers.com/SimulateUserAgent.asp.

example:

if(ereg(“Google”, getenv(“HTTP_USER_AGENT”))) $browser = “Bot”;
else $browser = “Other”; 

echo $browser;

Posted in Php Code. Comments Off on How to write IE specific PHP »

Plugin for limit the size of the post in the main page in WordPress

The  plugin  for WordPress in order to control the maximum amount of characters displayed for an entry on the main page. If the set limit is surpassed a link to a page with the whole content will appear and the text on the entry will be chopped to that amount of characters, otherwise the content will be showed unchanged. (more…)

Posted in Php Code, WordPress. Comments Off on Plugin for limit the size of the post in the main page in WordPress »

Show post titles at category, and show your own words at homepage.

<?php get_header(); ?>

<?php if (is_home())

echo ”
Welcome, add your own words here!

“; ?>

<?php if (!is_home())

{ ?>
<ul>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<li>
<a href=”<?php echo get_permalink()?>”><?php the_title(); ?></a>
</li>
<?php endwhile; endif; ?>
<ul>

<?php }  ?>

<?php get_footer(); ?>

Posted in Php Skills, WordPress. Comments Off on Show post titles at category, and show your own words at homepage. »

How show wordpres categories?

Method a:

wp_list_categories().

Usage
 <?php wp_list_cats(‘arguments’); ?> 

Examples
Default Usage
By default, the tag:

optionall – Does not display a link to all Categories
all – Text to display for link to all Categories
sort_column – Sorts by Category ID
sort_order – Sorts in ascending order
file – Displays the Categories using the index.php template
list – Sets the Categories in an unordered list (<ul><li>)
optioncount – Does not display the count of posts within each Category
hide_empty – Does not display links to Categories which have no posts
use_desc_for_title – Uses the Category description as the link title
children – Shows the children (sub-Categories) of every Category listed
hierarchical – Displays the children Categories in a hierarchical order under its Category parent (more…)

Posted in WordPress. Comments Off on How show wordpres categories? »

Not recognizing database while installing drupal 6.9

Here is the error that I’m receiving (below):

Failed to connect to your MySQL database server. MySQL reports the following message: Access denied for user ‘govspons_bmarkfo’@’localhost’ (using password: YES).
Are you sure you have the correct username and password?
Are you sure that you have typed the correct database hostname?
Are you sure that the database server is running?

A: In your sites folder, do you have a settings.php and a default.settings.php file? if not you should.

Posted in Drupal. Comments Off on Not recognizing database while installing drupal 6.9 »

Increase the memory-limit in php

When you run wordpress under xamm,
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 334230 bytes) in D:\xampp\htdocs\test.php on line814.

 1. Open \xampp\apache\bin\php.ini .Do not go to the directory of phpt to find php5.ini .
2. Search”memory” and get the following:

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 60     ; Maximum execution time of each script, in seconds
max_input_time = 60    ; Maximum amount of time each script may spend parsing request data
memory_limit = 32M      ; Maximum amount of memory a script may consume (16MB)

3. Modify the value of “memory_limit =” ,usuall change it to 64M.

4. Reboot Apache.

Posted in Apache, Php Functions, WordPress. Comments Off on Increase the memory-limit in php »

How to use trim() in php!

trim
(PHP 4, PHP 5)

trim — Strip whitespace (or other characters) from the beginning and end of a string

Posted in Php Functions. Comments Off on How to use trim() in php! »
King Php Science Designed by:KingPhp.com Welcome, you are from: 54.166.203.76