Home > Article > Backend Development > Advertising click statistics php+mysql
This time I will bring you advertising click statistics php+mysql. What are the precautions for advertising click statistics php+mysql? The following is a practical case, let’s take a look.
php Advertising click statistics code. Last night, several IDC websites wanted to cooperate with this site to put some advertisements, but I wanted to see the advertising effect, so I thought about it and wrote a simple advertising statistics code, here Just waiting for the statistics cannot be IP restrictions or disgusting clicks, etc.
First comeCreate the database.
CREATE TABLE IF NOT EXISTS `ad_count` ( `ad_id` int(8) NOT NULL auto_increment, `ad_hit` int(8) NOT NULL default '0', `ad_name` varchar(200) character set gb2312 default NULL, `ad_datetime` datetime default NULL, `ad_qq` varchar(15) character set gb2312 default NULL, `ad_url` varchar(900) character set gb2312 NOT NULL, `ad_price` int(8) NOT NULL, PRIMARY KEY (`ad_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
After the data is created, we start writing the program. I won’t write the data connection anymore,
2aad84964faecd1fdf46c5f857289e63',$Str); $temp =str_replace('2e25816d21694bff5da62d4c7a0dd1c2','>',$Str); $temp =addslashes($Str); return $temp; } function get_value($value,$para){ return htmltohtml(empty($para)?(isset($_GET[$value])?$_GET[$value]:''):(isset($_POST[$value])?$_POST[$value]:'')); }
Then we will write as follows where we want to display the advertisement.
<a href=/cp/ad_count.php?ad_id=2 target=_blank><img src=/ad_a/ad2.gif border=0 /></a>
That’s it
I believe you have mastered it after reading the case in this article For more exciting methods, please pay attention to other related articles on the php Chinese website!
Recommended reading:
PHP implementation of array recursive sorting
Implementation of automated testing function of phpunit interface
The above is the detailed content of Advertising click statistics php+mysql. For more information, please follow other related articles on the PHP Chinese website!