Php for get keywords from search engine referrer

I search, found and modified this php script for my purpose. I want to collect keyword from search engine that refer visitor to my website/ post. May be this script not really useful for you, or may be this scrip has some problems or bug, I hope you may help me to correct it, so this simpe php script can be very useful for others who need this script.

Code :

<?
$referrer = $_SERVER['HTTP_REFERER'];
$referrer ='http://www.google.co.id/search?hl=id&client=firefox-a&hs=IKn&rls=org.mozilla%3Aen-US%3Aofficial&channel=s&q=pemahaman+pelajaran+ips+tentang+endogen+dan+eksogen&aq=f&aqi=&aql=&oq=&gs_rfai=';
$referrer_query = parse_url($referrer);
$referrer_host = $referrer_query['host'];
$referrer_query = $referrer_query['query'];
$q = "[q|p|qkw|key|query|searchfor|Keywords|searchterm]"; //Yahoo uses both query strings, I am using switch() for each search engine
preg_match('/'.$q.'=(.*?)&/',$referrer,$keyword);
$keyword = urldecode($keyword[1]);

$potongnya = array('&q=','&p=','key=','query=','searchfor=','Keywords=','searchterm=');
$referrer_query = str_replace($potongnya, "&|pencarian=", $referrer_query);
$arr = explode("&", "$referrer_query");
for($k = 0, $l = count($arr); $k < $l; ++$k)
 {
 $ygdicari = "$arr[$k]";
$findmeyach = "|pencarian=";
$posnyaaa = strpos($ygdicari, $findmeyach);
if ($posnyaaa === false)
 {}
 else
 {
$keyword = str_replace('|pencarian=', "", $ygdicari);
$potongkeynya = array('+','%20');
$keyword = str_replace($potongkeynya, " ", $keyword);
 }
 }
if ($keyword=="")
 {
$potongnya = array('q=','p=');
$referrer_query = str_replace($potongnya, "&|pencarian=", $referrer_query);
$arr = explode("&", "$referrer_query");
for($k = 0, $l = count($arr); $k < $l; ++$k)
 {
 $ygdicari = "$arr[$k]";
$findmeyach = "|pencarian=";
$posnyaaa = strpos($ygdicari, $findmeyach);
if ($posnyaaa === false)
 {}
 else
 {
$keyword = str_replace('|pencarian=', "", $ygdicari);
$potongkeynya = array('+','%20');
$keyword = str_replace($potongkeynya, " ", $keyword);
 }
 }

 }
$keyword = strtolower($keyword);
$urikeyword = array('sex ','porn ','porno',', ','penis ','penis ','http://www.','http://','http','gamble','"',"'");
$keyword = str_replace($urikeyword, "", "$keyword");
echo "$keyword";
exit;
?>

Continue Reading

Incoming search terms for the article:

search term referer php, PHP: get keywords from search engine referer url, how to change referrer with php, php get search engine referred keyword, php referrer script test search terms, php referer q= p=, PHP Keyword Referrer, php keyword referer, php how to get search engine referred and keyword from visitor, php get seasrch terms from referer

Simple script for update statistics of your website or other usage

This is simple script for update statistics for your own website.
First we must have database/field at your database for statistics.
Ex : We add field “statistics” INT at your table “settings”

At file index, we must place code this :

mysql_query("UPDATE settings SET statistics=(statistics+1) WHERE ID=1");

That’s mean : script will count field statistics everytime file index.php loading. “Where ID=’1′” means we just update database settings that ID = 1. This is for only update statistics of ID 1

php for encrypt your data

This php useful for encrypt your data. We can use this php for encrypt our email, or our customer email or other data.

We can use this php with $_GET function without no worry. Usually I use my variable with no encrypt like this :

$email = "$data[email]";
$link = go.php?email=$email;
echo "<a href=\"$link\">Other Page</a>";

with that php code, email will show at website url address. And this is can be manipulated by other for try something, with just change the link with some : http://mywebsite.com/go.php?email=other_email.

This is example for easy about email, but if we want to hide that email, we can use belod php code :

$email = base64_encode($data[email]);
$link = go.php?email=$email;
echo "<a href=\"$link\">Other Page</a>";

With this code, at web url address will not again display our email, but has been encrypted.

For use the result at file go.php, we must change the encrypt result to real email.

Code :

$email = base64_decode($_GET['email']);

with that code, we will get real value of variable email.

We can use this code for other purpose like  encrypt name, maybe address or bank account number or others that we want to hide that from visibility.

create cloud Tag use mysql database

This is other way to list cloud tag using mysql database.

<?php
$rtag = mysql_query("select * from tampilantag limit 50") or die(mysql_error());
if(mysql_num_rows($rtag) >0)
{
while($atagnya = mysql_fetch_array($rtag))
 {
if ($atagnya[dipake]>=18)
$ukuranfont ="18"."px";
else if ($atagnya[dipake]<9)
$ukuranfont ="9"."px";
else
$ukuranfont ="$atagnya[dipake]"."px";
echo"<a href=\"$atagnya[namatag].tag\" style=\"font-size:$ukuranfont\">$atagnya[namatag]</a>"." ";
 }
}
?>

This method will only display 50 Tag list from mysql database. We can change it with we like.

At tampilantag table, we need field :
namatag : variable char
dipake : variable Int

Enjoy it

Incoming search terms for the article:

mysql create cloudtag

Basic for select database and show which row we want to

This is basic for display row of our table that we want to show it.

$nilai = mysql_query( "SELECT * FROM admin WHERE kode='$kode'" ) or die( mysql_error() );
$data = mysql_fetch_array( $nilai );
$nnilai = mysql_num_rows( $nilai );

for display array of our row “WHERE kode= $kode “, use “$data[table_field]”

Example : admin table field contains : ID , username, password
for show the result :

ID Admin : <?php echo "$data[ID]"; ?>

Username Admin : <?php echo "$data[username]"; ?>

Password Admin : <?php echo "$data[password]"; ?>

$nnilai is for count row from admin table “WHERE kode= $kode ”

If we place code : <?php eho “$nnilai”; ?> It will show integer number.

Have nice try

Make text stay on top

This is for make some text or other to stay on top.

This effect only can not show at Internet Explorer 6 or below.

For make stay on top effect,

Copy paste this below code inside




and This is the div for text display on top

copy paste this code inside <body> </body>
For WordPress, place it at footer.php of your theme before </body>
Image for close, you can change the “images.gif” with your own image source


You can see this example at this website

Php script for make TAG Cloud for more interactive website

TAG Cloud. That’s show our TAG or others for make our website more interactive. I use this for my classified website. I want to display TAG of Ads’ TAG. After search at google, I use this script and I think this script good.

This for Style. Place it between <head> and </head> of our website.


You can change/edit the style for your own purpose. You can set the color, border if you want or other else.

And this is example for using tag cloud. Example display TAG for categories

< ?php /** this is our array of tags * We feed this array of tags and links the tagCloud * class method createTagCloud */ $tags = array( array('weight' =>40, 'tagname' =>'Art and Entertainment', 'url'=>'http://obamatruthsquad.com/category/art-and-entertainment'), array('weight' =>12, 'tagname' =>'kloxo server', 'url'=>'http://obamatruthsquad.com/category/internet/kloxo-server'), array('weight' =>15, 'tagname' =>'BUSINESS', 'url'=>'http://obamatruthsquad.com/category/business'), array('weight' =>10, 'tagname' =>'domain', 'url'=>'http://obamatruthsquad.com/category/internet/domain'), ); /*** create a new tag cloud object ***/ $tagCloud = new tagCloud($tags); echo $tagCloud -> displayTagCloud(); ?>
< ?php class tagCloud{ /*** the array of tags ***/ private $tagsArray; public function __construct($tags){ /*** set a few properties ***/ $this->tagsArray = $tags; } /** * * Display tag cloud * * @access public * * @return string * */ public function displayTagCloud(){ $ret = ''; shuffle($this->tagsArray); foreach($this->tagsArray as $tag) { $ret.=''.$tag['tagname'].''."\n"; } return $ret; } } /*** end of class ***/ ?>

Hope this usefull

Incoming search terms for the article:

php interactive tag cloud, building interactive cloud with php, search site create tag cloud php, tag cloud php script, tag cloud php script for website, tag cloud PHP script use URL, tag cloud script, tag cloud script for websites, tag cloud script in php, tag cloud script in php for showing different location

easy step set table inside if else PHP script

I always use this method for see my code for set table or else inside if else PHP, like this :

<?php
if ($error !="")
{
?>
table border="0" cellspacing="0" cellpadding="0">
 <tr>
 <td><?=$error?></td>
 </tr>
</table>
<?
}
?>

At top, I want to show error, so I use that method for make it simple.
So I can check it easy.

I use <?=$error?>. This is same with <? echo “$error”; ?>

You can use this method for your own purpose. Just make it simple.

<?php
if ($error !="")
{
?>
fill here if variable error ($error) not empty
<?
}
else
{
?>
Fill here if vairable error is empty
<?php
}
?>

Php code for replace characters

I use this php code for replace character that I don’t need at my classified website.

You can use this code for replace text you want to replace.
The PHP code :

$uri = array('>> ','> ',' >',',-',' >>',' <<',' <','<< ','< ','~ ',' ~','~',' `','` ','`', ' !', '!',' @','@ ','@',' #','# ','#','$ ','$', ' %', '% ', '%', ' -', '- ', '-', ' ^', '^ ', '^', '& ', ' &','&', ' *', '* ','*', '( ','(',' )',')',' _','_ ','_',' +','+ ','+',' =','= ','=',' `','` ','`','[ ','[',' ]',']',' |','| ','|',' :',': ',':','{ ','{',' }','}',' /','/ ','/','; ',' ;',';',' "','" ','"','<','>',' ,',',',' .','.',' ?','?','%20',' '); 

$result = str_replace($uri, "_", $_POST[comment]);

That’s code will change automatic for character list for variable uri and replace it with _

For other use : we can use for replace bad word.

PHP code :

$uri = array('sex','badword'); 

$result = str_replace($uri, "edited", $_POST[comment]);

And result, every word “sex” and “badword” will replace with text “edited”  for comment post.

Incoming search terms for the article:

obamatruthsquad com

Php mysql query for Insert field use PHP

This is  mysql query for insert field to Table.

This is use after form post/ form get. I usually use form with method “POST”.

And this is simple for insert my form post result to table.

mysql_query( "
insert into bank set
nama_bank = '$_POST[nama_bank]',
no_rekening = '$_POST[no_rekening]',
an_rekening = '$_POST[an_rekening]',
bank_cabang = '$_POST[bank_cabang]'") or die( mysql_error() );

where

$_POST[nama_bank] is our value for input type with name "nama_bank"
$_POST[no_rekening] value for input name "no_rekening"
$_POST[an_rekening] value for input name "an_rekening"
$_POST[bank_cabang] value for input name "bank_cabang"

So, that PHP is order to insert to table “bank”

field "nama_bank" at our table filled with $_POST[nama_bank]
field "no_rekening" at our table filled with $_POST[no_rekening]
field "an_rekening" at our table filled with $_POST[an_rekening]
field "bank_cabang" at our table filled with $_POST[bank_cabang]

Incoming search terms for the article:

MySQL and INSERT FIELD, simple form insert query php